Skip to content

Commit

Permalink
Node: fix some types (#30323)
Browse files Browse the repository at this point in the history
* Node: fix some types

* Update Lighting.js

* Update Background.js

* Update NodeMaterial.js

---------

Co-authored-by: Samuel Rigaud <[email protected]>
Co-authored-by: Michael Herzog <[email protected]>
  • Loading branch information
3 people authored Jan 14, 2025
1 parent 53452d3 commit a34d43c
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/nodes/accessors/BufferAttributeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class BufferAttributeNode extends InputNode {
/**
* Sets the `instanced` property to the given value.
*
* @param {Number} value - The value to set.
* @param {Boolean} value - The value to set.
* @return {BufferAttributeNode} A reference to this node.
*/
setInstanced( value ) {
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/accessors/InstanceNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class InstanceNode extends Node {
/**
* A reference to a buffer that is used by `instanceColorNode`.
*
* @type {InstancedInterleavedBuffer}
* @type {InstancedBufferAttribute}
*/
this.bufferColor = null;

Expand Down
1 change: 0 additions & 1 deletion src/nodes/accessors/Object3DNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class Object3DNode extends Node {
/**
* Overwritten since the node type is inferred from the scope.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {String} The node type.
*/
getNodeType() {
Expand Down
6 changes: 2 additions & 4 deletions src/nodes/accessors/ReferenceBaseNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ReferenceElementNode extends ArrayElementNode {
/**
* Constructs a new reference element node.
*
* @param {Node?} referenceNode - The reference node.
* @param {ReferenceBaseNode?} referenceNode - The reference node.
* @param {Node} indexNode - The index node that defines the element access.
*/
constructor( referenceNode, indexNode ) {
Expand All @@ -37,7 +37,7 @@ class ReferenceElementNode extends ArrayElementNode {
* Similar to {@link module:ReferenceBaseNode~ReferenceBaseNode#reference}, an additional
* property references to the current node.
*
* @type {Node?}
* @type {ReferenceBaseNode?}
* @default null
*/
this.referenceNode = referenceNode;
Expand All @@ -57,7 +57,6 @@ class ReferenceElementNode extends ArrayElementNode {
* This method is overwritten since the node type is inferred from
* the uniform type of the reference node.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {String} The node type.
*/
getNodeType() {
Expand Down Expand Up @@ -286,7 +285,6 @@ class ReferenceBaseNode extends Node {
/**
* The output of the reference node is the internal uniform node.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {UniformNode} The output node.
*/
setup() {
Expand Down
5 changes: 2 additions & 3 deletions src/nodes/accessors/ReferenceNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ReferenceElementNode extends ArrayElementNode {
/**
* Constructs a new reference element node.
*
* @param {Node?} referenceNode - The reference node.
* @param {ReferenceNode?} referenceNode - The reference node.
* @param {Node} indexNode - The index node that defines the element access.
*/
constructor( referenceNode, indexNode ) {
Expand All @@ -41,7 +41,7 @@ class ReferenceElementNode extends ArrayElementNode {
* Similar to {@link module:ReferenceNode~ReferenceNode#reference}, an additional
* property references to the current node.
*
* @type {Node?}
* @type {ReferenceNode?}
* @default null
*/
this.referenceNode = referenceNode;
Expand All @@ -61,7 +61,6 @@ class ReferenceElementNode extends ArrayElementNode {
* This method is overwritten since the node type is inferred from
* the uniform type of the reference node.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {String} The node type.
*/
getNodeType() {
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/accessors/Texture3DNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Texture3DNode extends TextureNode {
*
* @param {Boolean} value - The update toggle.
*/
setUpdateMatrix( /*updateMatrix*/ ) { } // Ignore .updateMatrix for 3d TextureNode
setUpdateMatrix( /*value*/ ) { } // Ignore .updateMatrix for 3d TextureNode

/**
* Overwrites the default implementation to return the unmodified uv node.
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 @@ -343,7 +343,7 @@ export default UniformArrayNode;
*
* @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: 0 additions & 2 deletions src/nodes/accessors/VelocityNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class VelocityNode extends TempNode {

/**
* Constructs a new vertex color node.
*
* @param {Number} [index=0] - The attribute index.
*/
constructor() {

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/common/Lighting.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Lighting extends ChainMap {
* Creates a new lights node for the given array of lights.
*
* @param {Array<Light>} lights - The render object.
* @return {Boolean} Whether if the given render object has an initialized geometry or not.
* @return {LightsNode} The lights node.
*/
createNode( lights = [] ) {

Expand Down
2 changes: 1 addition & 1 deletion src/renderers/common/QuadMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const _geometry = /*@__PURE__*/ new QuadGeometry();
* The intended usage is to reuse a single quad mesh for rendering
* subsequent passes by just reassigning the `material` reference.
*
* @augments BufferGeometry
* @augments Mesh
*/
class QuadMesh extends Mesh {

Expand Down
4 changes: 2 additions & 2 deletions src/renderers/common/RenderList.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ class RenderList {
/**
* Sorts the internal render lists.
*
* @param {Function} customOpaqueSort - A custom sort function for opaque objects.
* @param {Function} customTransparentSort - A custom sort function for transparent objects.
* @param {function(Any, Any): Number} customOpaqueSort - A custom sort function for opaque objects.
* @param {function(Any, Any): Number} customTransparentSort - A custom sort function for transparent objects.
*/
sort( customOpaqueSort, customTransparentSort ) {

Expand Down
1 change: 0 additions & 1 deletion src/renderers/common/SampledTexture.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class SampledTexture extends Binding {
/**
* Updates the binding.
*
* @param {Number} generation - The generation.
* @return {Boolean} Whether the texture has been updated and must be
* uploaded to the GPU.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/common/StorageTexture.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StorageTexture extends Texture {
/**
* The image object which just represents the texture's dimension.
*
* @type {{width: Number, height:Number}}
* @type {{width: Number, height: Number}}
*/
this.image = { width, height };

Expand Down
6 changes: 3 additions & 3 deletions src/renderers/common/nodes/NodeLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class NodeLibrary {
/**
* A map that maps materials to node materials.
*
* @type {WeakMap<String,NodeMaterial.constructor>}
* @type {Map<String,NodeMaterial.constructor>}
*/
this.materialNodes = new Map();

/**
* A map that maps tone mapping techniques (constants)
* to tone mapping node functions.
*
* @type {WeakMap<Number,Function>}
* @type {Map<Number,Function>}
*/
this.toneMappingNodes = new Map();

Expand Down Expand Up @@ -147,7 +147,7 @@ class NodeLibrary {
* Adds a node class definition for the given type to the provided type library.
*
* @param {Any} nodeClass - The node class definition.
* @param {String} type - The object type.
* @param {Number|String} type - The object type.
* @param {Map} library - The type library.
*/
addType( nodeClass, type, library ) {
Expand Down
1 change: 0 additions & 1 deletion src/renderers/common/nodes/NodeSampledTexture.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class NodeSampledTexture extends SampledTexture {
/**
* Updates the binding.
*
* @param {Number} generation - The generation.
* @return {Boolean} Whether the texture has been updated and must be
* uploaded to the GPU.
*/
Expand Down

0 comments on commit a34d43c

Please sign in to comment.