@types/three 0.134.0 → 0.135.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: Mon, 08 Nov 2021 18:01:35 GMT
11
+ * Last updated: Mon, 06 Dec 2021 23:31:03 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `THREE`
14
14
 
@@ -1,4 +1,4 @@
1
- import { Camera, EventDispatcher, Object3D } from '../../../src/Three';
1
+ import { Camera, EventDispatcher, Object3D, Raycaster } from '../../../src/Three';
2
2
 
3
3
  export class DragControls extends EventDispatcher {
4
4
  constructor(objects: Object3D[], camera: Camera, domElement?: HTMLElement);
@@ -14,4 +14,5 @@ export class DragControls extends EventDispatcher {
14
14
  deactivate(): void;
15
15
  dispose(): void;
16
16
  getObjects(): Object3D[];
17
+ getRaycaster(): Raycaster;
17
18
  }
@@ -1,36 +1,61 @@
1
+ import { Camera, Vector3, DirectionalLight, Material, Vector2, Object3D } from '../../../src/Three';
2
+
3
+ export enum CMSMode {
4
+ practical = 'practical',
5
+ uniform = 'uniform',
6
+ logarithmic = 'logarithmic',
7
+ custom = 'custom',
8
+ }
9
+
10
+ export interface CMSParameters {
11
+ camera?: Camera;
12
+ parent?: Object3D;
13
+ cascades?: number;
14
+ maxFar?: number;
15
+ mode?: CMSMode;
16
+ shadowMapSize?: number;
17
+ shadowBias?: number;
18
+ lightDirection?: Vector3;
19
+ lightIntensity?: number;
20
+ lightNear?: number;
21
+ lightFar?: number;
22
+ lightMargin?: number;
23
+ customSplitsCallback?: (cascades: number, cameraNear: number, cameraFar: number, breaks: number[]) => void;
24
+ }
25
+
1
26
  export class CSM {
2
- constructor(data: any);
3
- camera: any;
4
- parent: any;
5
- cascades: any;
6
- maxFar: any;
7
- mode: any;
8
- shadowMapSize: any;
9
- shadowBias: any;
10
- lightDirection: any;
11
- lightIntensity: any;
12
- lightNear: any;
13
- lightFar: any;
14
- lightMargin: any;
15
- customSplitsCallback: any;
27
+ constructor(data?: CMSParameters);
28
+ camera: Camera;
29
+ parent: Object3D;
30
+ cascades: number;
31
+ maxFar: number;
32
+ mode: CMSMode;
33
+ shadowMapSize: number;
34
+ shadowBias: number;
35
+ lightDirection: Vector3;
36
+ lightIntensity: number;
37
+ lightNear: number;
38
+ lightFar: number;
39
+ lightMargin: number;
40
+ customSplitsCallback: (cascades: number, cameraNear: number, cameraFar: number, breaks: number[]) => void;
16
41
  fade: boolean;
17
- mainFrustum: Frustum;
18
- frustums: any[];
19
- breaks: any[];
20
- lights: any[];
21
- shaders: Map<any, any>;
42
+ mainFrustum: CSMFrustrum;
43
+ frustums: CSMFrustrum[];
44
+ breaks: number[];
45
+ lights: DirectionalLight[];
46
+ shaders: Map<unknown, string>;
22
47
  createLights(): void;
23
48
  initCascades(): void;
24
49
  updateShadowBounds(): void;
25
50
  getBreaks(): void;
26
51
  update(): void;
27
52
  injectInclude(): void;
28
- setupMaterial(material: any): void;
53
+ setupMaterial(material: Material): void;
29
54
  updateUniforms(): void;
30
- getExtendedBreaks(target: any): void;
55
+ getExtendedBreaks(target: Vector2[]): void;
31
56
  updateFrustums(): void;
32
57
  remove(): void;
33
58
  dispose(): void;
34
59
  }
35
60
 
36
- import Frustum from './Frustum.js';
61
+ import CSMFrustrum from './CSMFrustum.js';
@@ -0,0 +1,19 @@
1
+ import { Matrix4, Vector3 } from '../../../src/Three';
2
+
3
+ export interface CSMFrustumVerticies {
4
+ near: Vector3[];
5
+ far: Vector3[];
6
+ }
7
+
8
+ export interface CSMFrustumParameters {
9
+ projectionMatrix?: Matrix4;
10
+ maxFar?: number;
11
+ }
12
+
13
+ export default class CSMFrustum {
14
+ constructor(data?: CSMFrustumParameters);
15
+ vertices: CSMFrustumVerticies;
16
+ setFromProjectionMatrix(projectionMatrix: Matrix4, maxFar: number): CSMFrustumVerticies;
17
+ split(breaks: number[], target: CSMFrustum[]): void;
18
+ toSpace(cameraMatrix: Matrix4, target: CSMFrustum): void;
19
+ }
@@ -1,13 +1,26 @@
1
- export class CSMHelper {
2
- constructor(csm: any);
3
- csm: any;
1
+ import {
2
+ Box3Helper,
3
+ BufferGeometry,
4
+ Group,
5
+ LineBasicMaterial,
6
+ LineSegments,
7
+ Mesh,
8
+ MeshBasicMaterial,
9
+ PlaneGeometry,
10
+ } from '../../../src/Three';
11
+
12
+ import { CSM } from './CSM';
13
+
14
+ export class CSMHelper<TCSM extends CSM = CSM> extends Group {
15
+ constructor(csm: TCSM);
16
+ csm: TCSM;
4
17
  displayFrustum: boolean;
5
18
  displayPlanes: boolean;
6
19
  displayShadowBounds: boolean;
7
- frustumLines: any;
8
- cascadeLines: any[];
9
- cascadePlanes: any[];
10
- shadowLines: any[];
20
+ frustumLines: LineSegments<BufferGeometry, LineBasicMaterial>;
21
+ cascadeLines: Box3Helper[];
22
+ cascadePlanes: Array<Mesh<PlaneGeometry, MeshBasicMaterial>>;
23
+ shadowLines: Box3Helper[];
11
24
  updateVisibility(): void;
12
25
  update(): void;
13
26
  }
@@ -0,0 +1,4 @@
1
+ export interface CSMShader {
2
+ lights_fragment_begin: string;
3
+ lights_pars_begin: string;
4
+ }
@@ -16,4 +16,5 @@ export class GLTFExporter {
16
16
  constructor();
17
17
 
18
18
  parse(input: Object3D, onCompleted: (gltf: object) => void, options: GLTFExporterOptions): void;
19
+ parseAsync(input: Object3D, options: GLTFExporterOptions): Promise<void>;
19
20
  }
@@ -64,6 +64,8 @@ export class GLTFLoader extends Loader {
64
64
  onLoad: (gltf: GLTF) => void,
65
65
  onError?: (event: ErrorEvent) => void,
66
66
  ): void;
67
+
68
+ parseAsync(data: ArrayBuffer | string, path: string): Promise<void>;
67
69
  }
68
70
 
69
71
  export type GLTFReferenceType = 'materials' | 'nodes' | 'textures' | 'meshes';
@@ -0,0 +1,19 @@
1
+ import { DataTextureLoader, TextureDataType, LoadingManager, PixelFormat } from '../../../src/Three';
2
+
3
+ export interface LogLuv {
4
+ width: number;
5
+ height: number;
6
+ data: Uint16Array | Float32Array;
7
+ format: PixelFormat;
8
+ type: TextureDataType;
9
+ flipY: boolean;
10
+ }
11
+
12
+ export class LogLuvLoader extends DataTextureLoader {
13
+ type: TextureDataType;
14
+ constructor(manager: LoadingManager);
15
+
16
+ parse(buffer: Iterable<number>): LogLuv;
17
+
18
+ setDataType(value: TextureDataType): this;
19
+ }
@@ -53,11 +53,11 @@ export class OculusHandPointerModel extends Object3D {
53
53
 
54
54
  public isAttached(): boolean;
55
55
 
56
- public intersectObject(object: Object3D): Intersection[] | void;
56
+ public intersectObject(object: Object3D, recursive?: boolean): Intersection[] | void;
57
57
 
58
- public intersectObjects(objects: Object3D[]): Intersection[] | void;
58
+ public intersectObjects(objects: Object3D[], recursive?: boolean): Intersection[] | void;
59
59
 
60
- public checkIntersections(objects: Object3D[]): void;
60
+ public checkIntersections(objects: Object3D[], recursive?: boolean): void;
61
61
 
62
62
  public setCursor(distance: number): void;
63
63
  }
three/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for three 0.134
1
+ // Type definitions for three 0.135
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.134.0",
3
+ "version": "0.135.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": "081e8a2aa20cac9bb8a5fc1c65f63e7f502175cd0654faf460174999473bd0ac",
29
- "typeScriptVersion": "3.7"
28
+ "typesPublisherContentHash": "d0154c4f95513cc2c40c0bf65e56ad0b1bd41ffca75f306c6e9bf6c0c8e6dd84",
29
+ "typeScriptVersion": "3.8"
30
30
  }
@@ -18,7 +18,7 @@ export class OrthographicCamera extends Camera {
18
18
  * @param [near=0.1] Camera frustum near plane.
19
19
  * @param [far=2000] Camera frustum far plane.
20
20
  */
21
- constructor(left: number, right: number, top: number, bottom: number, near?: number, far?: number);
21
+ constructor(left?: number, right?: number, top?: number, bottom?: number, near?: number, far?: number);
22
22
 
23
23
  type: 'OrthographicCamera';
24
24
 
@@ -13,4 +13,5 @@ export class Layers {
13
13
  disable(channel: number): void;
14
14
  disableAll(): void;
15
15
  test(layers: Layers): boolean;
16
+ isEnabled(channel: number): boolean;
16
17
  }
@@ -119,6 +119,7 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
119
119
  * @default new THREE.Layers()
120
120
  */
121
121
  layers: Layers;
122
+
122
123
  /**
123
124
  * Object gets rendered if true.
124
125
  * @default true
@@ -211,18 +212,41 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
211
212
  static DefaultMatrixAutoUpdate: boolean;
212
213
 
213
214
  /**
214
- * This updates the position, rotation and scale with the matrix.
215
+ * Applies the matrix transform to the object and updates the object's position, rotation and scale.
215
216
  */
216
217
  applyMatrix4(matrix: Matrix4): void;
217
218
 
219
+ /**
220
+ * Applies the rotation represented by the quaternion to the object.
221
+ */
218
222
  applyQuaternion(quaternion: Quaternion): this;
219
223
 
224
+ /**
225
+ * axis -- A normalized vector in object space.
226
+ * angle -- angle in radians
227
+ * @param axis A normalized vector in object space.
228
+ * @param angle angle in radians
229
+ */
220
230
  setRotationFromAxisAngle(axis: Vector3, angle: number): void;
221
231
 
232
+ /**
233
+ * Calls setRotationFromEuler(euler) on the .quaternion.
234
+ * @param euler Euler angle specifying rotation amount.
235
+ */
222
236
  setRotationFromEuler(euler: Euler): void;
223
237
 
238
+ /**
239
+ * Calls setFromRotationMatrix(m) on the .quaternion.
240
+ *
241
+ * Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
242
+ * @param m rotate the quaternion by the rotation component of the matrix.
243
+ */
224
244
  setRotationFromMatrix(m: Matrix4): void;
225
245
 
246
+ /**
247
+ * Copy the given quaternion into .quaternion.
248
+ * @param q normalized Quaternion
249
+ */
226
250
  setRotationFromQuaternion(q: Quaternion): void;
227
251
 
228
252
  /**
@@ -240,24 +264,25 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
240
264
  rotateOnWorldAxis(axis: Vector3, angle: number): this;
241
265
 
242
266
  /**
243
- *
244
- * @param angle
267
+ * Rotates the object around x axis in local space.
268
+ * @param angle the angle to rotate in radians.
245
269
  */
246
270
  rotateX(angle: number): this;
247
271
 
248
272
  /**
249
- *
250
- * @param angle
273
+ * Rotates the object around y axis in local space.
274
+ * @param angle the angle to rotate in radians.
251
275
  */
252
276
  rotateY(angle: number): this;
253
277
 
254
278
  /**
255
- *
256
- * @param angle
279
+ * Rotates the object around z axis in local space.
280
+ * @param angle the angle to rotate in radians.
257
281
  */
258
282
  rotateZ(angle: number): this;
259
283
 
260
284
  /**
285
+ * Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
261
286
  * @param axis A normalized vector in object space.
262
287
  * @param distance The distance to translate.
263
288
  */
@@ -294,7 +319,9 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
294
319
  worldToLocal(vector: Vector3): Vector3;
295
320
 
296
321
  /**
297
- * Rotates object to face point in space.
322
+ * Optionally, the x, y and z components of the world space position.
323
+ * Rotates the object to face a point in world space.
324
+ * This method does not support objects having non-uniformly-scaled parent(s).
298
325
  * @param vector A world vector to look at.
299
326
  */
300
327
  lookAt(vector: Vector3 | number, y?: number, z?: number): void;
@@ -361,6 +388,11 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
361
388
  */
362
389
  updateMatrixWorld(force?: boolean): void;
363
390
 
391
+ /**
392
+ * Updates the global transform of the object.
393
+ * @param updateParents recursively updates global transform of ancestors.
394
+ * @param updateChildren recursively updates global transform of descendants.
395
+ */
364
396
  updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void;
365
397
 
366
398
  toJSON(meta?: { geometries: any; materials: any; textures: any; images: any }): any;
@@ -1,16 +0,0 @@
1
- export default class Frustum {
2
- constructor(data: any);
3
- vertices: {
4
- near: any[];
5
- far: any[];
6
- };
7
- setFromProjectionMatrix(
8
- projectionMatrix: any,
9
- maxFar: any,
10
- ): {
11
- near: any[];
12
- far: any[];
13
- };
14
- split(breaks: any, target: any): void;
15
- toSpace(cameraMatrix: any, target: any): void;
16
- }
@@ -1,6 +0,0 @@
1
- declare namespace _default {
2
- const lights_fragment_begin: string;
3
- const lights_pars_begin: string;
4
- }
5
-
6
- export default _default;