diff --git a/jsdoc-testing/changes.patch b/jsdoc-testing/changes.patch index eb9981350..183301e43 100644 --- a/jsdoc-testing/changes.patch +++ b/jsdoc-testing/changes.patch @@ -10453,6 +10453,190 @@ index 4d9e0160a..962926ab4 100644 } + +export default NodeMaterialObserver; +diff --git a/jsdoc-testing/jsdoc/src/math/Box3.d.ts b/jsdoc-testing/jsdoc/src/math/Box3.d.ts +index b1c152106..c255529c1 100644 +--- a/jsdoc-testing/jsdoc/src/math/Box3.d.ts ++++ b/jsdoc-testing/jsdoc/src/math/Box3.d.ts +@@ -1,3 +1,11 @@ ++import { Vector3 } from './Vector3.js'; ++import { BufferAttribute } from '../core/BufferAttribute.js'; ++import { Object3D } from '../core/Object3D.js'; ++import { Sphere } from './Sphere.js'; ++import { Plane } from './Plane.js'; ++import { Triangle } from './Triangle.js'; ++import { Matrix4 } from './Matrix4.js'; ++ + /** + * Represents an axis-aligned bounding box (AABB) in 3D space. + */ +@@ -37,7 +45,7 @@ export class Box3 { + * @param {Vector3} max - The upper boundary of the box. + * @return {Box3} A reference to this bounding box. + */ +- set(min: Vector3, max: Vector3): Box3; ++ set(min: Vector3, max: Vector3): this; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given array. +@@ -45,7 +53,7 @@ export class Box3 { + * @param {Array} array - An array holding 3D position data. + * @return {Box3} A reference to this bounding box. + */ +- setFromArray(array: Array): Box3; ++ setFromArray(array: ArrayLike): this; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given buffer attribute. +@@ -53,7 +61,7 @@ export class Box3 { + * @param {BufferAttribute} attribute - A buffer attribute holding 3D position data. + * @return {Box3} A reference to this bounding box. + */ +- setFromBufferAttribute(attribute: BufferAttribute): Box3; ++ setFromBufferAttribute(attribute: BufferAttribute): this; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given array. +@@ -61,7 +69,7 @@ export class Box3 { + * @param {Array} points - An array holding 3D position data as instances of {@link Vector3}. + * @return {Box3} A reference to this bounding box. + */ +- setFromPoints(points: Array): Box3; ++ setFromPoints(points: Array): this; + /** + * Centers this box on the given center vector and sets this box's width, height and + * depth to the given size values. +@@ -70,7 +78,7 @@ export class Box3 { + * @param {Vector3} size - The x, y and z dimensions of the box. + * @return {Box3} A reference to this bounding box. + */ +- setFromCenterAndSize(center: Vector3, size: Vector3): Box3; ++ setFromCenterAndSize(center: Vector3, size: Vector3): this; + /** + * Computes the world-axis-aligned bounding box for the given 3D object + * (including its children), accounting for the object's, and children's, +@@ -86,26 +94,26 @@ export class Box3 { + * world-axis-aligned bounding box at the expense of more computation. + * @return {Box3} A reference to this bounding box. + */ +- setFromObject(object: Object3D, precise?: boolean): Box3; ++ setFromObject(object: Object3D, precise?: boolean): this; + /** + * Returns a new box with copied values from this instance. + * + * @return {Box3} A clone of this instance. + */ +- clone(): Box3; ++ clone(): this; + /** + * Copies the values of the given box to this instance. + * + * @param {Box3} box - The box to copy. + * @return {Box3} A reference to this bounding box. + */ +- copy(box: Box3): Box3; ++ copy(box: Box3): this; + /** + * Makes this box empty which means in encloses a zero space in 3D. + * + * @return {Box3} A reference to this bounding box. + */ +- makeEmpty(): Box3; ++ makeEmpty(): this; + /** + * Returns true if this box includes zero points within its bounds. + * Note that a box with equal lower and upper bounds still includes one +@@ -134,7 +142,7 @@ export class Box3 { + * @param {Vector3} point - The point that should be included by the bounding box. + * @return {Box3} A reference to this bounding box. + */ +- expandByPoint(point: Vector3): Box3; ++ expandByPoint(point: Vector3): this; + /** + * Expands this box equilaterally by the given vector. The width of this + * box will be expanded by the x component of the vector in both +@@ -145,7 +153,7 @@ export class Box3 { + * @param {Vector3} vector - The vector that should expand the bounding box. + * @return {Box3} A reference to this bounding box. + */ +- expandByVector(vector: Vector3): Box3; ++ expandByVector(vector: Vector3): this; + /** + * Expands each dimension of the box by the given scalar. If negative, the + * dimensions of the box will be contracted. +@@ -153,7 +161,7 @@ export class Box3 { + * @param {number} scalar - The scalar value that should expand the bounding box. + * @return {Box3} A reference to this bounding box. + */ +- expandByScalar(scalar: number): Box3; ++ expandByScalar(scalar: number): this; + /** + * Expands the boundaries of this box to include the given 3D object and + * its children, accounting for the object's, and children's, world +@@ -165,7 +173,7 @@ export class Box3 { + * as little as necessary at the expense of more computation. + * @return {Box3} A reference to this bounding box. + */ +- expandByObject(object: Object3D, precise?: boolean): Box3; ++ expandByObject(object: Object3D, precise?: boolean): this; + /** + * Returns `true` if the given point lies within or on the boundaries of this box. + * +@@ -249,7 +257,7 @@ export class Box3 { + * @param {Box3} box - The bounding box to intersect with. + * @return {Box3} A reference to this bounding box. + */ +- intersect(box: Box3): Box3; ++ intersect(box: Box3): this; + /** + * Computes the union of this box and another and the given one, setting the upper + * bound of this box to the greater of the two boxes' upper bounds and the +@@ -258,14 +266,14 @@ export class Box3 { + * @param {Box3} box - The bounding box that will be unioned with this instance. + * @return {Box3} A reference to this bounding box. + */ +- union(box: Box3): Box3; ++ union(box: Box3): this; + /** + * Transforms this bounding box by the given 4x4 transformation matrix. + * + * @param {Matrix4} matrix - The transformation matrix. + * @return {Box3} A reference to this bounding box. + */ +- applyMatrix4(matrix: Matrix4): Box3; ++ applyMatrix4(matrix: Matrix4): this; + /** + * Adds the given offset to both the upper and lower bounds of this bounding box, + * effectively moving it in 3D space. +@@ -273,7 +281,7 @@ export class Box3 { + * @param {Vector3} offset - The offset that should be used to translate the bounding box. + * @return {Box3} A reference to this bounding box. + */ +- translate(offset: Vector3): Box3; ++ translate(offset: Vector3): this; + /** + * Returns `true` if this bounding box is equal with the given one. + * +@@ -286,13 +294,17 @@ export class Box3 { + * + * @return {Object} Serialized structure with fields representing the object state. + */ +- toJSON(): Object; ++ toJSON(): Box3JSON; + /** + * Returns a serialized structure of the bounding box. + * + * @param {Object} json - The serialized json to set the box from. + * @return {Box3} A reference to this bounding box. + */ +- fromJSON(json: Object): Box3; ++ fromJSON(json: Box3JSON): this; ++} ++ ++export interface Box3JSON { ++ min: number[]; ++ max: number[]; + } +-import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts b/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts index 561415c0e..093bab0de 100644 --- a/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts diff --git a/jsdoc-testing/declarations.js b/jsdoc-testing/declarations.js index 4cb843650..9c90d0319 100644 --- a/jsdoc-testing/declarations.js +++ b/jsdoc-testing/declarations.js @@ -99,6 +99,7 @@ const files = [ 'src/materials/ShaderMaterial', 'src/materials/ShadowMaterial', 'src/materials/SpriteMaterial', + 'src/math/Box3', 'src/math/interpolants/BezierInterpolant', 'src/math/interpolants/CubicInterpolant', 'src/math/interpolants/DiscreteInterpolant', diff --git a/three.js b/three.js index abec57640..0b6dc718c 160000 --- a/three.js +++ b/three.js @@ -1 +1 @@ -Subproject commit abec57640c2959b45636732bc7692724fc6bc964 +Subproject commit 0b6dc718c923122d81590fa0e595a7ef85851808 diff --git a/types/three/src/math/Box3.d.ts b/types/three/src/math/Box3.d.ts index 91560bdc7..a1fd86b78 100644 --- a/types/three/src/math/Box3.d.ts +++ b/types/three/src/math/Box3.d.ts @@ -6,65 +6,301 @@ import { Sphere } from "./Sphere.js"; import { Triangle } from "./Triangle.js"; import { Vector3 } from "./Vector3.js"; +/** + * Represents an axis-aligned bounding box (AABB) in 3D space. + */ export class Box3 { + /** + * Constructs a new bounding box. + * + * @param {Vector3} [min=(Infinity,Infinity,Infinity)] - A vector representing the lower boundary of the box. + * @param {Vector3} [max=(-Infinity,-Infinity,-Infinity)] - A vector representing the upper boundary of the box. + */ constructor(min?: Vector3, max?: Vector3); - /** - * @default new THREE.Vector3( + Infinity, + Infinity, + Infinity ) + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBox3: boolean; + /** + * The lower boundary of the box. + * + * @type {Vector3} */ min: Vector3; - /** - * @default new THREE.Vector3( - Infinity, - Infinity, - Infinity ) + * The upper boundary of the box. + * + * @type {Vector3} */ max: Vector3; - readonly isBox3: true; - + /** + * Sets the lower and upper boundaries of this box. + * Please note that this method only copies the values from the given objects. + * + * @param {Vector3} min - The lower boundary of the box. + * @param {Vector3} max - The upper boundary of the box. + * @return {Box3} A reference to this bounding box. + */ set(min: Vector3, max: Vector3): this; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given array. + * + * @param {Array} array - An array holding 3D position data. + * @return {Box3} A reference to this bounding box. + */ setFromArray(array: ArrayLike): this; - setFromBufferAttribute(bufferAttribute: BufferAttribute): this; - setFromPoints(points: Vector3[]): this; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given buffer attribute. + * + * @param {BufferAttribute} attribute - A buffer attribute holding 3D position data. + * @return {Box3} A reference to this bounding box. + */ + setFromBufferAttribute(attribute: BufferAttribute): this; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given array. + * + * @param {Array} points - An array holding 3D position data as instances of {@link Vector3}. + * @return {Box3} A reference to this bounding box. + */ + setFromPoints(points: Array): this; + /** + * Centers this box on the given center vector and sets this box's width, height and + * depth to the given size values. + * + * @param {Vector3} center - The center of the box. + * @param {Vector3} size - The x, y and z dimensions of the box. + * @return {Box3} A reference to this bounding box. + */ setFromCenterAndSize(center: Vector3, size: Vector3): this; + /** + * Computes the world-axis-aligned bounding box for the given 3D object + * (including its children), accounting for the object's, and children's, + * world transforms. The function may result in a larger box than strictly necessary. + * + * Note: To compute the correct bounding box, make sure the given 3D object + * has an up-to-date world matrix that reflects the current transformation of its + * ancestor nodes. Call `object.updateWorldMatrix( true, false )` beforehand if + * you're unsure. + * + * @param {Object3D} object - The 3D object to compute the bounding box for. + * @param {boolean} [precise=false] - If set to `true`, the method computes the smallest + * world-axis-aligned bounding box at the expense of more computation. + * @return {Box3} A reference to this bounding box. + */ setFromObject(object: Object3D, precise?: boolean): this; + /** + * Returns a new box with copied values from this instance. + * + * @return {Box3} A clone of this instance. + */ clone(): this; + /** + * Copies the values of the given box to this instance. + * + * @param {Box3} box - The box to copy. + * @return {Box3} A reference to this bounding box. + */ copy(box: Box3): this; + /** + * Makes this box empty which means in encloses a zero space in 3D. + * + * @return {Box3} A reference to this bounding box. + */ makeEmpty(): this; + /** + * Returns true if this box includes zero points within its bounds. + * Note that a box with equal lower and upper bounds still includes one + * point, the one both bounds share. + * + * @return {boolean} Whether this box is empty or not. + */ isEmpty(): boolean; + /** + * Returns the center point of this box. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The center point. + */ getCenter(target: Vector3): Vector3; + /** + * Returns the dimensions of this box. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The size. + */ getSize(target: Vector3): Vector3; + /** + * Expands the boundaries of this box to include the given point. + * + * @param {Vector3} point - The point that should be included by the bounding box. + * @return {Box3} A reference to this bounding box. + */ expandByPoint(point: Vector3): this; + /** + * Expands this box equilaterally by the given vector. The width of this + * box will be expanded by the x component of the vector in both + * directions. The height of this box will be expanded by the y component of + * the vector in both directions. The depth of this box will be + * expanded by the z component of the vector in both directions. + * + * @param {Vector3} vector - The vector that should expand the bounding box. + * @return {Box3} A reference to this bounding box. + */ expandByVector(vector: Vector3): this; + /** + * Expands each dimension of the box by the given scalar. If negative, the + * dimensions of the box will be contracted. + * + * @param {number} scalar - The scalar value that should expand the bounding box. + * @return {Box3} A reference to this bounding box. + */ expandByScalar(scalar: number): this; + /** + * Expands the boundaries of this box to include the given 3D object and + * its children, accounting for the object's, and children's, world + * transforms. The function may result in a larger box than strictly + * necessary (unless the precise parameter is set to true). + * + * @param {Object3D} object - The 3D object that should expand the bounding box. + * @param {boolean} precise - If set to `true`, the method expands the bounding box + * as little as necessary at the expense of more computation. + * @return {Box3} A reference to this bounding box. + */ expandByObject(object: Object3D, precise?: boolean): this; + /** + * Returns `true` if the given point lies within or on the boundaries of this box. + * + * @param {Vector3} point - The point to test. + * @return {boolean} Whether the bounding box contains the given point or not. + */ containsPoint(point: Vector3): boolean; + /** + * Returns `true` if this bounding box includes the entirety of the given bounding box. + * If this box and the given one are identical, this function also returns `true`. + * + * @param {Box3} box - The bounding box to test. + * @return {boolean} Whether the bounding box contains the given bounding box or not. + */ containsBox(box: Box3): boolean; + /** + * Returns a point as a proportion of this box's width, height and depth. + * + * @param {Vector3} point - A point in 3D space. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} A point as a proportion of this box's width, height and depth. + */ getParameter(point: Vector3, target: Vector3): Vector3; + /** + * Returns `true` if the given bounding box intersects with this bounding box. + * + * @param {Box3} box - The bounding box to test. + * @return {boolean} Whether the given bounding box intersects with this bounding box. + */ intersectsBox(box: Box3): boolean; + /** + * Returns `true` if the given bounding sphere intersects with this bounding box. + * + * @param {Sphere} sphere - The bounding sphere to test. + * @return {boolean} Whether the given bounding sphere intersects with this bounding box. + */ intersectsSphere(sphere: Sphere): boolean; + /** + * Returns `true` if the given plane intersects with this bounding box. + * + * @param {Plane} plane - The plane to test. + * @return {boolean} Whether the given plane intersects with this bounding box. + */ intersectsPlane(plane: Plane): boolean; + /** + * Returns `true` if the given triangle intersects with this bounding box. + * + * @param {Triangle} triangle - The triangle to test. + * @return {boolean} Whether the given triangle intersects with this bounding box. + */ intersectsTriangle(triangle: Triangle): boolean; + /** + * Clamps the given point within the bounds of this box. + * + * @param {Vector3} point - The point to clamp. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The clamped point. + */ clampPoint(point: Vector3, target: Vector3): Vector3; + /** + * Returns the euclidean distance from any edge of this box to the specified point. If + * the given point lies inside of this box, the distance will be `0`. + * + * @param {Vector3} point - The point to compute the distance to. + * @return {number} The euclidean distance. + */ distanceToPoint(point: Vector3): number; + /** + * Returns a bounding sphere that encloses this bounding box. + * + * @param {Sphere} target - The target sphere that is used to store the method's result. + * @return {Sphere} The bounding sphere that encloses this bounding box. + */ getBoundingSphere(target: Sphere): Sphere; + /** + * Computes the intersection of this bounding box and the given one, setting the upper + * bound of this box to the lesser of the two boxes' upper bounds and the + * lower bound of this box to the greater of the two boxes' lower bounds. If + * there's no overlap, makes this box empty. + * + * @param {Box3} box - The bounding box to intersect with. + * @return {Box3} A reference to this bounding box. + */ intersect(box: Box3): this; + /** + * Computes the union of this box and another and the given one, setting the upper + * bound of this box to the greater of the two boxes' upper bounds and the + * lower bound of this box to the lesser of the two boxes' lower bounds. + * + * @param {Box3} box - The bounding box that will be unioned with this instance. + * @return {Box3} A reference to this bounding box. + */ union(box: Box3): this; + /** + * Transforms this bounding box by the given 4x4 transformation matrix. + * + * @param {Matrix4} matrix - The transformation matrix. + * @return {Box3} A reference to this bounding box. + */ applyMatrix4(matrix: Matrix4): this; - translate(offset: Vector3): this; - equals(box: Box3): boolean; /** - * @deprecated Use {@link Box3#isEmpty .isEmpty()} instead. + * Adds the given offset to both the upper and lower bounds of this bounding box, + * effectively moving it in 3D space. + * + * @param {Vector3} offset - The offset that should be used to translate the bounding box. + * @return {Box3} A reference to this bounding box. */ - empty(): any; + translate(offset: Vector3): this; /** - * @deprecated Use {@link Box3#intersectsBox .intersectsBox()} instead. + * Returns `true` if this bounding box is equal with the given one. + * + * @param {Box3} box - The box to test for equality. + * @return {boolean} Whether this bounding box is equal with the given one. */ - isIntersectionBox(b: any): any; + equals(box: Box3): boolean; /** - * @deprecated Use {@link Box3#intersectsSphere .intersectsSphere()} instead. + * Returns a serialized structure of the bounding box. + * + * @return {Object} Serialized structure with fields representing the object state. */ - isIntersectionSphere(s: any): any; - toJSON(): Box3JSON; + /** + * Returns a serialized structure of the bounding box. + * + * @param {Object} json - The serialized json to set the box from. + * @return {Box3} A reference to this bounding box. + */ fromJSON(json: Box3JSON): this; }