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
1 change: 0 additions & 1 deletion types/three/build/three.core.min.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion types/three/build/three.module.min.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion types/three/build/three.tsl.min.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion types/three/build/three.webgpu.min.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion types/three/build/three.webgpu.nodes.min.d.ts

This file was deleted.

7 changes: 6 additions & 1 deletion types/three/examples/jsm/Addons.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ export * from "./loaders/EXRLoader.js";
export * from "./loaders/FBXLoader.js";
export * from "./loaders/FontLoader.js";
export * from "./loaders/GCodeLoader.js";
export * from "./loaders/GLTFGaussianSplatLoaderExtension.js";
export * from "./loaders/GLTFLoader.js";
export * from "./loaders/HDRCubeTextureLoader.js";
export * from "./loaders/HDRLoader.js";
export * from "./loaders/IESLoader.js";
export * from "./loaders/KMZLoader.js";
export * from "./loaders/KSPLATLoader.js";
export * from "./loaders/KTX2Loader.js";
export * from "./loaders/KTXLoader.js";
export * from "./loaders/LDrawLoader.js";
export * from "./loaders/LottieLoader.js";
export * from "./loaders/LUT3dlLoader.js";
export * from "./loaders/LUTCubeLoader.js";
export * from "./loaders/LUTImageLoader.js";
Expand All @@ -114,6 +115,8 @@ export * from "./loaders/PDBLoader.js";
export * from "./loaders/PLYLoader.js";
export * from "./loaders/PVRLoader.js";
export * from "./loaders/RGBELoader.js";
export * from "./loaders/SPLATLoader.js";
export * from "./loaders/SPZLoader.js";
export * from "./loaders/STLLoader.js";
export * from "./loaders/SVGLoader.js";
export * from "./loaders/TDSLoader.js";
Expand Down Expand Up @@ -149,6 +152,7 @@ export * from "./misc/MorphAnimMesh.js";
export * from "./misc/MorphBlendMesh.js";
export * from "./misc/ProgressiveLightMap.js";
export * from "./misc/RollerCoaster.js";
export * from "./misc/Sculptor.js";
export * from "./misc/TubePainter.js";
export * from "./misc/Volume.js";
export * from "./misc/VolumeSlice.js";
Expand All @@ -158,6 +162,7 @@ export * from "./modifiers/EdgeSplitModifier.js";
export * from "./modifiers/SimplifyModifier.js";
export * from "./modifiers/TessellateModifier.js";

export * from "./objects/GaussianSplat.js";
export * from "./objects/GroundedSkybox.js";
export * from "./objects/Lensflare.js";
export * from "./objects/MarchingCubes.js";
Expand Down
10 changes: 10 additions & 0 deletions types/three/examples/jsm/controls/TrackballControls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ declare class TrackballControls extends Controls<TrackballControlsEventMap> {
*/
panSpeed: number;

/**
* The roll speed used for multi-touch roll. Default is `1`.
*/
rollSpeed: number;

/**
* Whether or not rotation is disabled. Default is `false`.
*/
Expand All @@ -62,6 +67,11 @@ declare class TrackballControls extends Controls<TrackballControlsEventMap> {
*/
noPan: boolean;

/**
* Whether two finger twist gesture rolls the camera around its view axis or not. Default is `false`.
*/
multiTouchRoll: boolean;

/**
* Whether or not damping is disabled. Default is `false`.
*/
Expand Down
5 changes: 5 additions & 0 deletions types/three/examples/jsm/exporters/GLTFExporter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export interface GLTFExporterOptions {
* Export custom glTF extensions defined on an object's userData.gltfExtensions property. Default is false.
*/
includeCustomExtensions?: boolean;

/**
* Export with a copyright notice embedded in the glTF. Default is null.
*/
copyright?: string;
}

type TextureUtils = {
Expand Down
64 changes: 60 additions & 4 deletions types/three/examples/jsm/generators/CityGenerator.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { Group, Material, MeshStandardNodeMaterial } from "three/webgpu";
import { Group, InstancedMesh, Material, MeshStandardNodeMaterial, Node, UniformNode } from "three/webgpu";
import { BenchGenerator } from "./city/BenchGenerator.js";
import { CarGenerator } from "./city/CarGenerator.js";
import { HydrantGenerator } from "./city/HydrantGenerator.js";
import { PersonGenerator } from "./city/PersonGenerator.js";
import { SidewalkGenerator } from "./city/SidewalkGenerator.js";
import { SkyscraperGenerator } from "./city/SkyscraperGenerator.js";
import { StreetlightGenerator } from "./city/StreetlightGenerator.js";
import { StreetTreeGenerator } from "./city/StreetTreeGenerator.js";
import { TrafficlightGenerator } from "./city/TrafficlightGenerator.js";
import { TrashcanGenerator } from "./city/TrashcanGenerator.js";

export interface CityGeneratorParameters {
seed: number;
Expand All @@ -12,6 +20,7 @@ export interface CityGeneratorParameters {
blocksZ: number;
curbHeight: number;
curbRadius: number;
sidewalkWidth: number;
}

export interface CityGeneratorLayout {
Expand All @@ -23,6 +32,9 @@ export interface CityGeneratorLayout {
blocksZ: number;
blockW: number;
blockD: number;
sidewalkWidth: number;
innerLotX: number;
innerLotZ: number;
cityW: number;
cityD: number;
}
Expand All @@ -31,6 +43,26 @@ export interface CityGeneratorMaterials {
building?: Material | undefined;
}

export interface CityGeneratorFurniture {
streetlight: StreetlightGenerator;
trafficlight: TrafficlightGenerator;
trashcan: TrashcanGenerator;
bench: BenchGenerator;
hydrant: HydrantGenerator;
tree: StreetTreeGenerator;
car: CarGenerator;
person: PersonGenerator;
}

export interface CityGeneratorTower {
x: number;
y: number;
z: number;
w: number;
h: number;
d: number;
}

/**
* 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
Expand All @@ -52,21 +84,45 @@ export class CityGenerator {
parameters: CityGeneratorParameters;
layout: CityGeneratorLayout;

/**
* The city seed shared by building and proxy materials. Pass this to
* {@link createBuildingMaterial} to update the palette when rebuilding.
*/
seedNode: UniformNode<"uint", number>;

generators: SkyscraperGenerator[];
towers: CityGeneratorTower[];
sidewalk: SidewalkGenerator;
furniture: CityGeneratorFurniture;
group: Group | null;

build(materials?: CityGeneratorMaterials): Group;

/**
* Builds a lightweight stand-in for the city: one instanced box per tower,
* sized to match, in a single draw call. Intended for cheap global-illumination
* bakes, where the detailed facades and street furniture are unnecessary and the
* boxes still cast the same street shadows and bounce the same warm fill.
*
* Call after {@link CityGenerator#build}, which records the tower boxes.
*/
buildProxy(): InstancedMesh;

buildFurniture(random: () => number): 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.
* The shared material every tower in a {@link CityGenerator} is dressed with: the per-lot
* {@link buildingColorNode} resolved once per vertex on a skyscraper material.
*/
export function createBuildingMaterial(layout: CityGeneratorLayout, seed?: number): MeshStandardNodeMaterial;
export function createBuildingMaterial(
layout: CityGeneratorLayout,
seed?: number | Node<"uint">,
): MeshStandardNodeMaterial;

/**
* The road surface: wet asphalt with lane lines and crosswalks aligned to a
Expand Down
16 changes: 5 additions & 11 deletions types/three/examples/jsm/generators/ForestGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,12 @@ export interface ForestGeneratorParameters {
}

/**
* Carpets a {@link TerrainGenerator} ( or anything exposing `sampleHeight`,
* `sampleSlope`, `minY`, `maxY` and `parameters.size` ) with a forest of hundreds
* of thousands of trees in a single draw call.
* Carpets a {@link TerrainGenerator} with trees in a single instanced draw call.
* Each tree is a distorted icosphere with a baked crown gradient. Altitude, slope
* and a density mask control placement; rotation and scale vary between trees.
*
* Each tree is the cheapest thing that still reads as a tree: a ~20-face icosphere
* squashed into a tapered teardrop and lumped with a little noise, carrying a baked
* dark-base / bright-top gradient. Tens of triangles each, so a single
* {@link THREE.InstancedMesh} of half a million of them costs one draw call. Trees
* are placed by rejection sampling against ecological rules — a min/max altitude
* band ( above the mist floor, below the snowline ), a slope limit ( none on
* cliffs ) and a low-frequency density mask that opens clearings — then jittered in
* yaw, lean and ( squared-biased ) scale so the stand never reads as copies.
* Compatible terrain objects expose `sampleHeight`, `sampleSlope`, `minY`, `maxY`
* and `parameters.size`.
*
* ```js
* const forest = new ForestGenerator( { count: 500000 } );
Expand Down
20 changes: 5 additions & 15 deletions types/three/examples/jsm/generators/TerrainGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,12 @@ export interface TerrainGeneratorParameters {
}

/**
* Bakes a procedural mountain range into a single {@link THREE.BufferGeometry} and
* returns a `THREE.Group` ready to add to a scene.
* Bakes a procedural mountain range into a single mesh, returned in a `THREE.Group`.
* Domain-warped, derivative-damped noise shapes the ridges; thermal erosion relaxes
* steep slopes. A TSL material shades grass, rock and snow from altitude and slope.
*
* The heightfield is a derivative-damped fractal sum ( Quilez's fake erosion ): each
* octave is suppressed where the running slope is already steep, concentrating detail
* into weathered ridgelines, and a low-frequency domain warp makes those ridges
* meander. A few passes of thermal ( talus ) erosion then relax any slope past the
* angle of repose, settling the fractal's needle-spikes into real crests.
*
* The grid is triangulated with alternating quad diagonals ( a diamond pattern ), so a
* coarse mesh holds its silhouette without a one-way grain. The surface shades itself
* from altitude and slope in TSL — grass, forest, rock, scree and snow, with detail
* normals and aerial perspective — so no material or textures are needed.
*
* The baked height grid is exposed through {@link TerrainGenerator#sampleHeight} so a
* scattered forest ( or anything else ) can sit exactly on the surface.
* The baked grid is available through {@link TerrainGenerator#sampleHeight} for
* placing a forest or other objects on the terrain.
*
* ```js
* const terrain = new TerrainGenerator( { seed: 1 } );
Expand Down
11 changes: 8 additions & 3 deletions types/three/examples/jsm/generators/TreeGenerator.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color, Material, Mesh, MeshStandardNodeMaterial, Node } from "three/webgpu";
import { Color, Material, Mesh, MeshStandardNodeMaterial, Node, Vector3 } from "three/webgpu";

export interface TreeGeneratorParameters {
seed: number;
Expand All @@ -7,6 +7,8 @@ export interface TreeGeneratorParameters {
branchAngle: number[];
angleVariance: number;
lengthRatio: number;
lengthVariance: number;
branchLengthFalloff: number;
trunkLength: number;
trunkRadius: number;
taper: number;
Expand All @@ -27,7 +29,7 @@ export interface TreeGeneratorParameters {

/**
* Grows a procedural tree skeleton — trunk, branches and twigs, each swept as a tapered
* tube — and bakes it into one non-indexed {@link BufferGeometry} (position and normal
* tube — and bakes it into one indexed {@link BufferGeometry} (position and normal
* only), ready to instance into a forest. It produces *branches only*; add foliage as a
* separate layer.
*
Expand Down Expand Up @@ -65,6 +67,8 @@ export class TreeGenerator {
setBranchAngle: (branchAngle: number[]) => this;
setAngleVariance: (angleVariance: number) => this;
setLengthRatio: (lengthRatio: number) => this;
setLengthVariance: (lengthVariance: number) => this;
setBranchLengthFalloff: (branchLengthFalloff: number) => this;
setTrunkLength: (trunkLength: number) => this;
setTrunkRadius: (trunkRadius: number) => this;
setTaper: (taper: number) => this;
Expand All @@ -85,13 +89,14 @@ export class TreeGenerator {

export interface TreeMaterialParameters {
barkColor?: Color | number | Node<"color"> | undefined;
barkScale?: Vector3 | undefined;
}

/**
* A simple bark material for a {@link TreeGenerator} mesh: a low-saturation brown with a
* faint, vertically-stretched grain, so trunks read near-black against bright fog.
*
* @param {Object} [parameters] - `barkColor` ( a hex, THREE.Color or TSL node ).
* @param {Object} [parameters] - `barkColor` ( a hex, THREE.Color or TSL node ) and `barkScale` ( a THREE.Vector3 ).
* @return {MeshStandardNodeMaterial}
*/
export function createTreeMaterial(parameters?: TreeMaterialParameters): MeshStandardNodeMaterial;
29 changes: 29 additions & 0 deletions types/three/examples/jsm/generators/city/BenchGenerator.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { InstancedMeshGenerator } from "./InstancedMeshGenerator.js";

export interface BenchGeneratorParameters {
length: number;
depth: number;
seatHeight: number;
backHeight: number;
}

/**
* A public street bench: timber slats carried on two cast-iron end frames that
* curl into armrests, with a reclined slatted backrest. Built once and instanced
* across a list of placements, dressed with one cheap material that branches on a
* baked `partId` ( warm stained wood, dark iron ).
*
* The canonical model stands on `y = 0`, centred in X / Z, runs along X and seats
* toward `+Z`, so a placement whose local `+Z` faces the road sits a passer-by
* looking out over it.
*
* ```js
* const benches = new BenchGenerator();
* scene.add( benches.build( placements ) ); // placements: Matrix4[]
* ```
*/
export class BenchGenerator extends InstancedMeshGenerator<BenchGeneratorParameters> {
constructor(parameters?: Partial<BenchGeneratorParameters>);

static defaults: BenchGeneratorParameters;
}
43 changes: 43 additions & 0 deletions types/three/examples/jsm/generators/city/CarGenerator.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { BufferGeometry, ColorRepresentation, Group, Matrix4, MeshStandardNodeMaterial } from "three/webgpu";

export interface CarGeneratorPlacement {
matrix: Matrix4;
color: ColorRepresentation;
}

/**
* A low-poly car fleet with lofted bodies, circular wheel arches, curved
* windscreens and recessed alloy wheels. Separate cabin panels define the
* windows and their frames. Two body types ( sedan and SUV ) are mixed
* deterministically across the fleet, and the taxi colour gets its own sedan with
* a roof sign, so a parked row reads as different vehicles rather than one mould.
*
* Each geometry is built once per type and shared; cars are grouped by body
* type with per-instance paint, so each group is a single instanced draw that
* assigns paint, glass, tyres and lamps using a baked `partId`, panel UVs and
* canonical-space masks.
*
* The canonical model stands with its wheels on `y = 0`, centred in X / Z, facing
* `+Z`, so a placement whose local `+Z` faces the road parks it nose-out.
*
* ```js
* const cars = new CarGenerator();
* scene.add( cars.build( placements ) ); // placements: { matrix: Matrix4, color }[]
* ```
*/
export class CarGenerator {
constructor(parameters?: {});

parameters: {};

geometries: Map<string, BufferGeometry>;
materials: Map<string, MeshStandardNodeMaterial>;
mesh: Group | null;

build(cars: CarGeneratorPlacement[]): Group;
dispose(): void;

static defaults: {};

static taxiColor: number;
}
Loading