@types/three 0.151.0 → 0.152.1

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.
Files changed (34) hide show
  1. three/README.md +2 -2
  2. three/build/three.min.d.ts +2 -0
  3. three/build/three.module.min.d.ts +2 -0
  4. three/examples/jsm/libs/tween.module.d.ts +2 -0
  5. three/examples/jsm/loaders/IFCLoader.d.ts +66 -66
  6. three/examples/jsm/nodes/Nodes.d.ts +3 -2
  7. three/examples/jsm/nodes/core/NodeBuilder.d.ts +0 -8
  8. three/examples/jsm/nodes/core/constants.d.ts +1 -0
  9. three/examples/jsm/nodes/lighting/LightUtils.d.ts +4 -0
  10. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +0 -7
  11. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +0 -9
  12. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -9
  13. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +17 -1
  14. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -2
  15. three/examples/jsm/renderers/CSS3DRenderer.d.ts +2 -2
  16. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +0 -19
  17. three/examples/jsm/utils/SkeletonUtils.d.ts +3 -19
  18. three/index.d.ts +1 -1
  19. three/package.json +3 -2
  20. three/src/constants.d.ts +3 -23
  21. three/src/core/BufferAttribute.d.ts +1 -1
  22. three/src/core/BufferGeometry.d.ts +60 -33
  23. three/src/core/Raycaster.d.ts +1 -1
  24. three/src/loaders/Loader.d.ts +1 -1
  25. three/src/materials/ShaderMaterial.d.ts +1 -1
  26. three/src/objects/Points.d.ts +7 -6
  27. three/src/renderers/WebGLRenderTarget.d.ts +3 -0
  28. three/src/renderers/WebGLRenderer.d.ts +9 -1
  29. three/src/textures/CanvasTexture.d.ts +0 -1
  30. three/src/textures/CompressedTexture.d.ts +3 -2
  31. three/src/textures/CubeTexture.d.ts +3 -4
  32. three/src/textures/DataTexture.d.ts +3 -3
  33. three/src/textures/Texture.d.ts +33 -3
  34. three/examples/jsm/nodes/functions/light/getDistanceAttenuation.d.ts +0 -5
three/README.md CHANGED
@@ -8,8 +8,8 @@ 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: Fri, 28 Apr 2023 20:02:51 GMT
12
- * Dependencies: [@types/fflate](https://npmjs.com/package/@types/fflate), [@types/lil-gui](https://npmjs.com/package/@types/lil-gui), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr)
11
+ * Last updated: Thu, 25 May 2023 20:34:45 GMT
12
+ * Dependencies: [@types/fflate](https://npmjs.com/package/@types/fflate), [@types/lil-gui](https://npmjs.com/package/@types/lil-gui), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/tweenjs__tween.js](https://npmjs.com/package/@types/tweenjs__tween.js), [@types/webxr](https://npmjs.com/package/@types/webxr)
13
13
  * Global values: `THREE`
14
14
 
15
15
  # Credits
@@ -0,0 +1,2 @@
1
+ export * from '../src/Three';
2
+ export as namespace THREE;
@@ -0,0 +1,2 @@
1
+ export * from '../src/Three';
2
+ export as namespace THREE;
@@ -0,0 +1,2 @@
1
+ export * from '@tweenjs/tween.js';
2
+ export { default } from '@tweenjs/tween.js';
@@ -56,7 +56,7 @@ export class IFCManager {
56
56
  * Example if web-ifc.wasm is in dist/wasmDir:
57
57
  * `ifcLoader.setWasmPath("dist/wasmDir/");`
58
58
  *
59
- * @path Relative path to web-ifc.wasm.
59
+ * @param path Relative path to web-ifc.wasm.
60
60
  */
61
61
  setWasmPath(path: string): void;
62
62
 
@@ -75,8 +75,8 @@ export class IFCManager {
75
75
 
76
76
  /**
77
77
  * Adds the properties of a model as JSON data.
78
- * @modelID ID of the IFC model.
79
- * @data: data as an object where the keys are the expressIDs and the values the properties.
78
+ * @param modelID ID of the IFC model.
79
+ * @param data data as an object where the keys are the expressIDs and the values the properties.
80
80
  */
81
81
  addModelJSONData(
82
82
  modelID: number,
@@ -102,16 +102,16 @@ export class IFCManager {
102
102
 
103
103
  /**
104
104
  * Closes the specified model and deletes it from the [scene](https://threejs.org/docs/#api/en/scenes/Scene).
105
- * @modelID ID of the IFC model.
106
- * @scene Scene where the model is (if it's located in a scene).
105
+ * @param modelID ID of the IFC model.
106
+ * @param scene Scene where the model is (if it's located in a scene).
107
107
  */
108
108
  close(modelID: number, scene?: Scene): void;
109
109
 
110
110
  /**
111
111
  * Gets the **Express ID** to which the given face belongs.
112
112
  * This ID uniquely identifies this entity within this IFC file.
113
- * @geometry The geometry of the IFC model.
114
- * @faceIndex The index of the face of a geometry.You can easily get this index using the [Raycaster](https://threejs.org/docs/#api/en/core/Raycaster).
113
+ * @param geometry The geometry of the IFC model.
114
+ * @param faceIndex The index of the face of a geometry.You can easily get this index using the [Raycaster](https://threejs.org/docs/#api/en/core/Raycaster).
115
115
  */
116
116
  getExpressId(geometry: BufferGeometry, faceIndex: number): number | undefined;
117
117
 
@@ -124,26 +124,26 @@ export class IFCManager {
124
124
  * import { IFCWALLSTANDARDCASE } from 'web-ifc';
125
125
  * const walls = ifcLoader.getAllItemsOfType(IFCWALLSTANDARDCASE);
126
126
  * ```
127
- * @modelID ID of the IFC model.
128
- * @ifcType type of IFC items to get.
129
- * @verbose If false (default), this only gets IDs. If true, this also gets the native properties of all the fetched items.
127
+ * @param modelID ID of the IFC model.
128
+ * @param ifcType type of IFC items to get.
129
+ * @param verbose If false (default), this only gets IDs. If true, this also gets the native properties of all the fetched items.
130
130
  */
131
131
  getAllItemsOfType(modelID: number, type: number, verbose: boolean): any[];
132
132
 
133
133
  /**
134
134
  * Gets the native properties of the given element.
135
- * @modelID ID of the IFC model.
136
- * @id Express ID of the element.
137
- * @recursive Wether you want to get the information of the referenced elements recursively.
135
+ * @param modelID ID of the IFC model.
136
+ * @param id Express ID of the element.
137
+ * @param recursive Wether you want to get the information of the referenced elements recursively.
138
138
  */
139
139
  getItemProperties(modelID: number, id: number, recursive?: boolean): any;
140
140
 
141
141
  /**
142
142
  * Gets the [property sets](https://standards.buildingsmart.org/IFC/DEV/IFC4_2/FINAL/HTML/schema/ifckernel/lexical/ifcpropertyset.htm)
143
143
  * assigned to the given element.
144
- * @modelID ID of the IFC model.
145
- * @id Express ID of the element.
146
- * @recursive If true, this gets the native properties of the referenced elements recursively.
144
+ * @param modelID ID of the IFC model.
145
+ * @param id Express ID of the element.
146
+ * @param recursive If true, this gets the native properties of the referenced elements recursively.
147
147
  */
148
148
  getPropertySets(modelID: number, id: number, recursive?: boolean): any[];
149
149
 
@@ -151,24 +151,24 @@ export class IFCManager {
151
151
  * Gets the properties of the type assigned to the element.
152
152
  * For example, if applied to a wall (IfcWall), this would get back the information
153
153
  * contained in the IfcWallType assigned to it, if any.
154
- * @modelID ID of the IFC model.
155
- * @id Express ID of the element.
156
- * @recursive If true, this gets the native properties of the referenced elements recursively.
154
+ * @param modelID ID of the IFC model.
155
+ * @param id Express ID of the element.
156
+ * @param recursive If true, this gets the native properties of the referenced elements recursively.
157
157
  */
158
158
  getTypeProperties(modelID: number, id: number, recursive?: boolean): any[];
159
159
 
160
160
  /**
161
161
  * Gets the materials assigned to the given element.
162
- * @modelID ID of the IFC model.
163
- * @id Express ID of the element.
164
- * @recursive If true, this gets the native properties of the referenced elements recursively.
162
+ * @param modelID ID of the IFC model.
163
+ * @param id Express ID of the element.
164
+ * @param recursive If true, this gets the native properties of the referenced elements recursively.
165
165
  */
166
166
  getMaterialsProperties(modelID: number, id: number, recursive?: boolean): any[];
167
167
 
168
168
  /**
169
169
  * Gets the ifc type of the specified item.
170
- * @modelID ID of the IFC model.
171
- * @id Express ID of the element.
170
+ * @param modelID ID of the IFC model.
171
+ * @param id Express ID of the element.
172
172
  */
173
173
  getIfcType(modelID: number, id: number): string;
174
174
 
@@ -180,7 +180,7 @@ export class IFCManager {
180
180
  * one IfcProject that contains one or more IfcSites, that contain one or more
181
181
  * IfcBuildings, that contain one or more IfcBuildingStoreys, that contain
182
182
  * one or more IfcSpaces.
183
- * @modelID ID of the IFC model.
183
+ * @param modelID ID of the IFC model.
184
184
  */
185
185
  getSpatialStructure(modelID: number): {
186
186
  expressID: number;
@@ -191,22 +191,22 @@ export class IFCManager {
191
191
  /**
192
192
  * Gets the mesh of the subset with the specified [material](https://threejs.org/docs/#api/en/materials/Material).
193
193
  * If no material is given, this returns the subset with the original materials.
194
- * @modelID ID of the IFC model.
195
- * @material Material assigned to the subset (if any).
194
+ * @param modelID ID of the IFC model.
195
+ * @param material Material assigned to the subset (if any).
196
196
  */
197
197
  getSubset(modelID: number, material?: Material): Mesh | null;
198
198
 
199
199
  /**
200
200
  * Removes the specified subset.
201
- * @modelID ID of the IFC model.
201
+ * @param modelID ID of the IFC model.
202
202
  * @parent The parent where the subset is (can be any `THREE.Object3D`).
203
- * @material Material assigned to the subset, if any.
203
+ * @param material Material assigned to the subset, if any.
204
204
  */
205
205
  removeSubset(modelID: number, parent?: Object3D, material?: Material): void;
206
206
 
207
207
  /**
208
208
  * Creates a new geometric subset.
209
- * @config A configuration object with the following options:
209
+ * @param config A configuration object with the following options:
210
210
  * - **scene**: `THREE.Object3D` where the model is located.
211
211
  * - **modelID**: ID of the model.
212
212
  * - **ids**: Express IDs of the items of the model that will conform the subset.
@@ -217,36 +217,36 @@ export class IFCManager {
217
217
 
218
218
  /**
219
219
  * Hides the selected items in the specified model
220
- * @modelID ID of the IFC model.
221
- * @ids Express ID of the elements.
220
+ * @param modelID ID of the IFC model.
221
+ * @param ids Express ID of the elements.
222
222
  */
223
223
  hideItems(modelID: number, ids: number[]): void;
224
224
 
225
225
  /**
226
226
  * Hides all the items of the specified model
227
- * @modelID ID of the IFC model.
227
+ * @param modelID ID of the IFC model.
228
228
  */
229
229
  hideAllItems(modelID: number): void;
230
230
 
231
231
  /**
232
232
  * Shows all the items of the specified model
233
- * @modelID ID of the IFC model.
234
- * @ids Express ID of the elements.
233
+ * @param modelID ID of the IFC model.
234
+ * @param ids Express ID of the elements.
235
235
  */
236
236
  showItems(modelID: number, ids: number[]): void;
237
237
 
238
238
  /**
239
239
  * Shows all the items of the specified model
240
- * @modelID ID of the IFC model.
240
+ * @param modelID ID of the IFC model.
241
241
  */
242
242
  showAllItems(modelID: number): void;
243
243
  }
244
244
 
245
245
  /**
246
246
  * Represents an IFC model. This object is returned by the `IFCLoader` after loading an IFC.
247
- * @geometry `THREE.Buffergeometry`, see Three.js documentation.
248
- * @materials `THREE.Material[]`, see Three.js documentation.
249
- * @manager contains all the logic to work with IFC.
247
+ * @param geometry `THREE.Buffergeometry`, see Three.js documentation.
248
+ * @param materials `THREE.Material[]`, see Three.js documentation.
249
+ * @param manager contains all the logic to work with IFC.
250
250
  */
251
251
  export class IFCModel extends Mesh {
252
252
  modelID: number;
@@ -272,7 +272,7 @@ export class IFCModel extends Mesh {
272
272
  * Example if web-ifc.wasm is in dist/wasmDir:
273
273
  * `ifcLoader.setWasmPath("dist/wasmDir/");`
274
274
  *
275
- * @path Relative path to web-ifc.wasm.
275
+ * @param path Relative path to web-ifc.wasm.
276
276
  */
277
277
  setWasmPath(path: string): void;
278
278
 
@@ -280,7 +280,7 @@ export class IFCModel extends Mesh {
280
280
  * @deprecated Use `IfcModel.ifcManager.close` instead.
281
281
  *
282
282
  * Closes the specified model and deletes it from the [scene](https://threejs.org/docs/#api/en/scenes/Scene).
283
- * @scene Scene where the model is (if it's located in a scene).
283
+ * @param scene Scene where the model is (if it's located in a scene).
284
284
  */
285
285
  close(scene?: Scene): void;
286
286
 
@@ -289,8 +289,8 @@ export class IFCModel extends Mesh {
289
289
  *
290
290
  * Gets the **Express ID** to which the given face belongs.
291
291
  * This ID uniquely identifies this entity within this IFC file.
292
- * @geometry The geometry of the IFC model.
293
- * @faceIndex The index of the face of a geometry.You can easily get this index using the [Raycaster](https://threejs.org/docs/#api/en/core/Raycaster).
292
+ * @param geometry The geometry of the IFC model.
293
+ * @param faceIndex The index of the face of a geometry.You can easily get this index using the [Raycaster](https://threejs.org/docs/#api/en/core/Raycaster).
294
294
  */
295
295
  getExpressId(geometry: BufferGeometry, faceIndex: number): number | undefined;
296
296
 
@@ -305,8 +305,8 @@ export class IFCModel extends Mesh {
305
305
  * import { IFCWALLSTANDARDCASE } from 'web-ifc';
306
306
  * const walls = ifcLoader.getAllItemsOfType(IFCWALLSTANDARDCASE);
307
307
  * ```
308
- * @ifcType The type of IFC items to get.
309
- * @verbose If false (default), this only gets IDs. If true, this also gets the native properties of all the fetched items.
308
+ * @param ifcType The type of IFC items to get.
309
+ * @param verbose If false (default), this only gets IDs. If true, this also gets the native properties of all the fetched items.
310
310
  */
311
311
  getAllItemsOfType(type: number, verbose: boolean): any[];
312
312
 
@@ -314,8 +314,8 @@ export class IFCModel extends Mesh {
314
314
  * @deprecated Use `IfcModel.ifcManager.getItemProperties` instead.
315
315
  *
316
316
  * Gets the native properties of the given element.
317
- * @id Express ID of the element.
318
- * @recursive Wether you want to get the information of the referenced elements recursively.
317
+ * @param id Express ID of the element.
318
+ * @param recursive Wether you want to get the information of the referenced elements recursively.
319
319
  */
320
320
  getItemProperties(id: number, recursive?: boolean): any;
321
321
 
@@ -324,8 +324,8 @@ export class IFCModel extends Mesh {
324
324
  *
325
325
  * Gets the [property sets](https://standards.buildingsmart.org/IFC/DEV/IFC4_2/FINAL/HTML/schema/ifckernel/lexical/ifcpropertyset.htm)
326
326
  * assigned to the given element.
327
- * @id Express ID of the element.
328
- * @recursive If true, this gets the native properties of the referenced elements recursively.
327
+ * @param id Express ID of the element.
328
+ * @param recursive If true, this gets the native properties of the referenced elements recursively.
329
329
  */
330
330
  getPropertySets(id: number, recursive?: boolean): any[];
331
331
 
@@ -335,8 +335,8 @@ export class IFCModel extends Mesh {
335
335
  * Gets the properties of the type assigned to the element.
336
336
  * For example, if applied to a wall (IfcWall), this would get back the information
337
337
  * contained in the IfcWallType assigned to it, if any.
338
- * @id Express ID of the element.
339
- * @recursive If true, this gets the native properties of the referenced elements recursively.
338
+ * @param id Express ID of the element.
339
+ * @param recursive If true, this gets the native properties of the referenced elements recursively.
340
340
  */
341
341
  getTypeProperties(id: number, recursive?: boolean): any[];
342
342
 
@@ -344,7 +344,7 @@ export class IFCModel extends Mesh {
344
344
  * @deprecated Use `IfcModel.ifcManager.getIfcType` instead.
345
345
  *
346
346
  * Gets the ifc type of the specified item.
347
- * @id Express ID of the element.
347
+ * @param id Express ID of the element.
348
348
  */
349
349
  getIfcType(id: number): string;
350
350
 
@@ -370,7 +370,7 @@ export class IFCModel extends Mesh {
370
370
  *
371
371
  * Gets the mesh of the subset with the specified [material](https://threejs.org/docs/#api/en/materials/Material).
372
372
  * If no material is given, this returns the subset with the original materials.
373
- * @material Material assigned to the subset, if any.
373
+ * @param material Material assigned to the subset, if any.
374
374
  */
375
375
  getSubset(material?: Material): Mesh | null;
376
376
 
@@ -379,7 +379,7 @@ export class IFCModel extends Mesh {
379
379
  *
380
380
  * Removes the specified subset.
381
381
  * @parent The parent where the subset is (can be any `THREE.Object3D`).
382
- * @material Material assigned to the subset, if any.
382
+ * @param material Material assigned to the subset, if any.
383
383
  */
384
384
  removeSubset(parent?: Object3D, material?: Material): void;
385
385
 
@@ -387,7 +387,7 @@ export class IFCModel extends Mesh {
387
387
  * @deprecated Use `IfcModel.ifcManager.createSubset` instead.
388
388
  *
389
389
  * Creates a new geometric subset.
390
- * @config A configuration object with the following options:
390
+ * @param config A configuration object with the following options:
391
391
  * - **scene**: `THREE.Object3D` where the model is located.
392
392
  * - **ids**: Express IDs of the items of the model that will conform the subset.
393
393
  * - **removePrevious**: Wether to remove the previous subset of this model with this material.
@@ -399,7 +399,7 @@ export class IFCModel extends Mesh {
399
399
  * @deprecated Use `IfcModel.ifcManager.hideItems` instead.
400
400
  *
401
401
  * Hides the selected items in the specified model
402
- * @ids Express ID of the elements.
402
+ * @param ids Express ID of the elements.
403
403
  */
404
404
  hideItems(ids: number[]): void;
405
405
 
@@ -414,7 +414,7 @@ export class IFCModel extends Mesh {
414
414
  * @deprecated Use `IfcModel.ifcManager.showItems` instead.
415
415
  *
416
416
  * Hides all the items of the specified model
417
- * @ids Express ID of the elements.
417
+ * @param ids Express ID of the elements.
418
418
  */
419
419
  showItems(ids: number[]): void;
420
420
 
@@ -601,14 +601,14 @@ export class IfcAPI {
601
601
 
602
602
  /**
603
603
  * Opens a model and returns a modelID number
604
- * @data Buffer containing IFC data (bytes)
605
- * @data Settings settings for loading the model
604
+ * @param data Buffer containing IFC data (bytes)
605
+ * @param settings Settings settings for loading the model
606
606
  */
607
607
  OpenModel(data: string | Uint8Array, settings?: LoaderSettings): number;
608
608
 
609
609
  /**
610
610
  * Creates a new model and returns a modelID number
611
- * @data Settings settings for generating data the model
611
+ * @param settings Settings settings for generating data the model
612
612
  */
613
613
  CreateModel(settings?: LoaderSettings): number;
614
614
 
@@ -616,8 +616,8 @@ export class IfcAPI {
616
616
 
617
617
  /**
618
618
  * Opens a model and returns a modelID number
619
- * @modelID Model handle retrieved by OpenModel, model must not be closed
620
- * @data Buffer containing IFC data (bytes)
619
+ * @param modelID Model handle retrieved by OpenModel, model must not be closed
620
+ * @param data Buffer containing IFC data (bytes)
621
621
  */
622
622
  GetGeometry(modelID: number, geometryExpressID: number): IfcGeometry;
623
623
 
@@ -645,7 +645,7 @@ export class IfcAPI {
645
645
 
646
646
  /**
647
647
  * Closes a model and frees all related memory
648
- * @modelID Model handle retrieved by OpenModel, model must not be closed
648
+ * @param modelID Model handle retrieved by OpenModel, model must not be closed
649
649
  */
650
650
  CloseModel(modelID: number): void;
651
651
 
@@ -653,19 +653,19 @@ export class IfcAPI {
653
653
 
654
654
  /**
655
655
  * Checks if a specific model ID is open or closed
656
- * @modelID Model handle retrieved by OpenModel
656
+ * @param modelID Model handle retrieved by OpenModel
657
657
  */
658
658
  IsModelOpen(modelID: number): boolean;
659
659
 
660
660
  /**
661
661
  * Load all geometry in a model
662
- * @modelID Model handle retrieved by OpenModel
662
+ * @param modelID Model handle retrieved by OpenModel
663
663
  */
664
664
  LoadAllGeometry(modelID: number): Vector<FlatMesh>;
665
665
 
666
666
  /**
667
667
  * Load geometry for a single element
668
- * @modelID Model handle retrieved by OpenModel
668
+ * @param modelID Model handle retrieved by OpenModel
669
669
  */
670
670
  GetFlatMesh(modelID: number, expressID: number): FlatMesh;
671
671
 
@@ -27,7 +27,8 @@ export { default as UniformNode } from './core/UniformNode';
27
27
  export { default as VarNode } from './core/VarNode';
28
28
  export { default as VaryingNode } from './core/VaryingNode';
29
29
 
30
- export * as NodeUtils from './core/NodeUtils.js';
30
+ import * as NodeUtils from './core/NodeUtils.js';
31
+ export { NodeUtils };
31
32
 
32
33
  // math
33
34
  export {
@@ -141,7 +142,7 @@ export { default as DFGApprox } from './functions/BSDF/DFGApprox';
141
142
  export { default as F_Schlick } from './functions/BSDF/F_Schlick';
142
143
  export { default as V_GGX_SmithCorrelated } from './functions/BSDF/V_GGX_SmithCorrelated';
143
144
 
144
- export { default as getDistanceAttenuation } from './functions/light/getDistanceAttenuation';
145
+ export { getDistanceAttenuation } from './lighting/LightUtils';
145
146
 
146
147
  export { default as getGeometryRoughness } from './functions/material/getGeometryRoughness';
147
148
  export { default as getRoughness } from './functions/material/getRoughness';
@@ -45,7 +45,6 @@ export default abstract class NodeBuilder {
45
45
  updateNodes: Node[];
46
46
  hashNodes: { [hash: string]: Node };
47
47
 
48
- scene: Scene;
49
48
  lightsNode: LightsNode;
50
49
  fogNode: FogNode;
51
50
 
@@ -85,13 +84,6 @@ export default abstract class NodeBuilder {
85
84
 
86
85
  isFlipY(): boolean;
87
86
 
88
- abstract getTexture(textureProperty: string, uvSnippet: string): string;
89
-
90
- abstract getTextureLevel(textureProperty: string, uvSnippet: string, levelSnippet: string): string;
91
-
92
- abstract getCubeTexture(textureProperty: string, uvSnippet: string): string;
93
- abstract getCubeTextureLevel(textureProperty: string, uvSnippet: string, levelSnippet: string): string;
94
-
95
87
  // @TODO: rename to .generateConst()
96
88
  getConst(type: NodeTypeOption, value?: unknown): Node;
97
89
  getType(type: NodeTypeOption): NodeTypeOption;
@@ -9,6 +9,7 @@ export const NodeShaderStage: {
9
9
  export const NodeUpdateType: {
10
10
  NONE: 'none';
11
11
  FRAME: 'frame';
12
+ RENDER: 'render';
12
13
  OBJECT: 'object';
13
14
  };
14
15
 
@@ -0,0 +1,4 @@
1
+ import { ShaderNode } from '../shadernode/ShaderNode';
2
+ import Node from '../core/Node';
3
+
4
+ export const getDistanceAttenuation: ShaderNode<{ lightDistance: Node; cutoffDistance: Node; decayExponent: Node }>;
@@ -1,16 +1,9 @@
1
1
  import NodeMaterial from './NodeMaterial';
2
2
  import { ShaderMaterialParameters } from '../../../../src/Three';
3
- import { Node } from '../Nodes';
4
3
 
5
4
  export default class LineBasicNodeMaterial extends NodeMaterial {
6
5
  isLineBasicNodeMaterial: true;
7
6
 
8
- colorNode: Node | null;
9
- opacityNode: Node | null;
10
- alphaTestNode: Node | null;
11
- lightNode: Node | null;
12
- positionNode: Node | null;
13
-
14
7
  constructor(parameters?: ShaderMaterialParameters);
15
8
  copy(source: LineBasicNodeMaterial): this;
16
9
  }
@@ -1,19 +1,10 @@
1
1
  import NodeMaterial from './NodeMaterial';
2
- import Node from '../core/Node';
3
2
  import { ShaderMaterialParameters } from '../../../../src/Three';
4
3
 
5
4
  export default class MeshBasicNodeMaterial extends NodeMaterial {
6
5
  isMeshBasicNodeMaterial: true;
7
6
  lights: true;
8
7
 
9
- colorNode: Node | null;
10
- opacityNode: Node | null;
11
-
12
- alphaTestNode: Node | null;
13
- lightNode: Node | null;
14
-
15
- positionNode: Node | null;
16
-
17
8
  constructor(paramters?: ShaderMaterialParameters);
18
9
  copy(source: MeshBasicNodeMaterial): this;
19
10
  }
@@ -5,10 +5,6 @@ import NodeMaterial from './NodeMaterial';
5
5
  export default class MeshStandardNodeMaterial extends NodeMaterial {
6
6
  isMeshStandardNodeMaterial: true;
7
7
 
8
- colorNode: Node | null;
9
- opacityNode: Node | null;
10
- alphaTestNode: Node | null;
11
- normalNode: Node | null;
12
8
  emissiveNode: Node | null;
13
9
 
14
10
  metalnessNode: Node | null;
@@ -17,11 +13,6 @@ export default class MeshStandardNodeMaterial extends NodeMaterial {
17
13
  clearcoatNode: Node | null;
18
14
  clearcoatRoughnessNode: Node | null;
19
15
 
20
- envNode: Node | null;
21
-
22
- lightsNode: Node | null;
23
- positionNode: Node | null;
24
-
25
16
  constructor(paramters?: ShaderMaterialParameters);
26
17
  copy(source: MeshStandardNodeMaterial): this;
27
18
  }
@@ -5,8 +5,24 @@ import { LightingModelNode } from '../lighting/LightingContextNode';
5
5
 
6
6
  export default class NodeMaterial extends ShaderMaterial {
7
7
  isNodeMaterial: true;
8
- lights: true;
8
+
9
9
  type: string;
10
+
11
+ lights: true;
12
+ normals: true;
13
+
14
+ lightsNode: Node | null;
15
+ envNode: Node | null;
16
+
17
+ colorNode: Node | null;
18
+ normalNode: Node | null;
19
+ opacityNode: Node | null;
20
+ backdropNode: Node | null;
21
+ backdropAlphaNode: Node | null;
22
+ alphaTestNode: Node | null;
23
+
24
+ positionNode: Node | null;
25
+
10
26
  constructor();
11
27
 
12
28
  build(builder: NodeBuilder): void;
@@ -56,8 +56,6 @@ export { default as DFGApprox } from '../functions/BSDF/DFGApprox';
56
56
  export { default as F_Schlick } from '../functions/BSDF/F_Schlick';
57
57
  export { default as V_GGX_SmithCorrelated } from '../functions/BSDF/V_GGX_SmithCorrelated';
58
58
 
59
- export { default as getDistanceAttenuation } from '../functions/light/getDistanceAttenuation';
60
-
61
59
  export { default as getGeometryRoughness } from '../functions/material/getGeometryRoughness';
62
60
  export { default as getRoughness } from '../functions/material/getRoughness';
63
61
 
@@ -12,9 +12,9 @@ export class CSS3DSprite extends CSS3DObject {
12
12
  constructor(element: HTMLElement);
13
13
  }
14
14
 
15
- export type CSS3DParameters = {
15
+ export interface CSS3DParameters {
16
16
  element?: HTMLElement;
17
- };
17
+ }
18
18
 
19
19
  export class CSS3DRenderer {
20
20
  constructor(parameters?: CSS3DParameters);
@@ -13,25 +13,6 @@ export class WebGLNodeBuilder extends NodeBuilder {
13
13
 
14
14
  addSlot(shaderStage: NodeShaderStageOption, slotNode: SlotNode): Node;
15
15
 
16
- getTexture(textureProperty: string, uvSnippet: string): string;
17
- getTextureBias(textureProperty: string, uvSnippet: string, biasSnippet: string): string;
18
-
19
- getTextureLevel(
20
- textureProperty: string,
21
- uvSnippet: string,
22
- biasSnippet: string,
23
- shaderStage?: NodeShaderStageOption,
24
- ): string;
25
- getCubeTexture(texturePropert: string, uvSnippet: string, shaderStage?: NodeShaderStageOption): string;
26
-
27
- getCubeTextureLevel(
28
- textureProperty: string,
29
- uvSnippet: string,
30
- biasSnippet: string,
31
- shaderStage?: NodeShaderStageOption,
32
- ): string;
33
-
34
- getCubeTextureBias(textureProperty: string, uvSnippet: string, biasSnippet: string): string;
35
16
  getUniforms(shaderStage: string): string;
36
17
 
37
18
  getAttributes(shaderStage: string): string;
@@ -1,4 +1,6 @@
1
- import { AnimationClip, Bone, Matrix4, Object3D, Skeleton, SkeletonHelper } from '../../../src/Three';
1
+ import { AnimationClip, Object3D, Skeleton } from '../../../src/Three';
2
+
3
+ export function clone(source: Object3D): Object3D;
2
4
 
3
5
  export function retarget(target: Object3D | Skeleton, source: Object3D | Skeleton, options: {}): void;
4
6
 
@@ -8,21 +10,3 @@ export function retargetClip(
8
10
  clip: AnimationClip,
9
11
  options: {},
10
12
  ): AnimationClip;
11
-
12
- export function getHelperFromSkeleton(skeleton: Skeleton): SkeletonHelper;
13
-
14
- export function getSkeletonOffsets(target: Object3D | Skeleton, source: Object3D | Skeleton, options: {}): Matrix4[];
15
-
16
- export function renameBones(skeleton: Skeleton, names: {}): any;
17
-
18
- export function getBones(skeleton: Skeleton | Bone[]): Bone[];
19
-
20
- export function getBoneByName(name: string, skeleton: Skeleton): Bone;
21
-
22
- export function getNearestBone(bone: Bone, names: {}): Bone;
23
-
24
- export function findBoneTrackData(name: string, tracks: any[]): {};
25
-
26
- export function getEqualsBonesNames(skeleton: Skeleton, targetSkeleton: Skeleton): string[];
27
-
28
- export function clone(source: Object3D): Object3D;
three/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for three 0.151
1
+ // Type definitions for three 0.152
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.151.0",
3
+ "version": "0.152.1",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -25,12 +25,13 @@
25
25
  },
26
26
  "scripts": {},
27
27
  "dependencies": {
28
+ "@tweenjs/tween.js": "~18.6.4",
28
29
  "@types/stats.js": "*",
29
30
  "@types/webxr": "*",
30
31
  "fflate": "~0.6.9",
31
32
  "lil-gui": "~0.17.0"
32
33
  },
33
- "typesPublisherContentHash": "d8fac10d09ead80aa5112cb6407ef75e354363f34bdd002bfb12b3c5d40cb691",
34
+ "typesPublisherContentHash": "4a1b7a1820d0565498723427b382216d64d91a892d84b4a3ad2c73c41a5fe823",
34
35
  "typeScriptVersion": "4.4",
35
36
  "exports": {
36
37
  ".": {
three/src/constants.d.ts CHANGED
@@ -681,11 +681,14 @@ export type TrianglesDrawModes = typeof TrianglesDrawMode | typeof TriangleStrip
681
681
  ///////////////////////////////////////////////////////////////////////////////
682
682
  // Texture Encodings
683
683
 
684
+ /** @deprecated Use {@link LinearSRGBColorSpace} or {@link NoColorSpace} in three.js r152+. */
684
685
  export const LinearEncoding: 3000;
686
+ /** @deprecated Use {@link SRGBColorSpace} in three.js r152+. */
685
687
  export const sRGBEncoding: 3001;
686
688
  /**
687
689
  * Texture Encodings.
688
690
  * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
691
+ * @deprecated Use {@link ColorSpace} in three.js r152+.
689
692
  */
690
693
  export type TextureEncoding = typeof LinearEncoding | typeof sRGBEncoding;
691
694
 
@@ -901,26 +904,3 @@ export type PixelFormatGPU =
901
904
  | 'DEPTH_COMPONENT32F'
902
905
  | 'DEPTH24_STENCIL8'
903
906
  | 'DEPTH32F_STENCIL8';
904
-
905
- ///////////////////////////////////////////////////////////////////////////////
906
-
907
- export type BuiltinShaderAttributeName =
908
- | 'position'
909
- | 'normal'
910
- | 'uv'
911
- | 'color'
912
- | 'skinIndex'
913
- | 'skinWeight'
914
- | 'instanceMatrix'
915
- | 'morphTarget0'
916
- | 'morphTarget1'
917
- | 'morphTarget2'
918
- | 'morphTarget3'
919
- | 'morphTarget4'
920
- | 'morphTarget5'
921
- | 'morphTarget6'
922
- | 'morphTarget7'
923
- | 'morphNormal0'
924
- | 'morphNormal1'
925
- | 'morphNormal2'
926
- | 'morphNormal3';
@@ -161,7 +161,7 @@ export class BufferAttribute {
161
161
 
162
162
  /**
163
163
  * Copy the array given here (which can be a normal array or `TypedArray`) into {@link BufferAttribute.array | array}.
164
- * @See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set | TypedArray.set} for notes on requirements if copying a `TypedArray`.
164
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set | TypedArray.set} for notes on requirements if copying a `TypedArray`.
165
165
  */
166
166
  copyArray(array: ArrayLike<number>): this;
167
167
 
@@ -1,15 +1,19 @@
1
1
  import { BufferAttribute } from './BufferAttribute';
2
2
  import { InterleavedBufferAttribute } from './InterleavedBufferAttribute';
3
- import { GLBufferAttribute } from './GLBufferAttribute';
4
- import { Box3 } from './../math/Box3';
5
- import { Sphere } from './../math/Sphere';
6
- import { Matrix4 } from './../math/Matrix4';
7
- import { Quaternion } from './../math/Quaternion';
8
- import { Vector2 } from './../math/Vector2';
9
- import { Vector3 } from './../math/Vector3';
3
+ import { Box3 } from '../math/Box3';
4
+ import { Sphere } from '../math/Sphere';
5
+ import { Matrix4 } from '../math/Matrix4';
6
+ import { Quaternion } from '../math/Quaternion';
7
+ import { Vector2 } from '../math/Vector2';
8
+ import { Vector3 } from '../math/Vector3';
10
9
  import { EventDispatcher } from './EventDispatcher';
11
- import { BuiltinShaderAttributeName } from '../constants';
12
- import * as BufferGeometryUtils from '../../examples/jsm/utils/BufferGeometryUtils';
10
+ import { GLBufferAttribute } from './GLBufferAttribute';
11
+
12
+ export type NormalBufferAttributes = Record<string, BufferAttribute | InterleavedBufferAttribute>;
13
+ export type NormalOrGLBufferAttributes = Record<
14
+ string,
15
+ BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute
16
+ >;
13
17
 
14
18
  /**
15
19
  * A representation of mesh, line, or point geometry
@@ -19,20 +23,46 @@ import * as BufferGeometryUtils from '../../examples/jsm/utils/BufferGeometryUti
19
23
  * @example
20
24
  * ```typescript
21
25
  * const geometry = new THREE.BufferGeometry();
26
+ *
22
27
  * // create a simple square shape. We duplicate the top left and bottom right
23
28
  * // vertices because each vertex needs to appear once per triangle.
24
- * const vertices = new Float32Array([
25
- * -1.0, -1.0, 1.0,
26
- * 1.0, -1.0, 1.0,
27
- * 1.0, 1.0, 1.0,
29
+ * const vertices = new Float32Array( [
30
+ * -1.0, -1.0, 1.0, // v0
31
+ * 1.0, -1.0, 1.0, // v1
32
+ * 1.0, 1.0, 1.0, // v2
33
+ *
34
+ * 1.0, 1.0, 1.0, // v3
35
+ * -1.0, 1.0, 1.0, // v4
36
+ * -1.0, -1.0, 1.0 // v5
37
+ * ] );
28
38
  *
29
- * 1.0, 1.0, 1.0,
30
- * -1.0, 1.0, 1.0,
31
- * -1.0, -1.0, 1.0]);
32
39
  * // itemSize = 3 because there are 3 values (components) per vertex
33
- * geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
34
- * const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
35
- * const mesh = new THREE.Mesh(geometry, material);
40
+ * geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
41
+ * const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
42
+ * const mesh = new THREE.Mesh( geometry, material );
43
+ * ```
44
+ * @example
45
+ * ```typescript
46
+ * const geometry = new THREE.BufferGeometry();
47
+ *
48
+ * const vertices = new Float32Array( [
49
+ * -1.0, -1.0, 1.0, // v0
50
+ * 1.0, -1.0, 1.0, // v1
51
+ * 1.0, 1.0, 1.0, // v2
52
+ * -1.0, 1.0, 1.0, // v3
53
+ * ] );
54
+ * geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
55
+ *
56
+ * const indices = [
57
+ * 0, 1, 2,
58
+ * 2, 3, 0,
59
+ * ];
60
+ *
61
+ * geometry.setIndex( indices );
62
+ * geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
63
+ *
64
+ * const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
65
+ * const mesh = new THREE.Mesh( geometry, material );
36
66
  * ```
37
67
  * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry | Mesh with non-indexed faces}
38
68
  * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_indexed | Mesh with indexed faces}
@@ -43,7 +73,9 @@ import * as BufferGeometryUtils from '../../examples/jsm/utils/BufferGeometryUti
43
73
  * @see {@link https://threejs.org/docs/index.html#api/en/core/BufferGeometry | Official Documentation}
44
74
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js | Source}
45
75
  */
46
- export class BufferGeometry extends EventDispatcher {
76
+ export class BufferGeometry<
77
+ Attributes extends NormalOrGLBufferAttributes = NormalBufferAttributes,
78
+ > extends EventDispatcher {
47
79
  /**
48
80
  * This creates a new {@link THREE.BufferGeometry | BufferGeometry} object.
49
81
  */
@@ -87,9 +119,7 @@ export class BufferGeometry extends EventDispatcher {
87
119
  * use {@link setAttribute | .setAttribute} and {@link getAttribute | .getAttribute} to access attributes of this geometry.
88
120
  * @defaultValue `{}`
89
121
  */
90
- attributes: {
91
- [name: string]: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute; // TODO Replace for 'Record<>'
92
- };
122
+ attributes: Attributes;
93
123
 
94
124
  /**
95
125
  * Hashmap of {@link THREE.BufferAttribute | BufferAttributes} holding details of the geometry's morph targets.
@@ -185,30 +215,25 @@ export class BufferGeometry extends EventDispatcher {
185
215
  * @param name
186
216
  * @param attribute
187
217
  */
188
- setAttribute(
189
- name: BuiltinShaderAttributeName | (string & {}),
190
- attribute: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute,
191
- ): this;
218
+ setAttribute<K extends keyof Attributes>(name: K, attribute: Attributes[K]): this;
192
219
 
193
220
  /**
194
221
  * Returns the {@link attributes | attribute} with the specified name.
195
222
  * @param name
196
223
  */
197
- getAttribute(
198
- name: BuiltinShaderAttributeName | (string & {}),
199
- ): BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute;
224
+ getAttribute<K extends keyof Attributes>(name: K): Attributes[K];
200
225
 
201
226
  /**
202
227
  * Deletes the {@link attributes | attribute} with the specified name.
203
228
  * @param name
204
229
  */
205
- deleteAttribute(name: BuiltinShaderAttributeName | (string & {})): BufferGeometry;
230
+ deleteAttribute(name: keyof Attributes): this;
206
231
 
207
232
  /**
208
233
  * Returns true if the {@link attributes | attribute} with the specified name exists.
209
234
  * @param name
210
235
  */
211
- hasAttribute(name: BuiltinShaderAttributeName | (string & {})): boolean;
236
+ hasAttribute(name: keyof Attributes): boolean;
212
237
 
213
238
  /**
214
239
  * Adds a group to this geometry
@@ -329,7 +354,9 @@ export class BufferGeometry extends EventDispatcher {
329
354
  computeTangents(): void;
330
355
 
331
356
  /**
332
- * Computes vertex normals by averaging face normals.
357
+ * Computes vertex normals for the given vertex data. For indexed geometries, the method sets each vertex normal to
358
+ * be the average of the face normals of the faces that share that vertex. For non-indexed geometries, vertices are
359
+ * not shared, and the method sets each vertex normal to be the same as the face normal.
333
360
  */
334
361
  computeVertexNormals(): void;
335
362
 
@@ -27,7 +27,7 @@ export interface Intersection<TIntersected extends Object3D = Object3D> {
27
27
  /** The intersected object */
28
28
  object: TIntersected;
29
29
  uv?: Vector2 | undefined;
30
- uv2?: Vector2 | undefined;
30
+ uv1?: Vector2 | undefined;
31
31
  normal?: Vector3;
32
32
  /** The index number of the instance where the ray intersects the {@link THREE.InstancedMesh | InstancedMesh } */
33
33
  instanceId?: number | undefined;
@@ -12,7 +12,7 @@ export class Loader {
12
12
  crossOrigin: string;
13
13
 
14
14
  /**
15
- * @default: false
15
+ * @default false
16
16
  */
17
17
  withCredentials: boolean;
18
18
 
@@ -89,7 +89,7 @@ export class ShaderMaterial extends Material {
89
89
  };
90
90
 
91
91
  /**
92
- * @default { 'color': [ 1, 1, 1 ], 'uv': [ 0, 0 ], 'uv2': [ 0, 0 ] }
92
+ * @default { 'color': [ 1, 1, 1 ], 'uv': [ 0, 0 ], 'uv1': [ 0, 0 ] }
93
93
  */
94
94
  defaultAttributeValues: any;
95
95
 
@@ -1,8 +1,9 @@
1
- import { Material } from './../materials/Material';
2
- import { Raycaster } from './../core/Raycaster';
3
- import { Object3D } from './../core/Object3D';
4
- import { BufferGeometry } from '../core/BufferGeometry';
5
- import { Intersection } from '../core/Raycaster';
1
+ import { Material } from '../materials/Material';
2
+ import { Object3D } from '../core/Object3D';
3
+ import { BufferGeometry, NormalOrGLBufferAttributes } from '../core/BufferGeometry';
4
+ import { BufferAttribute } from '../core/BufferAttribute';
5
+ import { InterleavedBufferAttribute } from '../core/InterleavedBufferAttribute';
6
+ import { GLBufferAttribute } from '../core/GLBufferAttribute';
6
7
 
7
8
  /**
8
9
  * A class for displaying {@link Points}
@@ -12,7 +13,7 @@ import { Intersection } from '../core/Raycaster';
12
13
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/Points.js | Source}
13
14
  */
14
15
  export class Points<
15
- TGeometry extends BufferGeometry = BufferGeometry,
16
+ TGeometry extends BufferGeometry<NormalOrGLBufferAttributes> = BufferGeometry,
16
17
  TMaterial extends Material | Material[] = Material | Material[],
17
18
  > extends Object3D {
18
19
  /**
@@ -8,6 +8,7 @@ import {
8
8
  TextureEncoding,
9
9
  MinificationTextureFilter,
10
10
  MagnificationTextureFilter,
11
+ ColorSpace,
11
12
  } from '../constants';
12
13
 
13
14
  export interface WebGLRenderTargetOptions {
@@ -22,7 +23,9 @@ export interface WebGLRenderTargetOptions {
22
23
  stencilBuffer?: boolean | undefined; // false;
23
24
  generateMipmaps?: boolean | undefined; // true;
24
25
  depthTexture?: DepthTexture | undefined;
26
+ /** @deprecated Use 'colorSpace' in three.js r152+. */
25
27
  encoding?: TextureEncoding | undefined;
28
+ colorSpace?: ColorSpace | undefined;
26
29
 
27
30
  /**
28
31
  * Defines the count of MSAA samples. Can only be used with WebGL 2. Default is **0**.
@@ -14,7 +14,7 @@ import { WebGLRenderTarget } from './WebGLRenderTarget';
14
14
  import { WebGLMultipleRenderTargets } from './WebGLMultipleRenderTargets';
15
15
  import { Object3D } from './../core/Object3D';
16
16
  import { Material } from './../materials/Material';
17
- import { ToneMapping, ShadowMapType, CullFace, TextureEncoding } from '../constants';
17
+ import { ToneMapping, ShadowMapType, CullFace, TextureEncoding, ColorSpace } from '../constants';
18
18
  import { WebXRManager } from '../renderers/webxr/WebXRManager';
19
19
  import { BufferGeometry } from './../core/BufferGeometry';
20
20
  import { OffscreenCanvas, Texture } from '../textures/Texture';
@@ -189,9 +189,17 @@ export class WebGLRenderer implements Renderer {
189
189
  /**
190
190
  * Default is LinearEncoding.
191
191
  * @default THREE.LinearEncoding
192
+ * @deprecated Use {@link WebGLRenderer.outputColorSpace .outputColorSpace} in three.js r152+.
192
193
  */
193
194
  outputEncoding: TextureEncoding;
194
195
 
196
+ /**
197
+ * Color space used for output to HTMLCanvasElement. Supported values are
198
+ * {@link SRGBColorSpace} and {@link LinearSRGBColorSpace}.
199
+ * @default THREE.SRGBColorSpace.
200
+ */
201
+ outputColorSpace: ColorSpace;
202
+
195
203
  /**
196
204
  * @default true
197
205
  */
@@ -29,7 +29,6 @@ export class CanvasTexture extends Texture {
29
29
  * @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}
30
30
  * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
31
31
  * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
32
- * @param encoding See {@link Texture.encoding | .encoding}. Default {@link THREE.LinearEncoding}
33
32
  */
34
33
  constructor(
35
34
  canvas: TexImageSource | OffscreenCanvas,
@@ -4,9 +4,9 @@ import {
4
4
  Wrapping,
5
5
  CompressedPixelFormat,
6
6
  TextureDataType,
7
- TextureEncoding,
8
7
  MagnificationTextureFilter,
9
8
  MinificationTextureFilter,
9
+ ColorSpace,
10
10
  } from '../constants';
11
11
 
12
12
  /**
@@ -30,6 +30,7 @@ export class CompressedTexture extends Texture {
30
30
  * @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.LinearFilter}
31
31
  * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.LinearMipmapLinearFilter}
32
32
  * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
33
+ * @param colorSpace See {@link Texture.colorSpace .colorSpace}. Default {@link NoColorSpace}
33
34
  */
34
35
  constructor(
35
36
  mipmaps: ImageData[],
@@ -43,7 +44,7 @@ export class CompressedTexture extends Texture {
43
44
  magFilter?: MagnificationTextureFilter,
44
45
  minFilter?: MinificationTextureFilter,
45
46
  anisotropy?: number,
46
- encoding?: TextureEncoding,
47
+ colorSpace?: ColorSpace,
47
48
  );
48
49
 
49
50
  /**
@@ -1,13 +1,12 @@
1
1
  import { Texture } from './Texture';
2
2
  import {
3
- Mapping,
4
3
  Wrapping,
5
4
  PixelFormat,
6
5
  TextureDataType,
7
- TextureEncoding,
8
6
  MagnificationTextureFilter,
9
7
  MinificationTextureFilter,
10
8
  CubeTextureMapping,
9
+ ColorSpace,
11
10
  } from '../constants';
12
11
 
13
12
  /**
@@ -41,7 +40,7 @@ export class CubeTexture extends Texture {
41
40
  * @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}
42
41
  * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
43
42
  * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
44
- * @param encoding See {@link Texture.encoding | .encoding}. Default {@link THREE.LinearEncoding}
43
+ * @param colorSpace See {@link Texture.colorSpace | .colorSpace}. Default {@link NoColorSpace}
45
44
  */
46
45
  constructor(
47
46
  images?: any[], // HTMLImageElement or HTMLCanvasElement
@@ -53,7 +52,7 @@ export class CubeTexture extends Texture {
53
52
  format?: PixelFormat,
54
53
  type?: TextureDataType,
55
54
  anisotropy?: number,
56
- encoding?: TextureEncoding,
55
+ colorSpace?: ColorSpace,
57
56
  );
58
57
 
59
58
  /**
@@ -4,9 +4,9 @@ import {
4
4
  Wrapping,
5
5
  PixelFormat,
6
6
  TextureDataType,
7
- TextureEncoding,
8
7
  MagnificationTextureFilter,
9
8
  MinificationTextureFilter,
9
+ ColorSpace,
10
10
  } from '../constants';
11
11
  import { TextureImageData } from './types';
12
12
 
@@ -50,7 +50,7 @@ export class DataTexture extends Texture {
50
50
  * @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.NearestFilter}
51
51
  * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.NearestFilter}
52
52
  * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
53
- * @param encoding See {@link Texture.encoding | .encoding}. Default {@link THREE.LinearEncoding}
53
+ * @param colorSpace See {@link Texture.colorSpace | .colorSpace}. Default {@link NoColorSpace}
54
54
  */
55
55
  constructor(
56
56
  data?: BufferSource | null,
@@ -64,7 +64,7 @@ export class DataTexture extends Texture {
64
64
  magFilter?: MagnificationTextureFilter,
65
65
  minFilter?: MinificationTextureFilter,
66
66
  anisotropy?: number,
67
- encoding?: TextureEncoding,
67
+ colorSpace?: ColorSpace,
68
68
  );
69
69
 
70
70
  /**
@@ -13,6 +13,7 @@ import {
13
13
  MinificationTextureFilter,
14
14
  AnyPixelFormat,
15
15
  AnyMapping,
16
+ ColorSpace,
16
17
  } from '../constants';
17
18
 
18
19
  /** Shim for OffscreenCanvas. */
@@ -49,7 +50,7 @@ export class Texture extends EventDispatcher {
49
50
  * @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}
50
51
  * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
51
52
  * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
52
- * @param encoding See {@link Texture.encoding | .encoding}. Default {@link THREE.LinearEncoding}
53
+ * @param colorSpace See {@link Texture.colorSpace | .colorSpace}. Default {@link THREE.NoColorSpace}
53
54
  */
54
55
  constructor(
55
56
  image?: TexImageSource | OffscreenCanvas,
@@ -61,7 +62,23 @@ export class Texture extends EventDispatcher {
61
62
  format?: PixelFormat,
62
63
  type?: TextureDataType,
63
64
  anisotropy?: number,
64
- encoding?: TextureEncoding,
65
+ colorSpace?: ColorSpace,
66
+ );
67
+
68
+ /**
69
+ * @deprecated
70
+ */
71
+ constructor(
72
+ image: TexImageSource | OffscreenCanvas,
73
+ mapping: Mapping,
74
+ wrapS: Wrapping,
75
+ wrapT: Wrapping,
76
+ magFilter: MagnificationTextureFilter,
77
+ minFilter: MinificationTextureFilter,
78
+ format: PixelFormat,
79
+ type: TextureDataType,
80
+ anisotropy: number,
81
+ encoding: TextureEncoding,
65
82
  );
66
83
 
67
84
  /**
@@ -124,7 +141,8 @@ export class Texture extends EventDispatcher {
124
141
  mapping: AnyMapping;
125
142
 
126
143
  /**
127
- * Lets you select the uv attribute to map the texture to. `0` for `uv` and `1` for `uv2`.
144
+ * Lets you select the uv attribute to map the texture to. `0` for `uv`, `1` for `uv1`, `2` for `uv2` and `3` for
145
+ * `uv3`.
128
146
  */
129
147
  channel: number;
130
148
 
@@ -315,9 +333,21 @@ export class Texture extends EventDispatcher {
315
333
  * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
316
334
  * @see {@link THREE.TextureDataType}
317
335
  * @defaultValue {@link THREE.LinearEncoding}
336
+ * @deprecated Use {@link Texture.colorSpace .colorSpace} in three.js r152+.
318
337
  */
319
338
  encoding: TextureEncoding;
320
339
 
340
+ /**
341
+ * The {@link Textures | {@link Texture} constants} page for details of other color spaces.
342
+ * @remarks
343
+ * Textures containing color data should be annotated with {@link SRGBColorSpace THREE.SRGBColorSpace} or
344
+ * {@link LinearSRGBColorSpace THREE.LinearSRGBColorSpace}.
345
+ * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
346
+ * @see {@link THREE.TextureDataType}
347
+ * @defaultValue {@link THREE.NoColorSpace}
348
+ */
349
+ colorSpace: ColorSpace;
350
+
321
351
  /**
322
352
  * Indicates whether a texture belongs to a render target or not
323
353
  * @defaultValue `false`
@@ -1,5 +0,0 @@
1
- import { ShaderNode } from '../../shadernode/ShaderNodeBaseElements';
2
- import Node from '../../core/Node';
3
- declare const getDistanceAttenuation: ShaderNode<{ lightDistance: Node; cutoffDistance: Node; decayExponent: Node }>;
4
-
5
- export default getDistanceAttenuation;