@types/three 0.160.0 → 0.161.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.
Files changed (135) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +5 -1
  3. three/examples/jsm/capabilities/WebGPU.d.ts +2 -0
  4. three/examples/jsm/curves/NURBSUtils.d.ts +136 -10
  5. three/examples/jsm/curves/NURBSVolume.d.ts +23 -0
  6. three/examples/jsm/exporters/USDZExporter.d.ts +1 -0
  7. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -0
  8. three/examples/jsm/loaders/KTX2Loader.d.ts +44 -4
  9. three/examples/jsm/loaders/LUT3dlLoader.d.ts +29 -2
  10. three/examples/jsm/loaders/LUTCubeLoader.d.ts +37 -2
  11. three/examples/jsm/materials/MeshPostProcessingMaterial.d.ts +13 -0
  12. three/examples/jsm/nodes/Nodes.d.ts +75 -10
  13. three/examples/jsm/nodes/accessors/CameraNode.d.ts +17 -6
  14. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +8 -2
  15. three/examples/jsm/nodes/accessors/MaterialReferenceNode.d.ts +1 -1
  16. three/examples/jsm/nodes/accessors/ModelNode.d.ts +2 -0
  17. three/examples/jsm/nodes/accessors/Object3DNode.d.ts +10 -6
  18. three/examples/jsm/nodes/accessors/TextureBicubicNode.d.ts +18 -0
  19. three/examples/jsm/nodes/accessors/TextureNode.d.ts +11 -3
  20. three/examples/jsm/nodes/accessors/VertexColorNode.d.ts +12 -0
  21. three/examples/jsm/nodes/code/FunctionCallNode.d.ts +6 -0
  22. three/examples/jsm/nodes/core/AssignNode.d.ts +17 -0
  23. three/examples/jsm/nodes/core/BypassNode.d.ts +6 -0
  24. three/examples/jsm/nodes/core/CacheNode.d.ts +8 -0
  25. three/examples/jsm/nodes/core/ContextNode.d.ts +8 -0
  26. three/examples/jsm/nodes/core/IndexNode.d.ts +18 -0
  27. three/examples/jsm/nodes/core/LightingModel.d.ts +36 -0
  28. three/examples/jsm/nodes/core/Node.d.ts +32 -8
  29. three/examples/jsm/nodes/core/NodeBuilder.d.ts +22 -21
  30. three/examples/jsm/nodes/core/NodeFrame.d.ts +18 -6
  31. three/examples/jsm/nodes/core/PropertyNode.d.ts +19 -2
  32. three/examples/jsm/nodes/core/VarNode.d.ts +8 -2
  33. three/examples/jsm/nodes/core/VaryingNode.d.ts +6 -0
  34. three/examples/jsm/nodes/core/constants.d.ts +23 -24
  35. three/examples/jsm/nodes/display/AfterImageNode.d.ts +25 -0
  36. three/examples/jsm/nodes/display/AnamorphicNode.d.ts +32 -0
  37. three/examples/jsm/nodes/display/BlendModeNode.d.ts +14 -4
  38. three/examples/jsm/nodes/display/ColorAdjustmentNode.d.ts +11 -0
  39. three/examples/jsm/nodes/display/ColorSpaceNode.d.ts +15 -2
  40. three/examples/jsm/nodes/display/GaussianBlurNode.d.ts +28 -0
  41. three/examples/jsm/nodes/display/NormalMapNode.d.ts +6 -0
  42. three/examples/jsm/nodes/display/PassNode.d.ts +44 -0
  43. three/examples/jsm/nodes/display/PosterizeNode.d.ts +6 -0
  44. three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +32 -0
  45. three/examples/jsm/nodes/display/ViewportSharedTextureNode.d.ts +18 -0
  46. three/examples/jsm/nodes/display/ViewportTextureNode.d.ts +33 -0
  47. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +6 -0
  48. three/examples/jsm/nodes/fog/FogNode.d.ts +6 -0
  49. three/examples/jsm/nodes/fog/FogRangeNode.d.ts +6 -0
  50. three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.d.ts +9 -2
  51. three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.d.ts +3 -2
  52. three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.d.ts +7 -0
  53. three/examples/jsm/nodes/functions/BSDF/DFGApprox.d.ts +3 -2
  54. three/examples/jsm/nodes/functions/BSDF/D_GGX.d.ts +3 -2
  55. three/examples/jsm/nodes/functions/BSDF/F_Schlick.d.ts +3 -2
  56. three/examples/jsm/nodes/functions/PhongLightingModel.d.ts +7 -0
  57. three/examples/jsm/nodes/functions/PhysicalLightingModel.d.ts +17 -8
  58. three/examples/jsm/nodes/gpgpu/ComputeNode.d.ts +6 -0
  59. three/examples/jsm/nodes/lighting/LightingContextNode.d.ts +20 -13
  60. three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +1 -2
  61. three/examples/jsm/nodes/materials/Materials.d.ts +9 -17
  62. three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +2 -4
  63. three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +12 -0
  64. three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +3 -7
  65. three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +17 -0
  66. three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +1 -2
  67. three/examples/jsm/nodes/materials/NodeMaterial.d.ts +30 -14
  68. three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts +2 -8
  69. three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +0 -10
  70. three/examples/jsm/nodes/math/CondNode.d.ts +6 -0
  71. three/examples/jsm/nodes/math/HashNode.d.ts +16 -0
  72. three/examples/jsm/nodes/math/MathNode.d.ts +15 -9
  73. three/examples/jsm/nodes/math/MathUtils.d.ts +16 -0
  74. three/examples/jsm/nodes/math/OperatorNode.d.ts +5 -4
  75. three/examples/jsm/nodes/math/TriNoise3D.d.ts +12 -0
  76. three/examples/jsm/nodes/procedural/CheckerNode.d.ts +6 -0
  77. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +55 -4
  78. three/examples/jsm/nodes/utils/DiscardNode.d.ts +16 -0
  79. three/examples/jsm/nodes/utils/ReflectorNode.d.ts +30 -0
  80. three/examples/jsm/nodes/utils/RemapNode.d.ts +23 -4
  81. three/examples/jsm/nodes/utils/RotateNode.d.ts +21 -0
  82. three/examples/jsm/nodes/utils/RotateUVNode.d.ts +6 -0
  83. three/examples/jsm/nodes/utils/TriplanarTexturesNode.d.ts +6 -0
  84. three/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
  85. three/examples/jsm/objects/QuadMesh.d.ts +3 -1
  86. three/examples/jsm/postprocessing/GTAOPass.d.ts +3 -0
  87. three/examples/jsm/postprocessing/SSAOPass.d.ts +1 -1
  88. three/examples/jsm/renderers/common/Backend.d.ts +6 -2
  89. three/examples/jsm/renderers/common/Color4.d.ts +9 -0
  90. three/examples/jsm/renderers/common/Info.d.ts +7 -1
  91. three/examples/jsm/renderers/common/PostProcessing.d.ts +11 -0
  92. three/examples/jsm/renderers/common/Renderer.d.ts +243 -4
  93. three/examples/jsm/renderers/common/StorageTexture.d.ts +5 -0
  94. three/examples/jsm/renderers/webgl/WebGLBackend.d.ts +4 -2
  95. three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +2 -2
  96. three/examples/jsm/renderers/webgpu/WebGPUBackend.d.ts +15 -6
  97. three/examples/jsm/renderers/webgpu/WebGPURenderer.d.ts +7 -7
  98. three/examples/jsm/utils/BufferGeometryUtils.d.ts +0 -10
  99. three/examples/jsm/webxr/XRControllerModelFactory.d.ts +6 -5
  100. three/examples/jsm/webxr/XRHandMeshModel.d.ts +10 -2
  101. three/package.json +2 -2
  102. three/src/cameras/PerspectiveCamera.d.ts +13 -0
  103. three/src/constants.d.ts +1 -2
  104. three/src/core/InterleavedBufferAttribute.d.ts +12 -2
  105. three/src/core/Object3D.d.ts +13 -13
  106. three/src/extras/core/Curve.d.ts +9 -9
  107. three/src/extras/core/CurvePath.d.ts +8 -7
  108. three/src/geometries/RingGeometry.d.ts +1 -1
  109. three/src/materials/Material.d.ts +3 -1
  110. three/src/materials/ShaderMaterial.d.ts +9 -1
  111. three/src/math/Color.d.ts +1 -1
  112. three/src/math/Quaternion.d.ts +27 -30
  113. three/src/math/Triangle.d.ts +0 -17
  114. three/src/math/Vector2.d.ts +24 -159
  115. three/src/math/Vector3.d.ts +46 -54
  116. three/src/math/Vector4.d.ts +25 -20
  117. three/src/objects/BatchedMesh.d.ts +2 -2
  118. three/src/objects/Bone.d.ts +2 -2
  119. three/src/objects/InstancedMesh.d.ts +2 -1
  120. three/src/objects/LOD.d.ts +2 -2
  121. three/src/objects/Line.d.ts +3 -2
  122. three/src/objects/LineLoop.d.ts +3 -1
  123. three/src/objects/LineSegments.d.ts +3 -1
  124. three/src/objects/Points.d.ts +3 -2
  125. three/src/objects/SkinnedMesh.d.ts +3 -6
  126. three/src/objects/Sprite.d.ts +2 -2
  127. three/src/renderers/webgl/WebGLProgram.d.ts +0 -1
  128. three/src/renderers/webgl/WebGLPrograms.d.ts +3 -1
  129. three/src/renderers/webxr/WebXRDepthSensing.d.ts +27 -0
  130. three/src/renderers/webxr/WebXRManager.d.ts +2 -1
  131. three/src/textures/DataArrayTexture.d.ts +1 -1
  132. three/src/textures/Source.d.ts +11 -1
  133. three/build/three.d.ts +0 -2
  134. three/build/three.min.d.ts +0 -2
  135. three/examples/jsm/objects/GroundProjectedSkybox.d.ts +0 -13
@@ -1,4 +1,4 @@
1
- import { Vector } from '../../math/Vector2.js';
1
+ import { Vector2 } from '../../math/Vector2.js';
2
2
  import { Vector3 } from '../../math/Vector3.js';
3
3
 
4
4
  /**
@@ -25,7 +25,7 @@ import { Vector3 } from '../../math/Vector3.js';
25
25
  * @see {@link https://threejs.org/docs/index.html#api/en/extras/core/Curve | Official Documentation}
26
26
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/core/Curve.js | Source}
27
27
  */
28
- export abstract class Curve<T extends Vector> {
28
+ export abstract class Curve<TVector extends Vector2 | Vector3> {
29
29
  protected constructor();
30
30
 
31
31
  /**
@@ -49,26 +49,26 @@ export abstract class Curve<T extends Vector> {
49
49
  * @param t A position on the curve. Must be in the range `[ 0, 1 ]`. Expects a `Float`
50
50
  * @param optionalTarget If specified, the result will be copied into this Vector, otherwise a new Vector will be created. Default `new T`.
51
51
  */
52
- getPoint(t: number, optionalTarget?: T): T;
52
+ getPoint(t: number, optionalTarget?: TVector): TVector;
53
53
 
54
54
  /**
55
55
  * Returns a vector for a given position on the {@link Curve} according to the arc length.
56
56
  * @param u A position on the {@link Curve} according to the arc length. Must be in the range `[ 0, 1 ]`. Expects a `Float`
57
57
  * @param optionalTarget If specified, the result will be copied into this Vector, otherwise a new Vector will be created. Default `new T`.
58
58
  */
59
- getPointAt(u: number, optionalTarget?: T): T;
59
+ getPointAt(u: number, optionalTarget?: TVector): TVector;
60
60
 
61
61
  /**
62
62
  * Returns a set of divisions `+1` points using {@link .getPoint | getPoint(t)}.
63
63
  * @param divisions Number of pieces to divide the {@link Curve} into. Expects a `Integer`. Default `5`
64
64
  */
65
- getPoints(divisions?: number): T[];
65
+ getPoints(divisions?: number): TVector[];
66
66
 
67
67
  /**
68
68
  * Returns a set of divisions `+1` equi-spaced points using {@link .getPointAt | getPointAt(u)}.
69
69
  * @param divisions Number of pieces to divide the {@link Curve} into. Expects a `Integer`. Default `5`
70
70
  */
71
- getSpacedPoints(divisions?: number): T[];
71
+ getSpacedPoints(divisions?: number): TVector[];
72
72
 
73
73
  /**
74
74
  * Get total {@link Curve} arc length.
@@ -107,14 +107,14 @@ export abstract class Curve<T extends Vector> {
107
107
  * @param t A position on the curve. Must be in the range `[ 0, 1 ]`. Expects a `Float`
108
108
  * @param optionalTarget If specified, the result will be copied into this Vector, otherwise a new Vector will be created.
109
109
  */
110
- getTangent(t: number, optionalTarget?: T): T;
110
+ getTangent(t: number, optionalTarget?: TVector): TVector;
111
111
 
112
112
  /**
113
113
  * Returns tangent at a point which is equidistant to the ends of the {@link Curve} from the point given in {@link .getTangent}.
114
114
  * @param u A position on the {@link Curve} according to the arc length. Must be in the range `[ 0, 1 ]`. Expects a `Float`
115
115
  * @param optionalTarget If specified, the result will be copied into this Vector, otherwise a new Vector will be created.
116
116
  */
117
- getTangentAt(u: number, optionalTarget?: T): T;
117
+ getTangentAt(u: number, optionalTarget?: TVector): TVector;
118
118
 
119
119
  /**
120
120
  * Generates the Frenet Frames
@@ -141,7 +141,7 @@ export abstract class Curve<T extends Vector> {
141
141
  * Copies another {@link Curve} object to this instance.
142
142
  * @param source
143
143
  */
144
- copy(source: Curve<T>): this;
144
+ copy(source: Curve<TVector>): this;
145
145
 
146
146
  /**
147
147
  * Returns a JSON object representation of this instance.
@@ -1,5 +1,6 @@
1
1
  import { Curve } from './Curve.js';
2
- import { Vector } from '../../math/Vector2.js';
2
+ import { Vector2 } from '../../math/Vector2.js';
3
+ import { Vector3 } from '../../math/Vector3.js';
3
4
 
4
5
  /**
5
6
  * Curved Path - a curve path is simply a array of connected curves, but retains the api of a curve.
@@ -8,7 +9,7 @@ import { Vector } from '../../math/Vector2.js';
8
9
  * @see {@link https://threejs.org/docs/index.html#api/en/extras/core/CurvePath | Official Documentation}
9
10
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/core/CurvePath.js | Source}
10
11
  */
11
- export class CurvePath<T extends Vector> extends Curve<T> {
12
+ export class CurvePath<TVector extends Vector2 | Vector3> extends Curve<TVector> {
12
13
  /**
13
14
  * The constructor take no parameters.
14
15
  */
@@ -25,7 +26,7 @@ export class CurvePath<T extends Vector> extends Curve<T> {
25
26
  * The array of {@link Curve | Curves}.
26
27
  * @defaultValue `[]`
27
28
  */
28
- curves: Array<Curve<T>>;
29
+ curves: Array<Curve<TVector>>;
29
30
 
30
31
  /**
31
32
  * Whether or not to automatically close the path.
@@ -37,13 +38,13 @@ export class CurvePath<T extends Vector> extends Curve<T> {
37
38
  * Add a curve to the {@link .curves} array.
38
39
  * @param curve
39
40
  */
40
- add(curve: Curve<T>): void;
41
+ add(curve: Curve<TVector>): void;
41
42
  /**
42
43
  * Adds a {@link LineCurve | lineCurve} to close the path.
43
44
  */
44
45
  closePath(): this;
45
46
 
46
- getPoint(t: number, optionalTarget?: T): T;
47
+ getPoint(t: number, optionalTarget?: TVector): TVector;
47
48
 
48
49
  /**
49
50
  * Get list of cumulative curve lengths of the curves in the {@link .curves} array.
@@ -58,11 +59,11 @@ export class CurvePath<T extends Vector> extends Curve<T> {
58
59
  * For example, for a {@link THREE.LineCurve | LineCurve}, the returned number of points is always just 2.
59
60
  * @param divisions Number of pieces to divide the curve into. Expects a `Integer`. Default `12`
60
61
  */
61
- override getPoints(divisions?: number): T[];
62
+ override getPoints(divisions?: number): TVector[];
62
63
 
63
64
  /**
64
65
  * Returns a set of divisions `+1` equi-spaced points using {@link .getPointAt | getPointAt(u)}.
65
66
  * @param divisions Number of pieces to divide the curve into. Expects a `Integer`. Default `40`
66
67
  */
67
- override getSpacedPoints(divisions?: number): T[];
68
+ override getSpacedPoints(divisions?: number): TVector[];
68
69
  }
@@ -21,7 +21,7 @@ export class RingGeometry extends BufferGeometry {
21
21
  * @param innerRadius Expects a `Float`. Default `0.5`.
22
22
  * @param outerRadius Expects a `Float`. Default `1`.
23
23
  * @param thetaSegments Number of segments. A higher number means the ring will be more round. Minimum is 3. Expects a `Integer`. Default `32`.
24
- * @param phiSegments Minimum is 1. Expects a `Integer`. Default `1`.
24
+ * @param phiSegments Number of segments per ring segment. Minimum is `1`. Expects a `Integer`. Default `1`.
25
25
  * @param thetaStart Starting angle. Expects a `Float`. Default `0`.
26
26
  * @param thetaLength Central angle. Expects a `Float`. Default `Math.PI * 2`.
27
27
  */
@@ -91,7 +91,9 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
91
91
  alphaTest: number;
92
92
 
93
93
  /**
94
- * Enables alpha to coverage. Can only be used with MSAA-enabled rendering contexts.
94
+ * Enables alpha to coverage. Can only be used with MSAA-enabled rendering contexts (meaning when the renderer was
95
+ * created with *antialias* parameter set to `true`). Enabling this will smooth aliasing on clip plane edges and
96
+ * alphaTest-clipped edges.
95
97
  * @default false
96
98
  */
97
99
  alphaToCoverage: boolean;
@@ -92,7 +92,14 @@ export class ShaderMaterial extends Material {
92
92
  derivatives: any;
93
93
 
94
94
  /**
95
- * @default { derivatives: false, fragDepth: false, drawBuffers: false, shaderTextureLOD: false, clipCullDistance: false }
95
+ * @default {
96
+ * derivatives: false,
97
+ * fragDepth: false,
98
+ * drawBuffers: false,
99
+ * shaderTextureLOD: false,
100
+ * clipCullDistance: false,
101
+ * multiDraw: false
102
+ * }
96
103
  */
97
104
  extensions: {
98
105
  derivatives: boolean;
@@ -100,6 +107,7 @@ export class ShaderMaterial extends Material {
100
107
  drawBuffers: boolean;
101
108
  shaderTextureLOD: boolean;
102
109
  clipCullDistance: boolean;
110
+ multiDraw: boolean;
103
111
  };
104
112
 
105
113
  /**
three/src/math/Color.d.ts CHANGED
@@ -255,7 +255,7 @@ export class Color {
255
255
  * Copies given color.
256
256
  * @param color Color to copy.
257
257
  */
258
- copy(color: Color): this;
258
+ copy(color: this): this;
259
259
 
260
260
  /**
261
261
  * Copies given color making conversion from sRGB to linear space.
@@ -1,9 +1,16 @@
1
1
  import { Euler } from './Euler.js';
2
- import { Vector3 } from './Vector3.js';
2
+ import { Vector3, Vector3Like } from './Vector3.js';
3
3
  import { Matrix4 } from './Matrix4.js';
4
4
  import { BufferAttribute } from '../core/BufferAttribute.js';
5
5
  import { InterleavedBufferAttribute } from '../core/InterleavedBufferAttribute.js';
6
6
 
7
+ export interface QuaternionLike {
8
+ readonly x: number;
9
+ readonly y: number;
10
+ readonly z: number;
11
+ readonly w: number;
12
+ }
13
+
7
14
  /**
8
15
  * Implementation of a quaternion. This is used for rotating things without incurring in the dreaded gimbal lock issue, amongst other advantages.
9
16
  *
@@ -46,7 +53,7 @@ export class Quaternion {
46
53
  /**
47
54
  * Sets values of this quaternion.
48
55
  */
49
- set(x: number, y: number, z: number, w: number): Quaternion;
56
+ set(x: number, y: number, z: number, w: number): this;
50
57
 
51
58
  /**
52
59
  * Clones this quaternion.
@@ -56,36 +63,36 @@ export class Quaternion {
56
63
  /**
57
64
  * Copies values of q to this quaternion.
58
65
  */
59
- copy(q: Quaternion): this;
66
+ copy(q: QuaternionLike): this;
60
67
 
61
68
  /**
62
69
  * Sets this quaternion from rotation specified by Euler angles.
63
70
  */
64
- setFromEuler(euler: Euler, update?: boolean): Quaternion;
71
+ setFromEuler(euler: Euler, update?: boolean): this;
65
72
 
66
73
  /**
67
74
  * Sets this quaternion from rotation specified by axis and angle.
68
75
  * Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm.
69
76
  * Axis have to be normalized, angle is in radians.
70
77
  */
71
- setFromAxisAngle(axis: Vector3, angle: number): Quaternion;
78
+ setFromAxisAngle(axis: Vector3Like, angle: number): this;
72
79
 
73
80
  /**
74
81
  * Sets this quaternion from rotation component of m. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm.
75
82
  */
76
- setFromRotationMatrix(m: Matrix4): Quaternion;
77
- setFromUnitVectors(vFrom: Vector3, vTo: Vector3): Quaternion;
83
+ setFromRotationMatrix(m: Matrix4): this;
84
+ setFromUnitVectors(vFrom: Vector3, vTo: Vector3Like): this;
78
85
  angleTo(q: Quaternion): number;
79
- rotateTowards(q: Quaternion, step: number): Quaternion;
86
+ rotateTowards(q: Quaternion, step: number): this;
80
87
 
81
- identity(): Quaternion;
88
+ identity(): this;
82
89
 
83
90
  /**
84
91
  * Inverts this quaternion.
85
92
  */
86
- invert(): Quaternion;
93
+ invert(): this;
87
94
 
88
- conjugate(): Quaternion;
95
+ conjugate(): this;
89
96
  dot(v: Quaternion): number;
90
97
  lengthSq(): number;
91
98
 
@@ -97,22 +104,22 @@ export class Quaternion {
97
104
  /**
98
105
  * Normalizes this quaternion.
99
106
  */
100
- normalize(): Quaternion;
107
+ normalize(): this;
101
108
 
102
109
  /**
103
110
  * Multiplies this quaternion by b.
104
111
  */
105
- multiply(q: Quaternion): Quaternion;
106
- premultiply(q: Quaternion): Quaternion;
112
+ multiply(q: Quaternion): this;
113
+ premultiply(q: Quaternion): this;
107
114
 
108
115
  /**
109
116
  * Sets this quaternion to a x b
110
117
  * Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm.
111
118
  */
112
- multiplyQuaternions(a: Quaternion, b: Quaternion): Quaternion;
119
+ multiplyQuaternions(a: Quaternion, b: Quaternion): this;
113
120
 
114
- slerp(qb: Quaternion, t: number): Quaternion;
115
- slerpQuaternions(qa: Quaternion, qb: Quaternion, t: number): Quaternion;
121
+ slerp(qb: Quaternion, t: number): this;
122
+ slerpQuaternions(qa: Quaternion, qb: Quaternion, t: number): this;
116
123
  equals(v: Quaternion): boolean;
117
124
 
118
125
  /**
@@ -149,9 +156,9 @@ export class Quaternion {
149
156
  * @param attribute the source attribute.
150
157
  * @param index index in the attribute.
151
158
  */
152
- fromBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, index: number): Quaternion;
159
+ fromBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, index: number): this;
153
160
 
154
- _onChange(callback: () => void): Quaternion;
161
+ _onChange(callback: () => void): this;
155
162
  _onChangeCallback: () => void;
156
163
 
157
164
  static slerpFlat(
@@ -173,17 +180,7 @@ export class Quaternion {
173
180
  stcOffset1: number,
174
181
  ): number[];
175
182
 
176
- /**
177
- * @deprecated Use qm.slerpQuaternions( qa, qb, t ) instead..
178
- */
179
- static slerp(qa: Quaternion, qb: Quaternion, qm: Quaternion, t: number): number;
180
-
181
- /**
182
- * @deprecated Use {@link Vector#applyQuaternion vector.applyQuaternion( quaternion )} instead.
183
- */
184
- multiplyVector3(v: any): any;
185
-
186
- random(): Quaternion;
183
+ random(): this;
187
184
 
188
185
  [Symbol.iterator](): Generator<number, void>;
189
186
  }
@@ -40,10 +40,6 @@ export class Triangle {
40
40
  getNormal(target: Vector3): Vector3;
41
41
  getPlane(target: Plane): Plane;
42
42
  getBarycoord(point: Vector3, target: Vector3): Vector3 | null;
43
- /**
44
- * @deprecated Triangle.getUV() has been renamed to Triangle.getInterpolation().
45
- */
46
- getUV(point: Vector3, uv1: Vector2, uv2: Vector2, uv3: Vector2, target: Vector2): Vector2;
47
43
  getInterpolation(point: Vector3, v1: Vector2, v2: Vector2, v3: Vector2, target: Vector2): Vector2 | null;
48
44
  getInterpolation(point: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, target: Vector3): Vector3 | null;
49
45
  getInterpolation(point: Vector3, v1: Vector4, v2: Vector4, v3: Vector4, target: Vector4): Vector4 | null;
@@ -56,19 +52,6 @@ export class Triangle {
56
52
  static getNormal(a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3;
57
53
  static getBarycoord(point: Vector3, a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3 | null;
58
54
  static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): boolean;
59
- /**
60
- * @deprecated THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().
61
- */
62
- static getUV(
63
- point: Vector3,
64
- p1: Vector3,
65
- p2: Vector3,
66
- p3: Vector3,
67
- uv1: Vector2,
68
- uv2: Vector2,
69
- uv3: Vector2,
70
- target: Vector2,
71
- ): Vector2;
72
55
  static getInterpolation(
73
56
  point: Vector3,
74
57
  p1: Vector3,
@@ -3,140 +3,15 @@ import { BufferAttribute } from '../core/BufferAttribute.js';
3
3
 
4
4
  export type Vector2Tuple = [number, number];
5
5
 
6
- /**
7
- * ( interface Vector<T> )
8
- *
9
- * Abstract interface of {@link https://github.com/mrdoob/three.js/blob/master/src/math/Vector2.js|Vector2},
10
- * {@link https://github.com/mrdoob/three.js/blob/master/src/math/Vector3.js|Vector3}
11
- * and {@link https://github.com/mrdoob/three.js/blob/master/src/math/Vector4.js|Vector4}.
12
- *
13
- * Currently the members of Vector is NOT type safe because it accepts different typed vectors.
14
- *
15
- * Those definitions will be changed when TypeScript innovates Generics to be type safe.
16
- *
17
- * @example
18
- * const v:THREE.Vector = new THREE.Vector3();
19
- * v.addVectors(new THREE.Vector2(0, 1), new THREE.Vector2(2, 3)); // invalid but compiled successfully
20
- */
21
- export interface Vector {
22
- setComponent(index: number, value: number): this;
23
-
24
- getComponent(index: number): number;
25
-
26
- set(...args: number[]): this;
27
-
28
- setScalar(scalar: number): this;
29
-
30
- /**
31
- * copy(v:T):T;
32
- */
33
- copy(v: Vector): this;
34
-
35
- /**
36
- * NOTE: The second argument is deprecated.
37
- *
38
- * add(v:T):T;
39
- */
40
- add(v: Vector): this;
41
-
42
- /**
43
- * addVectors(a:T, b:T):T;
44
- */
45
- addVectors(a: Vector, b: Vector): this;
46
-
47
- addScaledVector(vector: Vector, scale: number): this;
48
-
49
- /**
50
- * Adds the scalar value s to this vector's values.
51
- */
52
- addScalar(scalar: number): this;
53
-
54
- /**
55
- * sub(v:T):T;
56
- */
57
- sub(v: Vector): this;
58
-
59
- /**
60
- * subVectors(a:T, b:T):T;
61
- */
62
- subVectors(a: Vector, b: Vector): this;
63
-
64
- /**
65
- * multiplyScalar(s:number):T;
66
- */
67
- multiplyScalar(s: number): this;
68
-
69
- /**
70
- * divideScalar(s:number):T;
71
- */
72
- divideScalar(s: number): this;
73
-
74
- /**
75
- * negate():T;
76
- */
77
- negate(): this;
78
-
79
- /**
80
- * dot(v:T):T;
81
- */
82
- dot(v: Vector): number;
83
-
84
- /**
85
- * lengthSq():number;
86
- */
87
- lengthSq(): number;
88
-
89
- /**
90
- * length():number;
91
- */
92
- length(): number;
93
-
94
- /**
95
- * normalize():T;
96
- */
97
- normalize(): this;
98
-
99
- /**
100
- * NOTE: Vector4 doesn't have the property.
101
- *
102
- * distanceTo(v:T):number;
103
- */
104
- distanceTo?(v: Vector): number;
105
-
106
- /**
107
- * NOTE: Vector4 doesn't have the property.
108
- *
109
- * distanceToSquared(v:T):number;
110
- */
111
- distanceToSquared?(v: Vector): number;
112
-
113
- /**
114
- * setLength(l:number):T;
115
- */
116
- setLength(l: number): this;
117
-
118
- /**
119
- * lerp(v:T, alpha:number):T;
120
- */
121
- lerp(v: Vector, alpha: number): this;
122
-
123
- /**
124
- * equals(v:T):boolean;
125
- */
126
- equals(v: Vector): boolean;
127
-
128
- /**
129
- * clone():T;
130
- */
131
- clone(): Vector;
6
+ export interface Vector2Like {
7
+ readonly x: number;
8
+ readonly y: number;
132
9
  }
133
10
 
134
11
  /**
135
12
  * 2D vector.
136
- *
137
- * ( class Vector2 implements Vector<Vector2> )
138
13
  */
139
- export class Vector2 implements Vector {
14
+ export class Vector2 {
140
15
  constructor(x?: number, y?: number);
141
16
 
142
17
  /**
@@ -190,12 +65,12 @@ export class Vector2 implements Vector {
190
65
  /**
191
66
  * Copies value of v to this vector.
192
67
  */
193
- copy(v: Vector2): this;
68
+ copy(v: Vector2Like): this;
194
69
 
195
70
  /**
196
71
  * Adds v to this vector.
197
72
  */
198
- add(v: Vector2, w?: Vector2): this;
73
+ add(v: Vector2Like): this;
199
74
 
200
75
  /**
201
76
  * Adds the scalar value s to this vector's x and y values.
@@ -205,17 +80,17 @@ export class Vector2 implements Vector {
205
80
  /**
206
81
  * Sets this vector to a + b.
207
82
  */
208
- addVectors(a: Vector2, b: Vector2): this;
83
+ addVectors(a: Vector2Like, b: Vector2Like): this;
209
84
 
210
85
  /**
211
86
  * Adds the multiple of v and s to this vector.
212
87
  */
213
- addScaledVector(v: Vector2, s: number): this;
88
+ addScaledVector(v: Vector2Like, s: number): this;
214
89
 
215
90
  /**
216
91
  * Subtracts v from this vector.
217
92
  */
218
- sub(v: Vector2): this;
93
+ sub(v: Vector2Like): this;
219
94
 
220
95
  /**
221
96
  * Subtracts s from this vector's x and y components.
@@ -225,12 +100,12 @@ export class Vector2 implements Vector {
225
100
  /**
226
101
  * Sets this vector to a - b.
227
102
  */
228
- subVectors(a: Vector2, b: Vector2): this;
103
+ subVectors(a: Vector2Like, b: Vector2Like): this;
229
104
 
230
105
  /**
231
106
  * Multiplies this vector by v.
232
107
  */
233
- multiply(v: Vector2): this;
108
+ multiply(v: Vector2Like): this;
234
109
 
235
110
  /**
236
111
  * Multiplies this vector by scalar s.
@@ -240,7 +115,7 @@ export class Vector2 implements Vector {
240
115
  /**
241
116
  * Divides this vector by v.
242
117
  */
243
- divide(v: Vector2): this;
118
+ divide(v: Vector2Like): this;
244
119
 
245
120
  /**
246
121
  * Divides this vector by scalar s.
@@ -256,12 +131,12 @@ export class Vector2 implements Vector {
256
131
  /**
257
132
  * If this vector's x or y value is greater than v's x or y value, replace that value with the corresponding min value.
258
133
  */
259
- min(v: Vector2): this;
134
+ min(v: Vector2Like): this;
260
135
 
261
136
  /**
262
137
  * If this vector's x or y value is less than v's x or y value, replace that value with the corresponding max value.
263
138
  */
264
- max(v: Vector2): this;
139
+ max(v: Vector2Like): this;
265
140
 
266
141
  /**
267
142
  * If this vector's x or y value is greater than the max vector's x or y value, it is replaced by the corresponding value.
@@ -269,7 +144,7 @@ export class Vector2 implements Vector {
269
144
  * @param min the minimum x and y values.
270
145
  * @param max the maximum x and y values in the desired range.
271
146
  */
272
- clamp(min: Vector2, max: Vector2): this;
147
+ clamp(min: Vector2Like, max: Vector2Like): this;
273
148
 
274
149
  /**
275
150
  * If this vector's x or y values are greater than the max value, they are replaced by the max value.
@@ -315,12 +190,12 @@ export class Vector2 implements Vector {
315
190
  /**
316
191
  * Computes dot product of this vector and v.
317
192
  */
318
- dot(v: Vector2): number;
193
+ dot(v: Vector2Like): number;
319
194
 
320
195
  /**
321
196
  * Computes cross product of this vector and v.
322
197
  */
323
- cross(v: Vector2): number;
198
+ cross(v: Vector2Like): number;
324
199
 
325
200
  /**
326
201
  * Computes squared length of this vector.
@@ -332,11 +207,6 @@ export class Vector2 implements Vector {
332
207
  */
333
208
  length(): number;
334
209
 
335
- /**
336
- * @deprecated Use {@link Vector2#manhattanLength .manhattanLength()} instead.
337
- */
338
- lengthManhattan(): number;
339
-
340
210
  /**
341
211
  * Computes the Manhattan length of this vector.
342
212
  *
@@ -362,24 +232,19 @@ export class Vector2 implements Vector {
362
232
  /**
363
233
  * Computes distance of this vector to v.
364
234
  */
365
- distanceTo(v: Vector2): number;
235
+ distanceTo(v: Vector2Like): number;
366
236
 
367
237
  /**
368
238
  * Computes squared distance of this vector to v.
369
239
  */
370
- distanceToSquared(v: Vector2): number;
371
-
372
- /**
373
- * @deprecated Use {@link Vector2#manhattanDistanceTo .manhattanDistanceTo()} instead.
374
- */
375
- distanceToManhattan(v: Vector2): number;
240
+ distanceToSquared(v: Vector2Like): number;
376
241
 
377
242
  /**
378
243
  * Computes the Manhattan length (distance) from this vector to the given vector v
379
244
  *
380
245
  * see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry}
381
246
  */
382
- manhattanDistanceTo(v: Vector2): number;
247
+ manhattanDistanceTo(v: Vector2Like): number;
383
248
 
384
249
  /**
385
250
  * Normalizes this vector and multiplies it by l.
@@ -391,7 +256,7 @@ export class Vector2 implements Vector {
391
256
  * @param v vector to interpolate towards.
392
257
  * @param alpha interpolation factor in the closed interval [0, 1].
393
258
  */
394
- lerp(v: Vector2, alpha: number): this;
259
+ lerp(v: Vector2Like, alpha: number): this;
395
260
 
396
261
  /**
397
262
  * Sets this vector to be the vector linearly interpolated between v1 and v2 where alpha is the distance along the line connecting the two vectors - alpha = 0 will be v1, and alpha = 1 will be v2.
@@ -399,12 +264,12 @@ export class Vector2 implements Vector {
399
264
  * @param v2 vector to interpolate towards.
400
265
  * @param alpha interpolation factor in the closed interval [0, 1].
401
266
  */
402
- lerpVectors(v1: Vector2, v2: Vector2, alpha: number): this;
267
+ lerpVectors(v1: Vector2Like, v2: Vector2Like, alpha: number): this;
403
268
 
404
269
  /**
405
270
  * Checks for strict equality of this vector and v.
406
271
  */
407
- equals(v: Vector2): boolean;
272
+ equals(v: Vector2Like): boolean;
408
273
 
409
274
  /**
410
275
  * Sets this vector's x and y value from the provided array or array-like.
@@ -442,7 +307,7 @@ export class Vector2 implements Vector {
442
307
  * @param center the point around which to rotate.
443
308
  * @param angle the angle to rotate, in radians.
444
309
  */
445
- rotateAround(center: Vector2, angle: number): this;
310
+ rotateAround(center: Vector2Like, angle: number): this;
446
311
 
447
312
  /**
448
313
  * Sets this vector's x and y from Math.random