Skip to content

Commit d188114

Browse files
s-rigaudSamuel Rigaud
andauthored
GltfExporter: Improve existing Jsdoc (#30412)
Co-authored-by: Samuel Rigaud <[email protected]>
1 parent 2539ed2 commit d188114

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

examples/jsm/exporters/GLTFExporter.js

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class GLTFExporter {
191191
/**
192192
* Parse scenes and generate GLTF output
193193
*
194-
* @param {Scene|THREE.Scenes} input Scene or Array of THREE.Scenes
194+
* @param {Scene|Array<Scene>} input Scene or Array of THREE.Scenes
195195
* @param {Function} onDone Callback on completed
196196
* @param {Function} onError Callback on errors
197197
* @param {Object} options options
@@ -343,9 +343,10 @@ function isIdentityMatrix( matrix ) {
343343

344344
/**
345345
* Get the min and max vectors from the given attribute
346+
*
346347
* @param {BufferAttribute} attribute Attribute to find the min/max in range from start to start + count
347-
* @param {Integer} start
348-
* @param {Integer} count
348+
* @param {Number} start Start index
349+
* @param {Number} count Range to cover
349350
* @return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components)
350351
*/
351352
function getMinMax( attribute, start, count ) {
@@ -399,8 +400,8 @@ function getMinMax( attribute, start, count ) {
399400
* Get the required size + padding for a buffer, rounded to the next 4-byte boundary.
400401
* https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#data-alignment
401402
*
402-
* @param {Integer} bufferSize The size the original buffer.
403-
* @returns {Integer} new buffer size with required padding.
403+
* @param {Number} bufferSize The size the original buffer. Should be an integer.
404+
* @returns {Number} new buffer size with required padding as an integer.
404405
*
405406
*/
406407
function getPaddedBufferSize( bufferSize ) {
@@ -413,7 +414,7 @@ function getPaddedBufferSize( bufferSize ) {
413414
* Returns a buffer aligned to 4-byte boundary.
414415
*
415416
* @param {ArrayBuffer} arrayBuffer Buffer to pad
416-
* @param {Integer} paddingByte (Optional)
417+
* @param {Number} [paddingByte=0] Should be an integer
417418
* @returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer
418419
*/
419420
function getPaddedArrayBuffer( arrayBuffer, paddingByte = 0 ) {
@@ -545,8 +546,8 @@ class GLTFWriter {
545546
/**
546547
* Parse scenes and generate GLTF output
547548
*
548-
* @param {Scene|THREE.Scenes} input Scene or Array of THREE.Scenes
549-
* @param {Function} onDone Callback on completed
549+
* @param {Scene|Array<Scene>} input Scene or Array of THREE.Scenes
550+
* @param {Function} onDone Callback on completed
550551
* @param {Object} options options
551552
*/
552553
async writeAsync( input, onDone, options = {} ) {
@@ -714,7 +715,7 @@ class GLTFWriter {
714715
*
715716
* @param {Object} attribute
716717
* @param {boolean} [isRelativeCopy=false]
717-
* @return {Integer}
718+
* @return {Number} An integer
718719
*/
719720
getUID( attribute, isRelativeCopy = false ) {
720721

@@ -968,7 +969,7 @@ class GLTFWriter {
968969
/**
969970
* Process a buffer to append to the default one.
970971
* @param {ArrayBuffer} buffer
971-
* @return {Integer}
972+
* @return {0}
972973
*/
973974
processBuffer( buffer ) {
974975

@@ -990,7 +991,7 @@ class GLTFWriter {
990991
* @param {number} componentType
991992
* @param {number} start
992993
* @param {number} count
993-
* @param {number} target (Optional) Target usage of the BufferView
994+
* @param {number?} target Target usage of the BufferView
994995
* @return {Object}
995996
*/
996997
processBufferView( attribute, componentType, start, count, target ) {
@@ -1144,7 +1145,7 @@ class GLTFWriter {
11441145
/**
11451146
* Process and generate a BufferView from an image Blob.
11461147
* @param {Blob} blob
1147-
* @return {Promise<Integer>}
1148+
* @return {Promise<Number>} An integer
11481149
*/
11491150
processBufferViewImage( blob ) {
11501151

@@ -1179,10 +1180,10 @@ class GLTFWriter {
11791180
/**
11801181
* Process attribute to generate an accessor
11811182
* @param {BufferAttribute} attribute Attribute to process
1182-
* @param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range
1183-
* @param {Integer} start (Optional)
1184-
* @param {Integer} count (Optional)
1185-
* @return {Integer|null} Index of the processed accessor on the "accessors" array
1183+
* @param {THREE.BufferGeometry?} geometry Geometry used for truncated draw range
1184+
* @param {Number} [start=0]
1185+
* @param {Number} [count=Infinity]
1186+
* @return {Number?} Index of the processed accessor on the "accessors" array
11861187
*/
11871188
processAccessor( attribute, geometry, start, count ) {
11881189

@@ -1277,10 +1278,10 @@ class GLTFWriter {
12771278
/**
12781279
* Process image
12791280
* @param {Image} image to process
1280-
* @param {Integer} format of the image (RGBAFormat)
1281+
* @param {Number} format Identifier of the format (RGBAFormat)
12811282
* @param {Boolean} flipY before writing out the image
12821283
* @param {String} mimeType export format
1283-
* @return {Integer} Index of the processed texture in the "images" array
1284+
* @return {Number} Index of the processed texture in the "images" array
12841285
*/
12851286
processImage( image, format, flipY, mimeType = 'image/png' ) {
12861287

@@ -1417,7 +1418,7 @@ class GLTFWriter {
14171418
/**
14181419
* Process sampler
14191420
* @param {Texture} map Texture to process
1420-
* @return {Integer} Index of the processed texture in the "samplers" array
1421+
* @return {Number} Index of the processed texture in the "samplers" array
14211422
*/
14221423
processSampler( map ) {
14231424

@@ -1439,7 +1440,7 @@ class GLTFWriter {
14391440
/**
14401441
* Process texture
14411442
* @param {Texture} map Map to process
1442-
* @return {Integer} Index of the processed texture in the "textures" array
1443+
* @return {Promise<Number>} Index of the processed texture in the "textures" array
14431444
*/
14441445
async processTextureAsync( map ) {
14451446

@@ -1485,7 +1486,7 @@ class GLTFWriter {
14851486
/**
14861487
* Process material
14871488
* @param {THREE.Material} material Material to process
1488-
* @return {Integer|null} Index of the processed material in the "materials" array
1489+
* @return {Promise<Number|null>} Index of the processed material in the "materials" array
14891490
*/
14901491
async processMaterialAsync( material ) {
14911492

@@ -1661,7 +1662,7 @@ class GLTFWriter {
16611662
/**
16621663
* Process mesh
16631664
* @param {THREE.Mesh} mesh Mesh to process
1664-
* @return {Integer|null} Index of the processed mesh in the "meshes" array
1665+
* @return {Promise<Number|null>} Index of the processed mesh in the "meshes" array
16651666
*/
16661667
async processMeshAsync( mesh ) {
16671668

@@ -2066,7 +2067,7 @@ class GLTFWriter {
20662067
/**
20672068
* Process camera
20682069
* @param {THREE.Camera} camera Camera to process
2069-
* @return {Integer} Index of the processed mesh in the "camera" array
2070+
* @return {Number} Index of the processed mesh in the "camera" array
20702071
*/
20712072
processCamera( camera ) {
20722073

@@ -2267,7 +2268,7 @@ class GLTFWriter {
22672268
/**
22682269
* Process Object3D node
22692270
* @param {THREE.Object3D} object Object3D to processNodeAsync
2270-
* @return {Integer} Index of the node in the nodes list
2271+
* @return {Promise<Number>} Index of the node in the nodes list
22712272
*/
22722273
async processNodeAsync( object ) {
22732274

@@ -2418,7 +2419,7 @@ class GLTFWriter {
24182419

24192420
/**
24202421
* Creates a Scene to hold a list of objects and parse it
2421-
* @param {Array} objects List of objects to process
2422+
* @param {Array<THREE.Object3D>} objects List of objects to process
24222423
*/
24232424
async processObjectsAsync( objects ) {
24242425

0 commit comments

Comments
 (0)