@types/three 0.136.1 → 0.137.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
three/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 05 Jan 2022 03:01:26 GMT
11
+ * Last updated: Thu, 27 Jan 2022 22:31:34 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `THREE`
14
14
 
@@ -47,6 +47,10 @@ export class OrbitControls {
47
47
  mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE };
48
48
  touches: { ONE: TOUCH; TWO: TOUCH };
49
49
 
50
+ target0: Vector3;
51
+ position0: Vector3;
52
+ zoomO: number;
53
+
50
54
  update(): boolean;
51
55
 
52
56
  listenToKeyEvents(domElement: HTMLElement): void;
@@ -1,5 +1,5 @@
1
1
  import { BufferGeometry, Vector3 } from '../../../src/Three';
2
2
 
3
3
  export class ConvexGeometry extends BufferGeometry {
4
- constructor(points: Vector3[]);
4
+ constructor(points?: Vector3[]);
5
5
  }
@@ -1,6 +1,11 @@
1
1
  import { Loader, LoadingManager, Group, Material } from '../../../src/Three';
2
2
 
3
3
  export class LDrawLoader extends Loader {
4
+ materials: Material[];
5
+ materialsLibrary: Record<string, Material>;
6
+ fileMap: Record<string, string>;
7
+ smoothNormals: boolean;
8
+
4
9
  constructor(manager?: LoadingManager);
5
10
 
6
11
  load(
@@ -10,6 +15,7 @@ export class LDrawLoader extends Loader {
10
15
  onError?: (event: ErrorEvent) => void,
11
16
  ): void;
12
17
  loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Group>;
18
+ preloadMaterials(url: string): Promise<void>;
13
19
  setFileMap(fileMap: Record<string, string>): void;
14
20
  setMaterials(materials: Material[]): void;
15
21
 
@@ -10,7 +10,7 @@ export class ColorSpaceNode extends TempNode {
10
10
  nodeType: string;
11
11
 
12
12
  fromEncoding(encoding: number): void;
13
- fromDecoding(encoding: number): void;
13
+ fromDecoding(): void;
14
14
  copy(source: ColorSpaceNode): this;
15
15
 
16
16
  static Nodes: {
@@ -0,0 +1,5 @@
1
+ import { Group, Object3D } from '../../../src/Three';
2
+
3
+ export namespace LDrawUtils {
4
+ function mergeObject(object: Object3D): Group;
5
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * `PackedPhongMaterial` inherited from THREE.MeshPhongMaterial
3
+ *
4
+ * @param {Object} parameters
5
+ */
6
+ import { MeshPhongMaterial, MeshPhongMaterialParameters } from '../../../src/Three';
7
+
8
+ export class PackedPhongMaterial extends MeshPhongMaterial {
9
+ constructor(parameters: MeshPhongMaterialParameters);
10
+ }
@@ -1,14 +1,12 @@
1
1
  import { BufferGeometry, Group, InstancedMesh, Material, Object3D, Scene } from '../../../src/Three';
2
2
 
3
- export namespace SceneUtils {
4
- function createMeshesFromInstancedMesh(instancedMesh: InstancedMesh): Group;
5
- function createMultiMaterialObject(geometry: BufferGeometry, materials: Material[]): Group;
6
- /**
7
- * @deprecated Use scene.attach( child ) instead.
8
- */
9
- function detach(child: Object3D, parent: Object3D, scene: Scene): void;
10
- /**
11
- * @deprecated Use parent.attach( child ) instead.
12
- */
13
- function attach(child: Object3D, scene: Scene, parent: Object3D): void;
14
- }
3
+ export function createMeshesFromInstancedMesh(instancedMesh: InstancedMesh): Group;
4
+ export function createMultiMaterialObject(geometry: BufferGeometry, materials: Material[]): Group;
5
+ /**
6
+ * @deprecated Use scene.attach( child ) instead.
7
+ */
8
+ export function detach(child: Object3D, parent: Object3D, scene: Scene): void;
9
+ /**
10
+ * @deprecated Use parent.attach( child ) instead.
11
+ */
12
+ export function attach(child: Object3D, scene: Scene, parent: Object3D): void;
three/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for three 0.136
1
+ // Type definitions for three 0.137
2
2
  // Project: https://threejs.org/
3
3
  // Definitions by: Josh Ellis <https://github.com/joshuaellis>
4
4
  // Nathan Bierema <https://github.com/Methuselah96>
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.136.1",
3
+ "version": "0.137.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -25,6 +25,6 @@
25
25
  },
26
26
  "scripts": {},
27
27
  "dependencies": {},
28
- "typesPublisherContentHash": "501ccce2c9f818a0bd9103eb72d4c6d3c74ec4c8a24f36ad564000541361e254",
28
+ "typesPublisherContentHash": "dad1fe1dce939480949b1f93552d8ca03cab08b655aca66703302855e9fb414d",
29
29
  "typeScriptVersion": "3.8"
30
30
  }
three/src/constants.d.ts CHANGED
@@ -105,6 +105,7 @@ export const LinearToneMapping: ToneMapping;
105
105
  export const ReinhardToneMapping: ToneMapping;
106
106
  export const CineonToneMapping: ToneMapping;
107
107
  export const ACESFilmicToneMapping: ToneMapping;
108
+ export const CustomToneMapping: ToneMapping;
108
109
 
109
110
  // Mapping modes
110
111
  export enum Mapping {}
@@ -147,13 +148,11 @@ export const FloatType: TextureDataType;
147
148
  export const HalfFloatType: TextureDataType;
148
149
  export const UnsignedShort4444Type: TextureDataType;
149
150
  export const UnsignedShort5551Type: TextureDataType;
150
- export const UnsignedShort565Type: TextureDataType;
151
151
  export const UnsignedInt248Type: TextureDataType;
152
152
 
153
153
  // Pixel formats
154
154
  export enum PixelFormat {}
155
155
  export const AlphaFormat: PixelFormat;
156
- export const RGBFormat: PixelFormat;
157
156
  export const RGBAFormat: PixelFormat;
158
157
  export const LuminanceFormat: PixelFormat;
159
158
  export const LuminanceAlphaFormat: PixelFormat;
@@ -163,8 +162,9 @@ export const RedFormat: PixelFormat;
163
162
  export const RedIntegerFormat: PixelFormat;
164
163
  export const RGFormat: PixelFormat;
165
164
  export const RGIntegerFormat: PixelFormat;
166
- export const RGBIntegerFormat: PixelFormat;
167
165
  export const RGBAIntegerFormat: PixelFormat;
166
+ export const _SRGBFormat: PixelFormat; // fallback for WebGL 1
167
+ export const _SRGBAFormat: PixelFormat; // fallback for WebGL 1
168
168
 
169
169
  // Internal Pixel Formats
170
170
  export type PixelFormatGPU =
@@ -223,6 +223,7 @@ export type PixelFormatGPU =
223
223
  | 'RGB10_A2'
224
224
  | 'RGB10_A2UI'
225
225
  | 'SRGB8_ALPHA8'
226
+ | 'SRGB8'
226
227
  | 'DEPTH_COMPONENT16'
227
228
  | 'DEPTH_COMPONENT24'
228
229
  | 'DEPTH_COMPONENT32F'
@@ -263,20 +264,6 @@ export const RGBA_ASTC_10x8_Format: CompressedPixelFormat;
263
264
  export const RGBA_ASTC_10x10_Format: CompressedPixelFormat;
264
265
  export const RGBA_ASTC_12x10_Format: CompressedPixelFormat;
265
266
  export const RGBA_ASTC_12x12_Format: CompressedPixelFormat;
266
- export const SRGB8_ALPHA8_ASTC_4x4_Format: CompressedPixelFormat;
267
- export const SRGB8_ALPHA8_ASTC_5x4_Format: CompressedPixelFormat;
268
- export const SRGB8_ALPHA8_ASTC_5x5_Format: CompressedPixelFormat;
269
- export const SRGB8_ALPHA8_ASTC_6x5_Format: CompressedPixelFormat;
270
- export const SRGB8_ALPHA8_ASTC_6x6_Format: CompressedPixelFormat;
271
- export const SRGB8_ALPHA8_ASTC_8x5_Format: CompressedPixelFormat;
272
- export const SRGB8_ALPHA8_ASTC_8x6_Format: CompressedPixelFormat;
273
- export const SRGB8_ALPHA8_ASTC_8x8_Format: CompressedPixelFormat;
274
- export const SRGB8_ALPHA8_ASTC_10x5_Format: CompressedPixelFormat;
275
- export const SRGB8_ALPHA8_ASTC_10x6_Format: CompressedPixelFormat;
276
- export const SRGB8_ALPHA8_ASTC_10x8_Format: CompressedPixelFormat;
277
- export const SRGB8_ALPHA8_ASTC_10x10_Format: CompressedPixelFormat;
278
- export const SRGB8_ALPHA8_ASTC_12x10_Format: CompressedPixelFormat;
279
- export const SRGB8_ALPHA8_ASTC_12x12_Format: CompressedPixelFormat;
280
267
 
281
268
  // BPTC compressed texture formats
282
269
  export const RGBA_BPTC_Format: CompressedPixelFormat;
@@ -22,6 +22,7 @@ export interface Intersection<TIntersected extends Object3D = Object3D> {
22
22
  faceIndex?: number | undefined;
23
23
  object: TIntersected;
24
24
  uv?: Vector2 | undefined;
25
+ uv2?: Vector2 | undefined;
25
26
  instanceId?: number | undefined;
26
27
  }
27
28
 
@@ -28,4 +28,6 @@ export namespace ImageUtils {
28
28
  onLoad?: (texture: Texture) => void,
29
29
  onError?: (message: string) => void,
30
30
  ): Texture;
31
+
32
+ function sRGBToLinear(image: any): HTMLCanvasElement | { data: number[]; width: number; height: number };
31
33
  }
@@ -7,8 +7,8 @@ import { Scene } from '../scenes/Scene';
7
7
  export class PMREMGenerator {
8
8
  constructor(renderer: WebGLRenderer);
9
9
  fromScene(scene: Scene, sigma?: number, near?: number, far?: number): WebGLRenderTarget;
10
- fromEquirectangular(equirectangular: Texture): WebGLRenderTarget;
11
- fromCubemap(cubemap: CubeTexture): WebGLRenderTarget;
10
+ fromEquirectangular(equirectangular: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget;
11
+ fromCubemap(cubemap: CubeTexture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget;
12
12
  compileCubemapShader(): void;
13
13
  compileEquirectangularShader(): void;
14
14
  dispose(): void;
@@ -80,6 +80,11 @@ export class Material extends EventDispatcher {
80
80
  */
81
81
  alphaToCoverage: boolean;
82
82
 
83
+ /**
84
+ * @default false
85
+ */
86
+ alphaWrite: boolean;
87
+
83
88
  /**
84
89
  * Blending destination. It's one of the blending mode constants defined in Three.js. Default is {@link OneMinusSrcAlphaFactor}.
85
90
  * @default THREE.OneMinusSrcAlphaFactor
@@ -181,12 +186,6 @@ export class Material extends EventDispatcher {
181
186
  */
182
187
  fog: boolean;
183
188
 
184
- /**
185
- * When this property is set to THREE.RGBFormat, the material is considered to be opaque and alpha values are ignored.
186
- * @default THREE.RGBAFormat
187
- */
188
- format: PixelFormat;
189
-
190
189
  /**
191
190
  * Unique number of this material instance.
192
191
  */
three/src/math/Box3.d.ts CHANGED
@@ -25,7 +25,7 @@ export class Box3 {
25
25
  setFromBufferAttribute(bufferAttribute: BufferAttribute): this;
26
26
  setFromPoints(points: Vector3[]): this;
27
27
  setFromCenterAndSize(center: Vector3, size: Vector3): this;
28
- setFromObject(object: Object3D): this;
28
+ setFromObject(object: Object3D, precise?: boolean): this;
29
29
  clone(): this;
30
30
  copy(box: Box3): this;
31
31
  makeEmpty(): this;
@@ -35,7 +35,7 @@ export class Box3 {
35
35
  expandByPoint(point: Vector3): this;
36
36
  expandByVector(vector: Vector3): this;
37
37
  expandByScalar(scalar: number): this;
38
- expandByObject(object: Object3D): this;
38
+ expandByObject(object: Object3D, precise?: boolean): this;
39
39
  containsPoint(point: Vector3): boolean;
40
40
  containsBox(box: Box3): boolean;
41
41
  getParameter(point: Vector3, target: Vector3): Vector3;
three/src/math/Color.d.ts CHANGED
@@ -7,6 +7,8 @@ export interface HSL {
7
7
  l: number;
8
8
  }
9
9
 
10
+ export function SRGBToLinear(c: number): number;
11
+
10
12
  /**
11
13
  * Represents a color. See also {@link ColorUtils}.
12
14
  *
@@ -1,5 +1,7 @@
1
+ import { CompressedPixelFormat, TextureEncoding } from '../../constants';
2
+
1
3
  export class WebGLUtils {
2
4
  constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, extensions: any, capabilities: any);
3
5
 
4
- convert(p: any): void;
6
+ convert(p: CompressedPixelFormat, encoding?: TextureEncoding | null): void;
5
7
  }
@@ -25,7 +25,7 @@ export class WebXRManager extends EventDispatcher {
25
25
  getSession(): XRSession | null;
26
26
  setSession(value: XRSession): Promise<void>;
27
27
  getCamera(camera: Camera): Camera;
28
- setAnimationLoop(callback: XRFrameRequestCallback): void;
28
+ setAnimationLoop(callback: XRFrameRequestCallback | null): void;
29
29
  getFoveation(): number | undefined;
30
30
  setFoveation(foveation: number): void;
31
31
  dispose(): void;
@@ -9,7 +9,7 @@ export class CubeTexture extends Texture {
9
9
  * @param [wrapT=THREE.ClampToEdgeWrapping]
10
10
  * @param [magFilter=THREE.LinearFilter]
11
11
  * @param [minFilter=THREE.LinearMipmapLinearFilter]
12
- * @param [format=THREE.RGBFormat]
12
+ * @param [format=THREE.RGBAFormat]
13
13
  * @param [type=THREE.UnsignedByteType]
14
14
  * @param [anisotropy=1]
15
15
  * @param [encoding=THREE.LinearEncoding]
@@ -9,7 +9,7 @@ export class VideoTexture extends Texture {
9
9
  * @param [wrapT=THREE.ClampToEdgeWrapping]
10
10
  * @param [magFilter=THREE.LinearFilter]
11
11
  * @param [minFilter=THREE.LinearFilter]
12
- * @param [format=THREE.RGBFormat]
12
+ * @param [format=THREE.RGBAFormat]
13
13
  * @param [type=THREE.UnsignedByteType]
14
14
  * @param [anisotropy=1]
15
15
  */
@@ -1,7 +0,0 @@
1
- import { WebGLRenderer, MeshStandardMaterial } from '../../../src/Three';
2
-
3
- export class RoughnessMipmapper {
4
- constructor(renderer: WebGLRenderer);
5
- generateMipmaps(material: MeshStandardMaterial): void;
6
- dispose(): void;
7
- }