@types/three 0.151.0 → 0.152.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 +2 -2
- three/build/three.min.d.ts +2 -0
- three/build/three.module.min.d.ts +2 -0
- three/examples/jsm/libs/tween.module.d.ts +2 -0
- three/examples/jsm/nodes/Nodes.d.ts +3 -2
- three/examples/jsm/nodes/core/NodeBuilder.d.ts +0 -8
- three/examples/jsm/nodes/core/constants.d.ts +1 -0
- three/examples/jsm/nodes/lighting/LightUtils.d.ts +4 -0
- three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +0 -7
- three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +0 -9
- three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -9
- three/examples/jsm/nodes/materials/NodeMaterial.d.ts +17 -1
- three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -2
- three/examples/jsm/renderers/CSS3DRenderer.d.ts +2 -2
- three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +0 -19
- three/examples/jsm/utils/SkeletonUtils.d.ts +3 -19
- three/index.d.ts +1 -1
- three/package.json +3 -2
- three/src/constants.d.ts +3 -23
- three/src/core/BufferGeometry.d.ts +60 -33
- three/src/core/Raycaster.d.ts +1 -1
- three/src/materials/ShaderMaterial.d.ts +1 -1
- three/src/objects/Points.d.ts +7 -6
- three/src/renderers/WebGLRenderTarget.d.ts +3 -0
- three/src/renderers/WebGLRenderer.d.ts +9 -1
- three/src/textures/CanvasTexture.d.ts +0 -1
- three/src/textures/CompressedTexture.d.ts +3 -2
- three/src/textures/CubeTexture.d.ts +3 -4
- three/src/textures/DataTexture.d.ts +3 -3
- three/src/textures/Texture.d.ts +33 -3
- 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:
|
|
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, 04 May 2023 00:02:50 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
|
|
@@ -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
|
-
|
|
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 {
|
|
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;
|
|
@@ -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
|
-
|
|
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
|
|
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,
|
|
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
three/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/three",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.152.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,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": "
|
|
34
|
+
"typesPublisherContentHash": "c206b6e9fcb60fc53d60b9c172bf339b663fa61d521aa358641f9b16d55913ed",
|
|
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';
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { BufferAttribute } from './BufferAttribute';
|
|
2
2
|
import { InterleavedBufferAttribute } from './InterleavedBufferAttribute';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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 {
|
|
12
|
-
|
|
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
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
three/src/core/Raycaster.d.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|
three/src/objects/Points.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Material } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
67
|
+
colorSpace?: ColorSpace,
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
/**
|
three/src/textures/Texture.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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`
|
|
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`
|