Skip to content

Commit

Permalink
Docs: Document nullable types according to JSDoc spec. (#30466)
Browse files Browse the repository at this point in the history
* Docs: Document nullable types according to JSDoc spec.

* Clean up.
  • Loading branch information
Mugen87 authored Feb 5, 2025
1 parent 4f3c02b commit d995617
Show file tree
Hide file tree
Showing 138 changed files with 613 additions and 608 deletions.
8 changes: 4 additions & 4 deletions examples/jsm/controls/ArcballControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class ArcballControls extends Controls {
/**
*
* @param {Camera} camera Virtual camera used in the scene
* @param {HTMLElement?} [domElement=null] Renderer's dom element
* @param {Scene?} [scene=null] The scene to be rendered
* @param {?HTMLElement} [domElement=null] Renderer's dom element
* @param {?Scene} [scene=null] The scene to be rendered
*/
constructor( camera, domElement = null, scene = null ) {

Expand Down Expand Up @@ -1250,7 +1250,7 @@ class ArcballControls extends Controls {
* Get the operation associated to mouse and key combination and returns the corresponding FSA state
* @param {0|1|2} mouse Mouse button index (0, 1, 2)
* @param {'CTRL'|'SHIFT'|null} key Keyboard modifier
* @returns {STATE?} The FSA state obtained from the operation associated to mouse/keyboard combination
* @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination
*/
getOpStateFromAction( mouse, key ) {

Expand Down Expand Up @@ -2328,7 +2328,7 @@ class ArcballControls extends Controls {
*
* @param {Vector2} cursor Cursor coordinates in NDC
* @param {Camera} camera Virtual camera
* @returns {Vector3?} The point of intersection with the model, if exist, null otherwise
* @returns {?Vector3} The point of intersection with the model, if exist, null otherwise
*/
unprojectOnObj( cursor, camera ) {

Expand Down
20 changes: 10 additions & 10 deletions examples/jsm/exporters/GLTFExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -987,11 +987,11 @@ class GLTFWriter {

/**
* Process and generate a BufferView
* @param {BufferAttribute} attribute
* @param {number} componentType
* @param {number} start
* @param {number} count
* @param {number?} target Target usage of the BufferView
* @param {BufferAttribute} attribute
* @param {number} componentType
* @param {number} start
* @param {number} count
* @param {?number} target Target usage of the BufferView
* @return {Object}
*/
processBufferView( attribute, componentType, start, count, target ) {
Expand Down Expand Up @@ -1179,11 +1179,11 @@ class GLTFWriter {

/**
* Process attribute to generate an accessor
* @param {BufferAttribute} attribute Attribute to process
* @param {THREE.BufferGeometry?} geometry Geometry used for truncated draw range
* @param {number} [start=0]
* @param {number} [count=Infinity]
* @return {number?} Index of the processed accessor on the "accessors" array
* @param {BufferAttribute} attribute Attribute to process
* @param {?BufferGeometry} geometry Geometry used for truncated draw range
* @param {number} [start=0]
* @param {number} [count=Infinity]
* @return {?number} Index of the processed accessor on the "accessors" array
*/
processAccessor( attribute, geometry, start, count ) {

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/loaders/KTX2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class KTX2Loader extends Loader {

/**
* @param {ArrayBuffer} buffer
* @param {object?} config
* @param {?Object} config
* @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
*/
async _createTexture( buffer, config = {} ) {
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/math/OBB.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class OBB {
*
* @param {Ray} ray
* @param {Vector3} result
* @return {Vector3?}
* @return {?Vector3}
*/
intersectRay( ray, result ) {

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/tsl/display/BloomNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ class BloomNode extends TempNode {
* The material for the composite pass.
*
* @private
* @type {NodeMaterial?}
* @type {?NodeMaterial}
*/
this._compositeMaterial = null;

/**
* The material for the luminance pass.
*
* @private
* @type {NodeMaterial?}
* @type {?NodeMaterial}
*/
this._highPassFilterMaterial = null;

Expand Down
6 changes: 3 additions & 3 deletions examples/jsm/tsl/display/DenoiseNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DenoiseNode extends TempNode {
*
* @param {TextureNode} textureNode - The texture node that represents the input of the effect (e.g. AO).
* @param {Node<float>} depthNode - A node that represents the scene's depth.
* @param {Node<vec3>?} normalNode - A node that represents the scene's normals.
* @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
* @param {Camera} camera - The camera the scene is rendered with.
*/
constructor( textureNode, depthNode, normalNode, camera ) {
Expand All @@ -51,7 +51,7 @@ class DenoiseNode extends TempNode {
* constructor (because MRT is not available), normals can be automatically
* reconstructed from depth values in the shader.
*
* @type {Node<vec3>?}
* @type {?Node<vec3>}
*/
this.normalNode = normalNode;

Expand Down Expand Up @@ -325,7 +325,7 @@ function generateDefaultNoise( size = 64 ) {
* @function
* @param {Node} node - The node that represents the input of the effect (e.g. AO).
* @param {Node<float>} depthNode - A node that represents the scene's depth.
* @param {Node<vec3>?} normalNode - A node that represents the scene's normals.
* @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
* @param {Camera} camera - The camera the scene is rendered with.
* @returns {DenoiseNode}
*/
Expand Down
14 changes: 8 additions & 6 deletions examples/jsm/tsl/display/FilmNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class FilmNode extends TempNode {
* Constructs a new film node.
*
* @param {Node} inputNode - The node that represents the input of the effect.
* @param {Node<float>?} [intensityNode=null] - A node that represents the effect's intensity.
* @param {Node<vec2>?} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data.
* @param {?Node<float>} [intensityNode=null] - A node that represents the effect's intensity.
* @param {?Node<vec2>} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data.
*/
constructor( inputNode, intensityNode = null, uvNode = null ) {

Expand All @@ -35,14 +35,16 @@ class FilmNode extends TempNode {
/**
* A node that represents the effect's intensity.
*
* @type {Node<float>}
* @type {?Node<float>}
* @default null
*/
this.intensityNode = intensityNode;

/**
* A node that allows to pass custom (e.g. animated) uv data.
*
* @type {Node<vec2>}
* @type {?Node<vec2>}
* @default null
*/
this.uvNode = uvNode;

Expand Down Expand Up @@ -91,8 +93,8 @@ export default FilmNode;
* @tsl
* @function
* @param {Node<vec4>} inputNode - The node that represents the input of the effect.
* @param {Node<float>?} [intensityNode=null] - A node that represents the effect's intensity.
* @param {Node<vec2>?} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data.
* @param {?Node<float>} [intensityNode=null] - A node that represents the effect's intensity.
* @param {?Node<vec2>} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data.
* @returns {FilmNode}
*/
export const film = /*@__PURE__*/ nodeProxy( FilmNode );
6 changes: 3 additions & 3 deletions examples/jsm/tsl/display/GTAONode.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class GTAONode extends TempNode {
* Constructs a new GTAO node.
*
* @param {Node<float>} depthNode - A node that represents the scene's depth.
* @param {Node<vec3>?} normalNode - A node that represents the scene's normals.
* @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
* @param {Camera} camera - The camera the scene is rendered with.
*/
constructor( depthNode, normalNode, camera ) {
Expand All @@ -61,7 +61,7 @@ class GTAONode extends TempNode {
* constructor (because MRT is not available), normals can be automatically
* reconstructed from depth values in the shader.
*
* @type {Node<vec3>?}
* @type {?Node<vec3>}
*/
this.normalNode = normalNode;

Expand Down Expand Up @@ -514,7 +514,7 @@ function generateMagicSquare( size ) {
* @tsl
* @function
* @param {Node<float>} depthNode - A node that represents the scene's depth.
* @param {Node<vec3>?} normalNode - A node that represents the scene's normals.
* @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
* @param {Camera} camera - The camera the scene is rendered with.
* @returns {GTAONode}
*/
Expand Down
3 changes: 2 additions & 1 deletion examples/jsm/tsl/display/SSAAPassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ class SSAAPassNode extends PassNode {
* Reference to the internal render target that holds the current sample.
*
* @private
* @type {RenderTarget?}
* @type {?RenderTarget}
* @default null
*/
this._sampleRenderTarget = null;

Expand Down
6 changes: 4 additions & 2 deletions examples/jsm/tsl/display/TRAAPassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ class TRAAPassNode extends PassNode {
* The render target that holds the current sample.
*
* @private
* @type {RenderTarget?}
* @type {?RenderTarget}
* @default null
*/
this._sampleRenderTarget = null;

/**
* The render target that represents the history of frame data.
*
* @private
* @type {RenderTarget?}
* @type {?RenderTarget}
* @default null
*/
this._historyRenderTarget = null;

Expand Down
2 changes: 1 addition & 1 deletion src/loaders/nodes/NodeLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class NodeLoader extends Loader {
/**
* Constructs a new node loader.
*
* @param {LoadingManager?} manager - A reference to a loading manager.
* @param {?LoadingManager} manager - A reference to a loading manager.
*/
constructor( manager ) {

Expand Down
2 changes: 1 addition & 1 deletion src/loaders/nodes/NodeMaterialLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class NodeMaterialLoader extends MaterialLoader {
/**
* Constructs a new node material loader.
*
* @param {LoadingManager?} manager - A reference to a loading manager.
* @param {?LoadingManager} manager - A reference to a loading manager.
*/
constructor( manager ) {

Expand Down
4 changes: 2 additions & 2 deletions src/loaders/nodes/NodeObjectLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NodeObjectLoader extends ObjectLoader {
/**
* Constructs a new node object loader.
*
* @param {LoadingManager?} manager - A reference to a loading manager.
* @param {?LoadingManager} manager - A reference to a loading manager.
*/
constructor( manager ) {

Expand All @@ -38,7 +38,7 @@ class NodeObjectLoader extends ObjectLoader {
* A reference to hold the `nodes` JSON property.
*
* @private
* @type {Object?}
* @type {?Object}
*/
this._nodesJSON = null;

Expand Down
12 changes: 6 additions & 6 deletions src/materials/nodes/Line2NodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Line2NodeMaterial extends NodeMaterial {
/**
* Constructs a new node material for wide line rendering.
*
* @param {Object?} parameters - The configuration parameter.
* @param {?Object} parameters - The configuration parameter.
*/
constructor( parameters = {} ) {

Expand Down Expand Up @@ -77,39 +77,39 @@ class Line2NodeMaterial extends NodeMaterial {
/**
* Defines the lines color.
*
* @type {Node<vec3>?}
* @type {?Node<vec3>}
* @default null
*/
this.lineColorNode = null;

/**
* Defines the offset.
*
* @type {Node<float>?}
* @type {?Node<float>}
* @default null
*/
this.offsetNode = null;

/**
* Defines the dash scale.
*
* @type {Node<float>?}
* @type {?Node<float>}
* @default null
*/
this.dashScaleNode = null;

/**
* Defines the dash size.
*
* @type {Node<float>?}
* @type {?Node<float>}
* @default null
*/
this.dashSizeNode = null;

/**
* Defines the gap size.
*
* @type {Node<float>?}
* @type {?Node<float>}
* @default null
*/
this.gapSizeNode = null;
Expand Down
2 changes: 1 addition & 1 deletion src/materials/nodes/LineBasicNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LineBasicNodeMaterial extends NodeMaterial {
/**
* Constructs a new line basic node material.
*
* @param {Object?} parameters - The configuration parameter.
* @param {?Object} parameters - The configuration parameter.
*/
constructor( parameters ) {

Expand Down
10 changes: 5 additions & 5 deletions src/materials/nodes/LineDashedNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LineDashedNodeMaterial extends NodeMaterial {
/**
* Constructs a new line dashed node material.
*
* @param {Object?} parameters - The configuration parameter.
* @param {?Object} parameters - The configuration parameter.
*/
constructor( parameters ) {

Expand Down Expand Up @@ -57,7 +57,7 @@ class LineDashedNodeMaterial extends NodeMaterial {
* If you don't want to overwrite the offset but modify the existing
* value instead, use {@link materialLineDashOffset}.
*
* @type {Node<float>?}
* @type {?Node<float>}
* @default null
*/
this.offsetNode = null;
Expand All @@ -70,7 +70,7 @@ class LineDashedNodeMaterial extends NodeMaterial {
* If you don't want to overwrite the scale but modify the existing
* value instead, use {@link materialLineScale}.
*
* @type {Node<float>?}
* @type {?Node<float>}
* @default null
*/
this.dashScaleNode = null;
Expand All @@ -83,7 +83,7 @@ class LineDashedNodeMaterial extends NodeMaterial {
* If you don't want to overwrite the dash size but modify the existing
* value instead, use {@link materialLineDashSize}.
*
* @type {Node<float>?}
* @type {?Node<float>}
* @default null
*/
this.dashSizeNode = null;
Expand All @@ -96,7 +96,7 @@ class LineDashedNodeMaterial extends NodeMaterial {
* If you don't want to overwrite the gap size but modify the existing
* value instead, use {@link materialLineGapSize}.
*
* @type {Node<float>?}
* @type {?Node<float>}
* @default null
*/
this.gapSizeNode = null;
Expand Down
6 changes: 3 additions & 3 deletions src/materials/nodes/MeshBasicNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
/**
* Constructs a new mesh basic node material.
*
* @param {Object?} parameters - The configuration parameter.
* @param {?Object} parameters - The configuration parameter.
*/
constructor( parameters ) {

Expand Down Expand Up @@ -74,7 +74,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
* to implement the default environment mapping.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {BasicEnvironmentNode<vec3>?} The environment node.
* @return {?BasicEnvironmentNode<vec3>} The environment node.
*/
setupEnvironment( builder ) {

Expand All @@ -89,7 +89,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
* with a special scaling factor for basic materials.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {BasicLightMapNode<vec3>?} The light map node.
* @return {?BasicLightMapNode<vec3>} The light map node.
*/
setupLightMap( builder ) {

Expand Down
Loading

0 comments on commit d995617

Please sign in to comment.