Skip to content

Commit

Permalink
Docs: fix types (#30677)
Browse files Browse the repository at this point in the history
Co-authored-by: Samuel Rigaud <[email protected]>
  • Loading branch information
s-rigaud and Samuel Rigaud authored Mar 7, 2025
1 parent ce5f72a commit ddfa74b
Show file tree
Hide file tree
Showing 24 changed files with 43 additions and 33 deletions.
2 changes: 1 addition & 1 deletion examples/jsm/libs/motion-controllers.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class MotionController {
/**
* @param {Object} xrInputSource - The XRInputSource to build the MotionController around
* @param {Object} profile - The best matched profile description for the supplied xrInputSource
* @param {Object} assetUrl
* @param {string} assetUrl
*/
constructor(xrInputSource, profile, assetUrl) {
if (!xrInputSource) {
Expand Down
6 changes: 3 additions & 3 deletions examples/jsm/math/ConvexHull.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class ConvexHull {
*
* @private
* @param {Face} face - The target face.
* @return {ConvexHull} A reference to this convex hull.
* @return {VertexNode|undefined} A reference to this convex hull.
*/
_removeAllVerticesFromFace( face ) {

Expand Down Expand Up @@ -1391,7 +1391,7 @@ class VertexNode {
* Reference to the previous vertex in the double linked list.
*
* @private
* @type {?Vector3}
* @type {?VertexNode}
* @default null
*/
this.prev = null;
Expand All @@ -1400,7 +1400,7 @@ class VertexNode {
* Reference to the next vertex in the double linked list.
*
* @private
* @type {?Vector3}
* @type {?VertexNode}
* @default null
*/
this.next = null;
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/objects/MarchingCubes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MarchingCubes extends Mesh {
* @param {Material} material - The cube's material.
* @param {boolean} [enableUvs=false] - Whether texture coordinates should be animated or not.
* @param {boolean} [enableColors=false] - Whether colors should be animated or not.
* @param {boolean} [maxPolyCount=10000] - The maximum size of the geometry buffers.
* @param {number} [maxPolyCount=10000] - The maximum size of the geometry buffers.
*/
constructor( resolution, material, enableUvs = false, enableColors = false, maxPolyCount = 10000 ) {

Expand Down
8 changes: 4 additions & 4 deletions examples/jsm/tsl/display/PixelationPassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ class PixelationPassNode extends PassNode {
* @param {Scene} scene - The scene to render.
* @param {Camera} camera - The camera to render the scene with.
* @param {Node<float> | number} [pixelSize=6] - The pixel size.
* @param {Node<float> | number} [normalEdgeStrength=03] - The normal edge strength.
* @param {Node<float> | number} [depthEdgeStrength=03] - The depth edge strength.
* @param {Node<float> | number} [normalEdgeStrength=0.3] - The normal edge strength.
* @param {Node<float> | number} [depthEdgeStrength=0.4] - The depth edge strength.
*/
constructor( scene, camera, pixelSize = 6, normalEdgeStrength = 0.3, depthEdgeStrength = 0.4 ) {

Expand Down Expand Up @@ -324,8 +324,8 @@ class PixelationPassNode extends PassNode {
* @param {Scene} scene - The scene to render.
* @param {Camera} camera - The camera to render the scene with.
* @param {Node<float> | number} [pixelSize=6] - The pixel size.
* @param {Node<float> | number} [normalEdgeStrength=03] - The normal edge strength.
* @param {Node<float> | number} [depthEdgeStrength=03] - The depth edge strength.
* @param {Node<float> | number} [normalEdgeStrength=0.3] - The normal edge strength.
* @param {Node<float> | number} [depthEdgeStrength=0.4] - The depth edge strength.
* @returns {PixelationPassNode}
*/
export const pixelationPass = ( scene, camera, pixelSize, normalEdgeStrength, depthEdgeStrength ) => nodeObject( new PixelationPassNode( scene, camera, pixelSize, normalEdgeStrength, depthEdgeStrength ) );
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/utils/BufferGeometryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function computeMikkTSpaceTangents( geometry, MikkTSpace, negateSign = true ) {
/**
* @param {Array<BufferGeometry>} geometries
* @param {boolean} useGroups
* @return {BufferGeometry}
* @return {?BufferGeometry}
*/
function mergeGeometries( geometries, useGroups = false ) {

Expand Down Expand Up @@ -297,7 +297,7 @@ function mergeGeometries( geometries, useGroups = false ) {

/**
* @param {Array<BufferAttribute>} attributes
* @return {BufferAttribute}
* @return {?BufferAttribute}
*/
function mergeAttributes( attributes ) {

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/utils/GeometryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Vector3 } from 'three';
* @param {number} [v1=1] - Corner index -X, +Z.
* @param {number} [v2=2] - Corner index +X, +Z.
* @param {number} [v3=3] - Corner index +X, -Z.
* @returns {Array<Array<number>>} The Hilbert curve points.
* @returns {Array<Vector3>} The Hilbert curve points.
*/
function hilbert2D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1, v0 = 0, v1 = 1, v2 = 2, v3 = 3 ) {

Expand Down Expand Up @@ -68,7 +68,7 @@ function hilbert2D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1,
* @param {number} [v5=5] - Corner index +X, -Y, +Z.
* @param {number} [v6=6] - Corner index +X, +Y, +Z.
* @param {number} [v7=7] - Corner index +X, +Y, -Z.
* @returns {Array<Array<number>>} - The Hilbert curve points.
* @returns {Array<Vector3>} - The Hilbert curve points.
*/
function hilbert3D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1, v0 = 0, v1 = 1, v2 = 2, v3 = 3, v4 = 4, v5 = 5, v6 = 6, v7 = 7 ) {

Expand Down
4 changes: 2 additions & 2 deletions src/animation/AnimationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function sortedArray( values, stride, order ) {
* @param {Array<number>} jsonKeys - A list of JSON keyframes.
* @param {Array<number>} times - This array will be filled with keyframe times by this function.
* @param {Array<number>} values - This array will be filled with keyframe values by this function.
* @param {Object<string, any>} valuePropertyName - A dictionary assigning values to property names.
* @param {string} valuePropertyName - The name of the property to use.
*/
function flattenJSON( jsonKeys, times, values, valuePropertyName ) {

Expand Down Expand Up @@ -451,7 +451,7 @@ class AnimationUtils {
* @param {Array<number>} jsonKeys - A list of JSON keyframes.
* @param {Array<number>} times - This array will be filled with keyframe times by this method.
* @param {Array<number>} values - This array will be filled with keyframe values by this method.
* @param {Object<string, any>} valuePropertyName - A dictionary assigning values to property names.
* @param {string} valuePropertyName - The name of the property to use.
*/
static flattenJSON( jsonKeys, times, values, valuePropertyName ) {

Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2
/**
* Represents touch interaction types in context of controls.
*
* @type {ConstantsMouse}
* @type {ConstantsTouch}
* @constant
*/
export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
Expand Down
2 changes: 1 addition & 1 deletion src/core/BufferAttribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class BufferAttribute {
* `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted
* to floats unmodified, i.e. `65535` becomes `65535.0f`.
*
* @type {number}
* @type {boolean}
*/
this.normalized = normalized;

Expand Down
2 changes: 1 addition & 1 deletion src/extras/core/Curve.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Curve {
* @abstract
* @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
* @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to.
* @return {?(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.
* @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.
*/
getPoint( /* t, optionalTarget */ ) {

Expand Down
2 changes: 1 addition & 1 deletion src/geometries/LatheGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LatheGeometry extends BufferGeometry {
/**
* Constructs a new lathe geometry.
*
* @param {Array<Vector2>} [points] - An array of points in 2D space. The x-coordinate of each point
* @param {Array<Vector2|Vector3>} [points] - An array of points in 2D space. The x-coordinate of each point
* must be greater than zero.
* @param {number} [segments=12] - The number of circumference segments to generate.
* @param {number} [phiStart=0] - The starting angle in radians.
Expand Down
2 changes: 1 addition & 1 deletion src/math/Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ class Color {
* Converts the colors RGB values into the HSL format and stores them into the
* given target object.
*
* @param {{h:0,s:0,l:0}} target - The target object that is used to store the method's result.
* @param {{h:number,s:number,l:number}} target - The target object that is used to store the method's result.
* @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space.
* @return {{h:number,s:number,l:number}} The HSL representation of this color.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/accessors/ReferenceNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ export default ReferenceNode;
* @function
* @param {string} name - The name of the property the node refers to.
* @param {string} type - The uniform type that should be used to represent the property value.
* @param {?Object} object - The object the property belongs to.
* @param {?Object} [object] - The object the property belongs to.
* @returns {ReferenceNode}
*/
export const reference = ( name, type, object ) => nodeObject( new ReferenceNode( name, type, object ) );
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/accessors/UniformArrayNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export default UniformArrayNode;
* @tsl
* @function
* @param {Array<any>} values - Array-like data.
* @param {?string} nodeType - The data type of the array elements.
* @param {?string} [nodeType] - The data type of the array elements.
* @returns {UniformArrayNode}
*/
export const uniformArray = ( values, nodeType ) => nodeObject( new UniformArrayNode( values, nodeType ) );
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/core/CacheNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default CacheNode;
* @tsl
* @function
* @param {Node} node - The node that should be cached.
* @param {boolean} parent - Whether this node refers to a shared parent cache or not.
* @param {boolean} [parent] - Whether this node refers to a shared parent cache or not.
* @returns {CacheNode}
*/
export const cache = ( node, parent ) => nodeObject( new CacheNode( nodeObject( node ), parent ) );
Expand Down
4 changes: 3 additions & 1 deletion src/nodes/core/NodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,10 @@ class NodeBuilder {
/**
* This dictionary holds the node variables of this builder.
* The variables are maintained in an array for each shader stage.
* This dictionary is also used to count the number of variables
* according to their type (const, vars).
*
* @type {Object<string,Array<NodeVar>>}
* @type {Object<string,Array<NodeVar>|number>}
*/
this.vars = {};

Expand Down
8 changes: 8 additions & 0 deletions src/nodes/lighting/AnalyticLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,17 @@ class AnalyticLightNode extends LightingNode {
*
* @abstract
* @param {NodeBuilder} builder - The builder object used for setting up the light.
* @return {Object|undefined} The direct light data (color and direction).
*/
setupDirect( /*builder*/ ) { }

/**
* Sets up the direct rect area lighting for the analytic light node.
*
* @abstract
* @param {NodeBuilder} builder - The builder object used for setting up the light.
* @return {Object|undefined} The direct rect area light data.
*/
setupDirectRectArea( /*builder*/ ) { }

/**
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/lighting/ShadowNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ export default ShadowNode;
* @tsl
* @function
* @param {Light} light - The shadow casting light.
* @param {LightShadow} shadow - The light shadow.
* @param {?LightShadow} [shadow] - The light shadow.
* @return {ShadowNode} The created shadow node.
*/
export const shadow = ( light, shadow ) => nodeObject( new ShadowNode( light, shadow ) );
2 changes: 1 addition & 1 deletion src/objects/InstancedMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class InstancedMesh extends Mesh {
* {@link Texture#needsUpdate} flag to true if you modify instanced data
* via {@link InstancedMesh#setMorphAt}.
*
* @type {?InstancedBufferAttribute}
* @type {?DataTexture}
* @default null
*/
this.morphTexture = null;
Expand Down
2 changes: 1 addition & 1 deletion src/objects/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class Skeleton {
* Setups the skeleton by the given JSON and bones.
*
* @param {Object} json - The skeleton as serialized JSON.
* @param {Array<Bone>} bones - An array of bones.
* @param {Object<string, Bone>} bones - An array of bones.
* @return {Skeleton} A reference of this instance.
*/
fromJSON( json, bones ) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/common/Animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Animation {
/**
* Defines the user-level animation loop.
*
* @param {Function} callback - The animation loop.
* @param {?Function} callback - The animation loop.
*/
setAnimationLoop( callback ) {

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ class Renderer {
* for best compatibility.
*
* @async
* @param {Function} callback - The application's animation loop.
* @param {?Function} callback - The application's animation loop.
* @return {Promise} A Promise that resolves when the set has been executed.
*/
async setAnimationLoop( callback ) {
Expand Down
6 changes: 3 additions & 3 deletions src/renderers/common/XRManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class XRManager extends EventDispatcher {
* The current XR reference space type.
*
* @private
* @type {string}
* @type {XRReferenceSpaceType}
* @default 'local-floor'
*/
this._referenceSpaceType = 'local-floor';
Expand Down Expand Up @@ -439,7 +439,7 @@ class XRManager extends EventDispatcher {
/**
* Returns the reference space type.
*
* @return {string} The reference space type.
* @return {XRReferenceSpaceType} The reference space type.
*/
getReferenceSpaceType() {

Expand All @@ -452,7 +452,7 @@ class XRManager extends EventDispatcher {
*
* This method can not be used during a XR session.
*
* @param {string} type - The reference space type.
* @param {XRReferenceSpaceType} type - The reference space type.
*/
setReferenceSpaceType( type ) {

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class GLSLNodeBuilder extends NodeBuilder {
* An array that holds objects defining the varying and attribute data in
* context of Transform Feedback.
*
* @type {Object<string,Map<string,Object>>}
* @type {Array<Object<string,AttributeNode|string>>}
*/
this.transforms = [];

Expand Down

0 comments on commit ddfa74b

Please sign in to comment.