Просмотр исходного кода

GltfExporter: Improve existing Jsdoc (#30412)

Co-authored-by: Samuel Rigaud <srigaud@duodisplay.com>
Samuel Rigaud 1 год назад
Родитель
Сommit
d188114ede
1 измененных файлов с 26 добавлено и 25 удалено
  1. 26 25
      examples/jsm/exporters/GLTFExporter.js

+ 26 - 25
examples/jsm/exporters/GLTFExporter.js

@@ -191,7 +191,7 @@ class GLTFExporter {
 	/**
 	 * Parse scenes and generate GLTF output
 	 *
-	 * @param  {Scene|THREE.Scenes} input   Scene or Array of THREE.Scenes
+	 * @param  {Scene|Array<Scene>} input   Scene or Array of THREE.Scenes
 	 * @param  {Function} onDone  Callback on completed
 	 * @param  {Function} onError  Callback on errors
 	 * @param  {Object} options options
@@ -343,9 +343,10 @@ function isIdentityMatrix( matrix ) {
 
 /**
  * Get the min and max vectors from the given attribute
+ *
  * @param  {BufferAttribute} attribute Attribute to find the min/max in range from start to start + count
- * @param  {Integer} start
- * @param  {Integer} count
+ * @param  {Number} start Start index
+ * @param  {Number} count Range to cover
  * @return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components)
  */
 function getMinMax( attribute, start, count ) {
@@ -399,8 +400,8 @@ function getMinMax( attribute, start, count ) {
  * Get the required size + padding for a buffer, rounded to the next 4-byte boundary.
  * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#data-alignment
  *
- * @param {Integer} bufferSize The size the original buffer.
- * @returns {Integer} new buffer size with required padding.
+ * @param {Number} bufferSize The size the original buffer. Should be an integer.
+ * @returns {Number} new buffer size with required padding as an integer.
  *
  */
 function getPaddedBufferSize( bufferSize ) {
@@ -413,7 +414,7 @@ function getPaddedBufferSize( bufferSize ) {
  * Returns a buffer aligned to 4-byte boundary.
  *
  * @param {ArrayBuffer} arrayBuffer Buffer to pad
- * @param {Integer} paddingByte (Optional)
+ * @param {Number} [paddingByte=0] Should be an integer
  * @returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer
  */
 function getPaddedArrayBuffer( arrayBuffer, paddingByte = 0 ) {
@@ -545,8 +546,8 @@ class GLTFWriter {
 	/**
 	 * Parse scenes and generate GLTF output
 	 *
-	 * @param {Scene|THREE.Scenes} input   Scene or Array of THREE.Scenes
-	 * @param {Function} onDone  Callback on completed
+	 * @param {Scene|Array<Scene>} input Scene or Array of THREE.Scenes
+	 * @param {Function} onDone Callback on completed
 	 * @param {Object} options options
 	 */
 	async writeAsync( input, onDone, options = {} ) {
@@ -714,7 +715,7 @@ class GLTFWriter {
 	 *
 	 * @param  {Object} attribute
 	 * @param {boolean} [isRelativeCopy=false]
-	 * @return {Integer}
+	 * @return {Number} An integer
 	 */
 	getUID( attribute, isRelativeCopy = false ) {
 
@@ -968,7 +969,7 @@ class GLTFWriter {
 	/**
 	 * Process a buffer to append to the default one.
 	 * @param  {ArrayBuffer} buffer
-	 * @return {Integer}
+	 * @return {0}
 	 */
 	processBuffer( buffer ) {
 
@@ -990,7 +991,7 @@ class GLTFWriter {
 	 * @param  {number} componentType
 	 * @param  {number} start
 	 * @param  {number} count
-	 * @param  {number} target (Optional) Target usage of the BufferView
+	 * @param  {number?} target Target usage of the BufferView
 	 * @return {Object}
 	 */
 	processBufferView( attribute, componentType, start, count, target ) {
@@ -1144,7 +1145,7 @@ class GLTFWriter {
 	/**
 	 * Process and generate a BufferView from an image Blob.
 	 * @param {Blob} blob
-	 * @return {Promise<Integer>}
+	 * @return {Promise<Number>} An integer
 	 */
 	processBufferViewImage( blob ) {
 
@@ -1179,10 +1180,10 @@ class GLTFWriter {
 	/**
 	 * Process attribute to generate an accessor
 	 * @param  {BufferAttribute} attribute Attribute to process
-	 * @param  {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range
-	 * @param  {Integer} start (Optional)
-	 * @param  {Integer} count (Optional)
-	 * @return {Integer|null} Index of the processed accessor on the "accessors" array
+	 * @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
 	 */
 	processAccessor( attribute, geometry, start, count ) {
 
@@ -1277,10 +1278,10 @@ class GLTFWriter {
 	/**
 	 * Process image
 	 * @param  {Image} image to process
-	 * @param  {Integer} format of the image (RGBAFormat)
+	 * @param  {Number} format Identifier of the format (RGBAFormat)
 	 * @param  {Boolean} flipY before writing out the image
 	 * @param  {String} mimeType export format
-	 * @return {Integer}     Index of the processed texture in the "images" array
+	 * @return {Number}     Index of the processed texture in the "images" array
 	 */
 	processImage( image, format, flipY, mimeType = 'image/png' ) {
 
@@ -1417,7 +1418,7 @@ class GLTFWriter {
 	/**
 	 * Process sampler
 	 * @param  {Texture} map Texture to process
-	 * @return {Integer}     Index of the processed texture in the "samplers" array
+	 * @return {Number}      Index of the processed texture in the "samplers" array
 	 */
 	processSampler( map ) {
 
@@ -1439,7 +1440,7 @@ class GLTFWriter {
 	/**
 	 * Process texture
 	 * @param  {Texture} map Map to process
-	 * @return {Integer} Index of the processed texture in the "textures" array
+	 * @return {Promise<Number>} Index of the processed texture in the "textures" array
 	 */
 	async processTextureAsync( map ) {
 
@@ -1485,7 +1486,7 @@ class GLTFWriter {
 	/**
 	 * Process material
 	 * @param  {THREE.Material} material Material to process
-	 * @return {Integer|null} Index of the processed material in the "materials" array
+	 * @return {Promise<Number|null>} Index of the processed material in the "materials" array
 	 */
 	async processMaterialAsync( material ) {
 
@@ -1661,7 +1662,7 @@ class GLTFWriter {
 	/**
 	 * Process mesh
 	 * @param  {THREE.Mesh} mesh Mesh to process
-	 * @return {Integer|null} Index of the processed mesh in the "meshes" array
+	 * @return {Promise<Number|null>} Index of the processed mesh in the "meshes" array
 	 */
 	async processMeshAsync( mesh ) {
 
@@ -2066,7 +2067,7 @@ class GLTFWriter {
 	/**
 	 * Process camera
 	 * @param  {THREE.Camera} camera Camera to process
-	 * @return {Integer}      Index of the processed mesh in the "camera" array
+	 * @return {Number} Index of the processed mesh in the "camera" array
 	 */
 	processCamera( camera ) {
 
@@ -2267,7 +2268,7 @@ class GLTFWriter {
 	/**
 	 * Process Object3D node
 	 * @param  {THREE.Object3D} object Object3D to processNodeAsync
-	 * @return {Integer} Index of the node in the nodes list
+	 * @return {Promise<Number>} Index of the node in the nodes list
 	 */
 	async processNodeAsync( object ) {
 
@@ -2418,7 +2419,7 @@ class GLTFWriter {
 
 	/**
 	 * Creates a Scene to hold a list of objects and parse it
-	 * @param  {Array} objects List of objects to process
+	 * @param  {Array<THREE.Object3D>} objects List of objects to process
 	 */
 	async processObjectsAsync( objects ) {
 

粤ICP备19079148号