Browse Source

Docs: More JSDoc. (#30719)

Michael Herzog 11 months ago
parent
commit
91213ea614
50 changed files with 2429 additions and 360 deletions
  1. 71 2
      examples/jsm/loaders/3DMLoader.js
  2. 41 3
      examples/jsm/loaders/3MFLoader.js
  3. 30 11
      examples/jsm/loaders/AMFLoader.js
  4. 55 9
      examples/jsm/loaders/BVHLoader.js
  5. 35 0
      examples/jsm/loaders/ColladaLoader.js
  6. 24 0
      examples/jsm/loaders/DDSLoader.js
  7. 73 1
      examples/jsm/loaders/DRACOLoader.js
  8. 39 7
      examples/jsm/loaders/EXRLoader.js
  9. 40 12
      examples/jsm/loaders/FBXLoader.js
  10. 60 2
      examples/jsm/loaders/FontLoader.js
  11. 33 5
      examples/jsm/loaders/GCodeLoader.js
  12. 213 0
      examples/jsm/loaders/GLTFLoader.js
  13. 48 0
      examples/jsm/loaders/HDRCubeTextureLoader.js
  14. 41 0
      examples/jsm/loaders/IESLoader.js
  15. 32 0
      examples/jsm/loaders/KMZLoader.js
  16. 86 18
      examples/jsm/loaders/KTX2Loader.js
  17. 26 6
      examples/jsm/loaders/KTXLoader.js
  18. 112 2
      examples/jsm/loaders/LDrawLoader.js
  19. 46 10
      examples/jsm/loaders/LUT3dlLoader.js
  20. 45 9
      examples/jsm/loaders/LUTCubeLoader.js
  21. 69 30
      examples/jsm/loaders/LUTImageLoader.js
  22. 42 3
      examples/jsm/loaders/LWOLoader.js
  23. 37 0
      examples/jsm/loaders/LottieLoader.js
  24. 35 0
      examples/jsm/loaders/MD2Loader.js
  25. 56 12
      examples/jsm/loaders/MDDLoader.js
  26. 38 33
      examples/jsm/loaders/MTLLoader.js
  27. 33 0
      examples/jsm/loaders/MaterialXLoader.js
  28. 36 5
      examples/jsm/loaders/NRRDLoader.js
  29. 48 1
      examples/jsm/loaders/OBJLoader.js
  30. 47 0
      examples/jsm/loaders/PCDLoader.js
  31. 40 2
      examples/jsm/loaders/PDBLoader.js
  32. 62 32
      examples/jsm/loaders/PLYLoader.js
  33. 23 5
      examples/jsm/loaders/PVRLoader.js
  34. 38 5
      examples/jsm/loaders/RGBELoader.js
  35. 67 1
      examples/jsm/loaders/RGBMLoader.js
  36. 47 38
      examples/jsm/loaders/STLLoader.js
  37. 113 20
      examples/jsm/loaders/SVGLoader.js
  38. 81 61
      examples/jsm/loaders/TDSLoader.js
  39. 22 0
      examples/jsm/loaders/TGALoader.js
  40. 22 0
      examples/jsm/loaders/TIFFLoader.js
  41. 36 2
      examples/jsm/loaders/TTFLoader.js
  42. 33 0
      examples/jsm/loaders/USDZLoader.js
  43. 58 12
      examples/jsm/loaders/UltraHDRLoader.js
  44. 57 0
      examples/jsm/loaders/VOXLoader.js
  45. 32 1
      examples/jsm/loaders/VRMLLoader.js
  46. 38 0
      examples/jsm/loaders/VTKLoader.js
  47. 35 0
      examples/jsm/loaders/XYZLoader.js
  48. 12 0
      src/loaders/CompressedTextureLoader.js
  49. 20 0
      src/loaders/DataTextureLoader.js
  50. 2 0
      utils/docs/jsdoc.config.json

+ 71 - 2
examples/jsm/loaders/3DMLoader.js

@@ -30,12 +30,38 @@ import { EXRLoader } from '../loaders/EXRLoader.js';
 
 const _taskCache = new WeakMap();
 
+/**
+ * A loader for Rhinoceros 3D files and objects.
+ *
+ * Rhinoceros is a 3D modeler used to create, edit, analyze, document, render,
+ * animate, and translate NURBS curves, surfaces, breps, extrusions, point clouds,
+ * as well as polygon meshes and SubD objects. `rhino3dm.js` is compiled to WebAssembly
+ * from the open source geometry library `openNURBS`. The loader currently uses
+ * `rhino3dm.js 8.4.0`.
+ *
+ * ```js
+ * const loader = new Rhino3dmLoader();
+ * loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.0.1' );
+ *
+ * const object = await loader.loadAsync( 'models/3dm/Rhino_Logo.3dm' );
+ * scene.add( object );
+ * ```
+ *
+ * @augments Loader
+ */
 class Rhino3dmLoader extends Loader {
 
+	/**
+	 * Constructs a new Rhino 3DM loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		// internals
+
 		this.libraryPath = '';
 		this.libraryPending = null;
 		this.libraryBinary = null;
@@ -54,6 +80,12 @@ class Rhino3dmLoader extends Loader {
 
 	}
 
+	/**
+	 * Path to a folder containing the JS and WASM libraries.
+	 *
+	 * @param {string} path - The library path to set.
+	 * @return {Rhino3dmLoader} A reference to this loader.
+	 */
 	setLibraryPath( path ) {
 
 		this.libraryPath = path;
@@ -62,6 +94,14 @@ class Rhino3dmLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the maximum number of Web Workers to be used during decoding.
+	 * A lower limit may be preferable if workers are also for other
+	 * tasks in the application.
+	 *
+	 * @param {number} workerLimit - The worker limit.
+	 * @return {Rhino3dmLoader} A reference to this loader.
+	 */
 	setWorkerLimit( workerLimit ) {
 
 		this.workerLimit = workerLimit;
@@ -70,6 +110,15 @@ class Rhino3dmLoader extends Loader {
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded 3DM asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Object3D)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const loader = new FileLoader( this.manager );
@@ -105,12 +154,22 @@ class Rhino3dmLoader extends Loader {
 
 	}
 
+	/**
+	 * Prints debug messages to the browser console.
+	 */
 	debug() {
 
 		console.log( 'Task load: ', this.workerPool.map( ( worker ) => worker._taskLoad ) );
 
 	}
 
+	/**
+	 * Decodes the 3DM asset data with a Web Worker.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw 3DM asset data as an array buffer.
+	 * @param {string} url - The asset URL.
+	 * @return {Promise<Object3D>} A Promise that resolved with the decoded 3D object.
+	 */
 	decodeObjects( buffer, url ) {
 
 		let worker;
@@ -170,6 +229,14 @@ class Rhino3dmLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given 3DM data and passes the loaded 3DM asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {ArrayBuffer} data - The raw 3DM asset data as an array buffer.
+	 * @param {function(Object3D)} onLoad - Executed when the loading process has been finished.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	parse( data, onLoad, onError ) {
 
 		this.decodeObjects( data, '' )
@@ -962,6 +1029,10 @@ class Rhino3dmLoader extends Loader {
 
 	}
 
+	/**
+	 * Frees internal resources. This method should be called
+	 * when the loader is no longer required.
+	 */
 	dispose() {
 
 		for ( let i = 0; i < this.workerPool.length; ++ i ) {
@@ -972,8 +1043,6 @@ class Rhino3dmLoader extends Loader {
 
 		this.workerPool.length = 0;
 
-		return this;
-
 	}
 
 }

+ 41 - 3
examples/jsm/loaders/3MFLoader.js

@@ -24,8 +24,7 @@ import * as fflate from '../libs/fflate.module.js';
 const COLOR_SPACE_3MF = SRGBColorSpace;
 
 /**
- *
- * 3D Manufacturing Format (3MF) specification: https://3mf.io/specification/
+ * A loader for the [3D Manufacturing Format (3MF)]{@link https://3mf.io/specification/} format.
  *
  * The following features from the core specification are supported:
  *
@@ -39,18 +38,46 @@ const COLOR_SPACE_3MF = SRGBColorSpace;
  * - Texture 2D Groups
  * - Color Groups (Vertex Colors)
  * - Metallic Display Properties (PBR)
+ *
+ * ```js
+ * const loader = new ThreeMFLoader();
+ *
+ * const object = await loader.loadAsync( './models/3mf/truck.3mf' );
+ * object.rotation.set( - Math.PI / 2, 0, 0 ); // z-up conversion
+ * scene.add( object );
+ * ```
+ *
+ * @augments Loader
  */
-
 class ThreeMFLoader extends Loader {
 
+	/**
+	 * Constructs a new 3MF loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * An array of available extensions.
+		 *
+		 * @type {Array<Object>}
+		 */
 		this.availableExtensions = [];
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded 3MF asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -85,6 +112,12 @@ class ThreeMFLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given 3MF data and returns the resulting group.
+	 *
+	 * @param {ArrayBuffer} data - The raw 3MF asset data as an array buffer.
+	 * @return {Group} A group representing the parsed asset.
+	 */
 	parse( data ) {
 
 		const scope = this;
@@ -1571,6 +1604,11 @@ class ThreeMFLoader extends Loader {
 
 	}
 
+	/**
+	 * Adds a 3MF extension.
+	 *
+	 * @param {Object} extension - The extension to add.
+	 */
 	addExtension( extension ) {
 
 		this.availableExtensions.push( extension );

+ 30 - 11
examples/jsm/loaders/AMFLoader.js

@@ -11,29 +11,42 @@ import {
 import * as fflate from '../libs/fflate.module.js';
 
 /**
- * Description: Early release of an AMF Loader following the pattern of the
- * example loaders in the three.js project.
+ * A loader for the AMF format.
  *
- * Usage:
- *	const loader = new AMFLoader();
- *	loader.load('/path/to/project.amf', function(objecttree) {
- *		scene.add(objecttree);
- *	});
+ * The loader supports materials, color and ZIP compressed files.
+ * No constellation support (yet).
  *
- * Materials now supported, material colors supported
- * Zip support, requires fflate
- * No constellation support (yet)!
+ * ```js
+ * const loader = new AMFLoader();
  *
+ * const object = await loader.loadAsync( './models/amf/rook.amf' );
+ * scene.add( object );
+ * ```
+ *
+ * @augments Loader
  */
-
 class AMFLoader extends Loader {
 
+	/**
+	 * Constructs a new AMF loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded AMF asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -69,6 +82,12 @@ class AMFLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given AMF data and returns the resulting group.
+	 *
+	 * @param {ArrayBuffer} data - The raw AMF asset data as an array buffer.
+	 * @return {Group} A group representing the parsed asset.
+	 */
 	parse( data ) {
 
 		function loadDocument( data ) {

+ 55 - 9
examples/jsm/loaders/BVHLoader.js

@@ -11,23 +11,65 @@ import {
 } from 'three';
 
 /**
- * Description: reads BVH files and outputs a single Skeleton and an AnimationClip
+ * A loader for the BVH format.
  *
- * Currently only supports bvh files containing a single root.
+ * Imports BVH files and outputs a single {@link Skeleton} and {@link AnimationClip}.
+ * The loader only supports BVH files containing a single root right now.
  *
+ * ```js
+ * const loader = new BVHLoader();
+ * const result = await loader.loadAsync( 'models/bvh/pirouette.bvh' );
+ *
+ * // visualize skeleton
+ * const skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] );
+ * scene.add( result.skeleton.bones[ 0 ] );
+ * scene.add( skeletonHelper );
+ *
+ * // play animation clip
+ * mixer = new THREE.AnimationMixer( result.skeleton.bones[ 0 ] );
+ * mixer.clipAction( result.clip ).play();
+ * ```
+ *
+ * @augments Loader
  */
-
 class BVHLoader extends Loader {
 
+	/**
+	 * Constructs a new BVH loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * Whether to animate bone positions or not.
+		 *
+		 * @type {boolean}
+		 * @default true
+		 */
 		this.animateBonePositions = true;
+
+		/**
+		 * Whether to animate bone rotations or not.
+		 *
+		 * @type {boolean}
+		 * @default true
+		 */
 		this.animateBoneRotations = true;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded BVH asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({skeleton:Skeleton,clip:AnimationClip})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -62,15 +104,19 @@ class BVHLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given BVH data and returns the resulting data.
+	 *
+	 * @param {string} text - The raw BVH data as a string.
+	 * @return {{skeleton:Skeleton,clip:AnimationClip}} An object representing the parsed asset.
+	 */
 	parse( text ) {
 
-		/*
-			reads a string array (lines) from a BVH file
-			and outputs a skeleton structure including motion data
+		// reads a string array (lines) from a BVH file
+		// and outputs a skeleton structure including motion data
 
-			returns thee root node:
-			{ name: '', channels: [], children: [] }
-		*/
+		// returns thee root node:
+		// { name: '', channels: [], children: [] }
 		function readBvh( lines ) {
 
 			// read model structure

+ 35 - 0
examples/jsm/loaders/ColladaLoader.js

@@ -41,8 +41,35 @@ import {
 } from 'three';
 import { TGALoader } from '../loaders/TGALoader.js';
 
+/**
+ * A loader for the Collada format.
+ *
+ * The Collada format is very complex so this loader only supports a subset of what
+ * is defined in the [official specification]{@link https://www.khronos.org/files/collada_spec_1_5.pdf}.
+ *
+ * Assets with a Z-UP coordinate system are transformed it into Y-UP by a simple rotation.
+ * The vertex data are not converted.
+ *
+ * ```js
+ * const loader = new ColladaLoader();
+ *
+ * const result = await loader.loadAsync( './models/collada/elf/elf.dae' );
+ * scene.add( result.scene );
+ * ```
+ *
+ * @augments Loader
+ */
 class ColladaLoader extends Loader {
 
+	/**
+	 * Starts loading from the given URL and passes the loaded Collada asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({scene:Group,animations:Array<AnimationClip>,kinematics:Object})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -79,6 +106,14 @@ class ColladaLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given Collada data and returns a result oject holding the parsed scene,
+	 * an array of animation clips and kinematics.
+	 *
+	 * @param {string} text - The raw Collada data as a string.
+	 * @param {string} path - The asset path.
+	 * @return {{scene:Group,animations:Array<AnimationClip>,kinematics:Object}} An object representing the parsed asset.
+	 */
 	parse( text, path ) {
 
 		function getElementsByTagName( xml, name ) {

+ 24 - 0
examples/jsm/loaders/DDSLoader.js

@@ -9,14 +9,38 @@ import {
 	RGB_BPTC_UNSIGNED_Format
 } from 'three';
 
+/**
+ * A loader for the S3TC texture compression format.
+ *
+ * ```js
+ * const loader = new DDSLoader();
+ *
+ * const map = loader.load( 'textures/compressed/disturb_dxt1_nomip.dds' );
+ * map.colorSpace = THREE.SRGBColorSpace; // only for color textures
+ * ```
+ *
+ * @augments CompressedTextureLoader
+ */
 class DDSLoader extends CompressedTextureLoader {
 
+	/**
+	 * Constructs a new DDS loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Parses the given S3TC texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @param {boolean} loadMipmaps - Whether to load mipmaps or not.
+	 * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data.
+	 */
 	parse( buffer, loadMipmaps ) {
 
 		const dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 };

+ 73 - 1
examples/jsm/loaders/DRACOLoader.js

@@ -11,8 +11,44 @@ import {
 
 const _taskCache = new WeakMap();
 
+/**
+ * A loader for the Draco format.
+ *
+ * [Draco]{@link https://google.github.io/draco/} is an open source library for compressing
+ * and decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller,
+ * at the cost of additional decoding time on the client device.
+ *
+ * Standalone Draco files have a `.drc` extension, and contain vertex positions, normals, colors,
+ * and other attributes. Draco files do not contain materials, textures, animation, or node hierarchies –
+ * to use these features, embed Draco geometry inside of a glTF file. A normal glTF file can be converted
+ * to a Draco-compressed glTF file using [glTF-Pipeline]{@link https://github.com/CesiumGS/gltf-pipeline}.
+ * When using Draco with glTF, an instance of `DRACOLoader` will be used internally by {@link GLTFLoader}.
+ *
+ * It is recommended to create one DRACOLoader instance and reuse it to avoid loading and creating
+ * multiple decoder instances.
+ *
+ * `DRACOLoader` will automatically use either the JS or the WASM decoding library, based on
+ * browser capabilities.
+ *
+ * ```js
+ * const loader = new DRACOLoader();
+ * loader.setDecoderPath( '/examples/jsm/libs/draco/' );
+ *
+ * const geometry = await dracoLoader.loadAsync( 'models/draco/bunny.drc' );
+ * geometry.computeVertexNormals(); // optional
+ *
+ * dracoLoader.dispose();
+ * ```
+ *
+ * @augments Loader
+ */
 class DRACOLoader extends Loader {
 
+	/**
+	 * Constructs a new Draco loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
@@ -42,6 +78,12 @@ class DRACOLoader extends Loader {
 
 	}
 
+	/**
+	 * Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
+	 *
+	 * @param {string} path - The decoder path.
+	 * @return {DRACOLoader} A reference to this loader.
+	 */
 	setDecoderPath( path ) {
 
 		this.decoderPath = path;
@@ -50,6 +92,12 @@ class DRACOLoader extends Loader {
 
 	}
 
+	/**
+	 * Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
+	 *
+	 * @param {{type:('js'|'wasm')}} config - The decoder config.
+	 * @return {DRACOLoader} A reference to this loader.
+	 */
 	setDecoderConfig( config ) {
 
 		this.decoderConfig = config;
@@ -58,6 +106,13 @@ class DRACOLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the maximum number of Web Workers to be used during decoding.
+	 * A lower limit may be preferable if workers are also for other tasks in the application.
+	 *
+	 * @param {number} workerLimit - The worker limit.
+	 * @return {DRACOLoader} A reference to this loader.
+	 */
 	setWorkerLimit( workerLimit ) {
 
 		this.workerLimit = workerLimit;
@@ -66,6 +121,15 @@ class DRACOLoader extends Loader {
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded Draco asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const loader = new FileLoader( this.manager );
@@ -83,13 +147,21 @@ class DRACOLoader extends Loader {
 
 	}
 
-
+	/**
+	 * Parses the given Draco data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw Draco data as an array buffer.
+	 * @param {function(BufferGeometry)} onLoad - Executed when the loading/parsing process has been finished.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	parse( buffer, onLoad, onError = ()=>{} ) {
 
 		this.decodeDracoFile( buffer, onLoad, null, null, SRGBColorSpace, onError ).catch( onError );
 
 	}
 
+	//
+
 	decodeDracoFile( buffer, callback, attributeIDs, attributeTypes, vertexColorSpace = LinearSRGBColorSpace, onError = () => {} ) {
 
 		const taskConfig = {

+ 39 - 7
examples/jsm/loaders/EXRLoader.js

@@ -11,13 +11,8 @@ import {
 } from 'three';
 import * as fflate from '../libs/fflate.module.js';
 
-/**
- * OpenEXR loader currently supports uncompressed, ZIP(S), RLE, PIZ and DWA/B compression.
- * Supports reading as UnsignedByte, HalfFloat and Float type data texture.
- *
- * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita
- * implementation, so I have preserved their copyright notices.
- */
+// Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita
+// implementation, so I have preserved their copyright notices.
 
 // /*
 // Copyright (c) 2014 - 2017, Syoyo Fujita
@@ -84,16 +79,47 @@ import * as fflate from '../libs/fflate.module.js';
 
 // // End of OpenEXR license -------------------------------------------------
 
+
+/**
+ * A loader for the OpenEXR texture format.
+ *
+ * `EXRLoader` currently supports uncompressed, ZIP(S), RLE, PIZ and DWA/B compression.
+ * Supports reading as UnsignedByte, HalfFloat and Float type data texture.
+ *
+ * ```js
+ * const loader = new EXRLoader();
+ * const texture = await loader.loadAsync( 'textures/memorial.exr' );
+ * ```
+ *
+ * @augments DataTextureLoader
+ */
 class EXRLoader extends DataTextureLoader {
 
+	/**
+	 * Constructs a new EXR loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * The texture type.
+		 *
+		 * @type {(HalfFloatType|FloatType)}
+		 * @default HalfFloatType
+		 */
 		this.type = HalfFloatType;
 
 	}
 
+	/**
+	 * Parses the given EXR texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
+	 */
 	parse( buffer ) {
 
 		const USHORT_RANGE = ( 1 << 16 );
@@ -2533,6 +2559,12 @@ class EXRLoader extends DataTextureLoader {
 
 	}
 
+	/**
+	 * Sets the texture type.
+	 *
+	 * @param {(HalfFloatType|FloatType)} value - The texture type to set.
+	 * @return {RGBMLoader} A reference to this loader.
+	 */
 	setDataType( value ) {
 
 		this.type = value;

+ 40 - 12
examples/jsm/loaders/FBXLoader.js

@@ -47,34 +47,55 @@ import {
 import * as fflate from '../libs/fflate.module.js';
 import { NURBSCurve } from '../curves/NURBSCurve.js';
 
+let fbxTree;
+let connections;
+let sceneGraph;
+
 /**
- * Loader loads FBX file and generates Group representing FBX scene.
- * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format
- * Versions lower than this may load but will probably have errors
+ * A loader for the FBX format.
+ *
+ * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format.
+ * Versions lower than this may load but will probably have errors.
  *
  * Needs Support:
- *  Morph normals / blend shape normals
+ * - Morph normals / blend shape normals
  *
  * FBX format references:
- * 	https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html (C++ SDK reference)
+ * - [C++ SDK reference]{@link https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html}
  *
  * Binary format specification:
- *	https://code.blender.org/2013/08/fbx-binary-file-format-specification/
+ * - [FBX binary file format specification]{@link https://code.blender.org/2013/08/fbx-binary-file-format-specification/}
+ *
+ * ```js
+ * const loader = new FBXLoader();
+ * const object = await loader.loadAsync( 'models/fbx/stanford-bunny.fbx' );
+ * scene.add( object );
+ * ```
+ *
+ * @augments Loader
  */
-
-
-let fbxTree;
-let connections;
-let sceneGraph;
-
 class FBXLoader extends Loader {
 
+	/**
+	 * Constructs a new FBX loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded FBX asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -113,6 +134,13 @@ class FBXLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given FBX data and returns the resulting group.
+	 *
+	 * @param {Array} FBXBuffer - The raw FBX data as an array buffer.
+	 * @param {string} path - The URL base path.
+	 * @return {Group} An object representing the parsed asset.
+	 */
 	parse( FBXBuffer, path ) {
 
 		if ( isFbxFormatBinary( FBXBuffer ) ) {

+ 60 - 2
examples/jsm/loaders/FontLoader.js

@@ -4,14 +4,40 @@ import {
 	ShapePath
 } from 'three';
 
+/**
+ * A loader for loading fonts.
+ *
+ * You can convert fonts online using [facetype.js]{@link https://gero3.github.io/facetype.js/}.
+ *
+ * ```js
+ * const loader = new FontLoader();
+ * const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' );
+ * ```
+ *
+ * @augments Loader
+ */
 class FontLoader extends Loader {
 
+	/**
+	 * Constructs a new font loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded font
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Font)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -30,6 +56,12 @@ class FontLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given font data and returns the resulting font.
+	 *
+	 * @param {Object} json - The raw font data as a JSON object.
+	 * @return {Font} The font.
+	 */
 	parse( json ) {
 
 		return new Font( json );
@@ -38,20 +70,46 @@ class FontLoader extends Loader {
 
 }
 
-//
-
+/**
+ * Class representing a font.
+ */
 class Font {
 
+	/**
+	 * Constructs a new font.
+	 *
+	 * @param {Object} data - The font data as JSON.
+	 */
 	constructor( data ) {
 
+		/**
+		 * This flag can be used for type testing.
+		 *
+		 * @type {boolean}
+		 * @readonly
+		 * @default true
+		 */
 		this.isFont = true;
 
 		this.type = 'Font';
 
+		/**
+		 * The font data as JSON.
+		 *
+		 * @type {Object}
+		 */
 		this.data = data;
 
 	}
 
+	/**
+	 * Generates geometry shapes from the given text and size. The result of this method
+	 * should be used with {@link ShapeGeometry} to generate the actual geometry data.
+	 *
+	 * @param {string} text - The text.
+	 * @param {number} [size=100] - The text size.
+	 * @return {Array<Shape>} An array of shapes representing the text.
+	 */
 	generateShapes( text, size = 100 ) {
 
 		const shapes = [];

+ 33 - 5
examples/jsm/loaders/GCodeLoader.js

@@ -9,26 +9,48 @@ import {
 } from 'three';
 
 /**
- * GCodeLoader is used to load gcode files usually used for 3D printing or CNC applications.
+ * A loader for the GCode format.
  *
- * Gcode files are composed by commands used by machines to create objects.
+ * GCode files are usually used for 3D printing or CNC applications.
  *
- * @class GCodeLoader
+ * ```js
+ * const loader = new GCodeLoader();
+ * const object = await loader.loadAsync( 'models/gcode/benchy.gcode' );
+ * scene.add( object );
+ * ```
+ *
+ * @augments Loader
  */
-
 class GCodeLoader extends Loader {
 
 	/**
-	 * @param {Manager} manager Loading manager.
+	 * Constructs a new GCode loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
 	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * Whether to split layers or not.
+		 *
+		 * @type {boolean}
+		 * @default false
+		 */
 		this.splitLayer = false;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded GCode asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -63,6 +85,12 @@ class GCodeLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given GCode data and returns a group with lines.
+	 *
+	 * @param {string} data - The raw Gcode data as a string.
+	 * @return {Group} The parsed GCode asset.
+	 */
 	parse( data ) {
 
 		let state = { x: 0, y: 0, z: 0, e: 0, f: 0, extruding: false, relative: false };

+ 213 - 0
examples/jsm/loaders/GLTFLoader.js

@@ -67,8 +67,62 @@ import {
 } from 'three';
 import { toTrianglesDrawMode } from '../utils/BufferGeometryUtils.js';
 
+/**
+ * A loader for the glTF 2.0 format.
+ *
+ * [glTF]{@link https://www.khronos.org/gltf/} (GL Transmission Format) is an [open format specification]{@link https://github.com/KhronosGroup/glTF/tree/main/specification/2.0}
+ * for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb)
+ * format. External filesstore textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver
+ * one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights,
+ * and/or cameras.
+ *
+ * `GLTFLoader` uses {@link ImageBitmapLoader} whenever possible. Be advised that image bitmaps are not
+ * automatically GC-collected when they are no longer referenced, and they require special handling during
+ * the disposal process.
+ *
+ * `GLTFLoader` supports the following glTF 2.0 extensions:
+ * - KHR_draco_mesh_compression
+ * - KHR_materials_clearcoat
+ * - KHR_materials_dispersion
+ * - KHR_materials_ior
+ * - KHR_materials_specular
+ * - KHR_materials_transmission
+ * - KHR_materials_iridescence
+ * - KHR_materials_unlit
+ * - KHR_materials_volume
+ * - KHR_mesh_quantization
+ * - KHR_lights_punctual
+ * - KHR_texture_basisu
+ * - KHR_texture_transform
+ * - EXT_texture_webp
+ * - EXT_meshopt_compression
+ * - EXT_mesh_gpu_instancing
+ *
+ * The following glTF 2.0 extension is supported by an external user plugin:
+ * - [KHR_materials_variants]{@link https://github.com/takahirox/three-gltf-extensions}
+ * - [MSFT_texture_dds]{@link https://github.com/takahirox/three-gltf-extensions}
+ *
+ * ```js
+ * const loader = new GLTFLoader();
+ *
+ * // Optional: Provide a DRACOLoader instance to decode compressed mesh data
+ * const dracoLoader = new DRACOLoader();
+ * dracoLoader.setDecoderPath( '/examples/jsm/libs/draco/' );
+ * loader.setDRACOLoader( dracoLoader );
+ *
+ * const gltf = await loader.loadAsync( 'models/gltf/duck/duck.gltf' );
+ * scene.add( gltf.scene );
+ * ```
+ *
+ * @augments Loader
+ */
 class GLTFLoader extends Loader {
 
+	/**
+	 * Constructs a new glTF loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
@@ -183,6 +237,15 @@ class GLTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded glTF asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -260,6 +323,13 @@ class GLTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the given Draco loader to this loader. Required for decoding assets
+	 * compressed with the `KHR_draco_mesh_compression` extension.
+	 *
+	 * @param {DRACOLoader} dracoLoader - The Draco loader to set.
+	 * @return {GLTFLoader} A reference to this loader.
+	 */
 	setDRACOLoader( dracoLoader ) {
 
 		this.dracoLoader = dracoLoader;
@@ -267,6 +337,13 @@ class GLTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the given KTX2 loader to this loader. Required for loading KTX2
+	 * compressed textures.
+	 *
+	 * @param {KTX2Loader} ktx2Loader - The KTX2 loader to set.
+	 * @return {GLTFLoader} A reference to this loader.
+	 */
 	setKTX2Loader( ktx2Loader ) {
 
 		this.ktx2Loader = ktx2Loader;
@@ -274,6 +351,13 @@ class GLTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the given meshop decoder. Required for decoding assets
+	 * compressed with the `EXT_meshopt_compression` extension.
+	 *
+	 * @param {Object} meshoptDecoder - The meshopt decoder to set.
+	 * @return {GLTFLoader} A reference to this loader.
+	 */
 	setMeshoptDecoder( meshoptDecoder ) {
 
 		this.meshoptDecoder = meshoptDecoder;
@@ -281,6 +365,14 @@ class GLTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Registers a plugin callback. This API is internally used to implement the various
+	 * glTF extensions but can also used by third-party code to add additional logic
+	 * to the loader.
+	 *
+	 * @param {function(parser:GLTFParser)} callback - The callback function to register.
+	 * @return {GLTFLoader} A reference to this loader.
+	 */
 	register( callback ) {
 
 		if ( this.pluginCallbacks.indexOf( callback ) === - 1 ) {
@@ -293,6 +385,12 @@ class GLTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Unregisters a plugin callback.
+	 *
+	 * @param {Function} callback - The callback function to unregister.
+	 * @return {GLTFLoader} A reference to this loader.
+	 */
 	unregister( callback ) {
 
 		if ( this.pluginCallbacks.indexOf( callback ) !== - 1 ) {
@@ -305,6 +403,14 @@ class GLTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given FBX data and returns the resulting group.
+	 *
+	 * @param {string|ArrayBuffer} data - The raw glTF data.
+	 * @param {string} path - The URL base path.
+	 * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	parse( data, path, onLoad, onError ) {
 
 		let json;
@@ -428,6 +534,14 @@ class GLTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Async version of {@link GLTFLoader#parse}.
+	 *
+	 * @async
+	 * @param {string|ArrayBuffer} data - The raw glTF data.
+	 * @param {string} path - The URL base path.
+	 * @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.
+	 */
 	parseAsync( data, path ) {
 
 		const scope = this;
@@ -511,6 +625,8 @@ const EXTENSIONS = {
  * Punctual Lights Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
+ *
+ * @private
  */
 class GLTFLightsExtension {
 
@@ -647,6 +763,8 @@ class GLTFLightsExtension {
  * Unlit Materials Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit
+ *
+ * @private
  */
 class GLTFMaterialsUnlitExtension {
 
@@ -700,6 +818,8 @@ class GLTFMaterialsUnlitExtension {
  * Materials Emissive Strength Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md
+ *
+ * @private
  */
 class GLTFMaterialsEmissiveStrengthExtension {
 
@@ -739,6 +859,8 @@ class GLTFMaterialsEmissiveStrengthExtension {
  * Clearcoat Materials Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat
+ *
+ * @private
  */
 class GLTFMaterialsClearcoatExtension {
 
@@ -823,6 +945,8 @@ class GLTFMaterialsClearcoatExtension {
  * Materials dispersion Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion
+ *
+ * @private
  */
 class GLTFMaterialsDispersionExtension {
 
@@ -869,6 +993,8 @@ class GLTFMaterialsDispersionExtension {
  * Iridescence Materials Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence
+ *
+ * @private
  */
 class GLTFMaterialsIridescenceExtension {
 
@@ -957,6 +1083,8 @@ class GLTFMaterialsIridescenceExtension {
  * Sheen Materials Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
+ *
+ * @private
  */
 class GLTFMaterialsSheenExtension {
 
@@ -1033,6 +1161,8 @@ class GLTFMaterialsSheenExtension {
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
  * Draft: https://github.com/KhronosGroup/glTF/pull/1698
+ *
+ * @private
  */
 class GLTFMaterialsTransmissionExtension {
 
@@ -1091,6 +1221,8 @@ class GLTFMaterialsTransmissionExtension {
  * Materials Volume Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume
+ *
+ * @private
  */
 class GLTFMaterialsVolumeExtension {
 
@@ -1150,6 +1282,8 @@ class GLTFMaterialsVolumeExtension {
  * Materials ior Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior
+ *
+ * @private
  */
 class GLTFMaterialsIorExtension {
 
@@ -1196,6 +1330,8 @@ class GLTFMaterialsIorExtension {
  * Materials specular Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular
+ *
+ * @private
  */
 class GLTFMaterialsSpecularExtension {
 
@@ -1260,6 +1396,8 @@ class GLTFMaterialsSpecularExtension {
  * Materials bump Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_materials_bump
+ *
+ * @private
  */
 class GLTFMaterialsBumpExtension {
 
@@ -1314,6 +1452,8 @@ class GLTFMaterialsBumpExtension {
  * Materials anisotropy Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_anisotropy
+ *
+ * @private
  */
 class GLTFMaterialsAnisotropyExtension {
 
@@ -1378,6 +1518,8 @@ class GLTFMaterialsAnisotropyExtension {
  * BasisU Texture Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu
+ *
+ * @private
  */
 class GLTFTextureBasisUExtension {
 
@@ -1429,6 +1571,8 @@ class GLTFTextureBasisUExtension {
  * WebP Texture Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp
+ *
+ * @private
  */
 class GLTFTextureWebPExtension {
 
@@ -1514,6 +1658,8 @@ class GLTFTextureWebPExtension {
  * AVIF Texture Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_avif
+ *
+ * @private
  */
 class GLTFTextureAVIFExtension {
 
@@ -1597,6 +1743,8 @@ class GLTFTextureAVIFExtension {
  * meshopt BufferView Compression Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression
+ *
+ * @private
  */
 class GLTFMeshoptCompression {
 
@@ -1682,6 +1830,7 @@ class GLTFMeshoptCompression {
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing
  *
+ * @private
  */
 class GLTFMeshGpuInstancing {
 
@@ -1910,6 +2059,8 @@ class GLTFBinaryExtension {
  * DRACO Mesh Compression Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
+ *
+ * @private
  */
 class GLTFDracoMeshCompressionExtension {
 
@@ -1993,6 +2144,8 @@ class GLTFDracoMeshCompressionExtension {
  * Texture Transform Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform
+ *
+ * @private
  */
 class GLTFTextureTransformExtension {
 
@@ -2052,6 +2205,8 @@ class GLTFTextureTransformExtension {
  * Mesh Quantization Extension
  *
  * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
+ *
+ * @private
  */
 class GLTFMeshQuantizationExtension {
 
@@ -2254,6 +2409,7 @@ const ALPHA_MODES = {
 /**
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
  *
+ * @private
  * @param {Object<string, Material>} cache
  * @return {Material}
  */
@@ -2295,6 +2451,8 @@ function addUnknownExtensionsToUserData( knownExtensions, object, objectDef ) {
 }
 
 /**
+ *
+ * @private
  * @param {Object3D|Material|BufferGeometry|Object} object
  * @param {GLTF.definition} gltfDef
  */
@@ -2319,6 +2477,7 @@ function assignExtrasToUserData( object, gltfDef ) {
 /**
  * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
  *
+ * @private
  * @param {BufferGeometry} geometry
  * @param {Array<GLTF.Target>} targets
  * @param {GLTFParser} parser
@@ -2406,6 +2565,8 @@ function addMorphTargets( geometry, targets, parser ) {
 }
 
 /**
+ *
+ * @private
  * @param {Mesh} mesh
  * @param {GLTF.Mesh} meshDef
  */
@@ -2694,6 +2855,8 @@ class GLTFParser {
 
 	/**
 	 * Marks the special nodes/meshes in json for efficient parse.
+	 *
+	 * @private
 	 */
 	_markDefs() {
 
@@ -2755,6 +2918,7 @@ class GLTFParser {
 	 *
 	 * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
 	 *
+	 * @private
 	 * @param {Object} cache
 	 * @param {Object3D} index
 	 */
@@ -2775,6 +2939,7 @@ class GLTFParser {
 	/**
 	 * Returns a reference to a shared resource, cloning it if necessary.
 	 *
+	 * @private
 	 * @param {Object} cache
 	 * @param {number} index
 	 * @param {Object} object
@@ -2851,6 +3016,8 @@ class GLTFParser {
 
 	/**
 	 * Requests the specified dependency asynchronously, with caching.
+	 *
+	 * @private
 	 * @param {string} type
 	 * @param {number} index
 	 * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
@@ -2959,6 +3126,8 @@ class GLTFParser {
 
 	/**
 	 * Requests all dependencies of the specified type asynchronously, with caching.
+	 *
+	 * @private
 	 * @param {string} type
 	 * @return {Promise<Array<Object>>}
 	 */
@@ -2987,6 +3156,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
+	 *
+	 * @private
 	 * @param {number} bufferIndex
 	 * @return {Promise<ArrayBuffer>}
 	 */
@@ -3024,6 +3195,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
+	 *
+	 * @private
 	 * @param {number} bufferViewIndex
 	 * @return {Promise<ArrayBuffer>}
 	 */
@@ -3043,6 +3216,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
+	 *
+	 * @private
 	 * @param {number} accessorIndex
 	 * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
 	 */
@@ -3182,6 +3357,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
+	 *
+	 * @private
 	 * @param {number} textureIndex
 	 * @return {Promise<THREE.Texture|null>}
 	 */
@@ -3352,6 +3529,7 @@ class GLTFParser {
 	/**
 	 * Asynchronously assigns a texture to the given material parameters.
 	 *
+	 * @private
 	 * @param {Object} materialParams
 	 * @param {string} mapName
 	 * @param {Object} mapDef
@@ -3407,6 +3585,8 @@ class GLTFParser {
 	 * but reuse of the same glTF material may require multiple threejs materials
 	 * to accommodate different primitive types, defines, etc. New materials will
 	 * be created if necessary, and reused from a cache.
+	 *
+	 * @private
 	 * @param  {Object3D} mesh Mesh, Line, or Points instance.
 	 */
 	assignFinalMaterial( mesh ) {
@@ -3507,6 +3687,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
+	 *
+	 * @private
 	 * @param {number} materialIndex
 	 * @return {Promise<Material>}
 	 */
@@ -3667,6 +3849,7 @@ class GLTFParser {
 	/**
 	 * When Object3D instances are targeted by animation, they need unique names.
 	 *
+	 * @private
 	 * @param {string} originalName
 	 * @return {string}
 	 */
@@ -3693,6 +3876,7 @@ class GLTFParser {
 	 *
 	 * Creates BufferGeometries from primitives.
 	 *
+	 * @private
 	 * @param {Array<GLTF.Primitive>} primitives
 	 * @return {Promise<Array<BufferGeometry>>}
 	 */
@@ -3760,6 +3944,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
+	 *
+	 * @private
 	 * @param {number} meshIndex
 	 * @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
 	 */
@@ -3908,6 +4094,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
+	 *
+	 * @private
 	 * @param {number} cameraIndex
 	 * @return {Promise<THREE.Camera>}
 	 */
@@ -3944,6 +4132,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
+	 *
+	 * @private
 	 * @param {number} skinIndex
 	 * @return {Promise<Skeleton>}
 	 */
@@ -4014,6 +4204,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
+	 *
+	 * @private
 	 * @param {number} animationIndex
 	 * @return {Promise<AnimationClip>}
 	 */
@@ -4141,6 +4333,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
+	 *
+	 * @private
 	 * @param {number} nodeIndex
 	 * @return {Promise<Object3D>}
 	 */
@@ -4348,6 +4542,8 @@ class GLTFParser {
 
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
+	 *
+	 * @private
 	 * @param {number} sceneIndex
 	 * @return {Promise<Group>}
 	 */
@@ -4562,6 +4758,8 @@ class GLTFParser {
 }
 
 /**
+ *
+ * @private
  * @param {BufferGeometry} geometry
  * @param {GLTF.Primitive} primitiveDef
  * @param {GLTFParser} parser
@@ -4677,6 +4875,8 @@ function computeBounds( geometry, primitiveDef, parser ) {
 }
 
 /**
+ *
+ * @private
  * @param {BufferGeometry} geometry
  * @param {GLTF.Primitive} primitiveDef
  * @param {GLTFParser} parser
@@ -4742,4 +4942,17 @@ function addPrimitiveAttributes( geometry, primitiveDef, parser ) {
 
 }
 
+/**
+ * Loader result of `GLTFLoader`.
+ *
+ * @typedef {Object} GLTFLoader~LoadObject
+ * @property {Array<AnimationClip>} animations - An array of animation clips.
+ * @property {Object} asset - Meta data about the loaded asset.
+ * @property {Array<Camera>} cameras - An array of cameras.
+ * @property {GLTFParser} parser - A reference to the internal parser.
+ * @property {Group} scene - The default scene.
+ * @property {Array<Group>} scenes - glTF assets might define multiple scenes.
+ * @property {Object} userData - Additional data.
+ **/
+
 export { GLTFLoader };

+ 48 - 0
examples/jsm/loaders/HDRCubeTextureLoader.js

@@ -10,17 +10,59 @@ import {
 } from 'three';
 import { RGBELoader } from '../loaders/RGBELoader.js';
 
+/**
+ * A loader for loading HDR cube textures.
+ *
+ * ```js
+ * const loader = new HDRCubeTextureLoader();
+ * loader.setPath( 'textures/cube/pisaHDR/' );
+ * const cubeTexture = await loader.loadAsync( [ 'px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr' ] );
+ *
+ * scene.background = cubeTexture;
+ * scene.environment = cubeTexture;
+ * ```
+ *
+ * @augments Loader
+ */
 class HDRCubeTextureLoader extends Loader {
 
+	/**
+	 * Constructs a new HDR cube texture loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * The internal HDR loader that loads the
+		 * individual textures for each cube face.
+		 *
+		 * @type {RGBELoader}
+		 */
 		this.hdrLoader = new RGBELoader();
+
+		/**
+		 * The texture type.
+		 *
+		 * @type {(HalfFloatType|FloatType)}
+		 * @default HalfFloatType
+		 */
 		this.type = HalfFloatType;
 
 	}
 
+	/**
+	 * Starts loading from the given URLs and passes the loaded HDR cube texture
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {Array<string>} urls - The paths/URLs of the files to be loaded. This can also be a data URIs.
+	 * @param {function(CubeTexture)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 * @return {CubeTexture} The HDR cube texture.
+	 */
 	load( urls, onLoad, onProgress, onError ) {
 
 		const texture = new CubeTexture();
@@ -101,6 +143,12 @@ class HDRCubeTextureLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the texture type.
+	 *
+	 * @param {(HalfFloatType|FloatType)} value - The texture type to set.
+	 * @return {RGBELoader} A reference to this loader.
+	 */
 	setDataType( value ) {
 
 		this.type = value;

+ 41 - 0
examples/jsm/loaders/IESLoader.js

@@ -11,12 +11,38 @@ import {
 	DataUtils
 } from 'three';
 
+/**
+ * A loader for the IES format.
+ *
+ * The loaded texture should be assigned to {@link IESSpotLight#map}.
+ *
+ * ```js
+ * const loader = new IESLoader();
+ * const texture = await loader.loadAsync( 'ies/007cfb11e343e2f42e3b476be4ab684e.ies' );
+ *
+ * const spotLight = new THREE.IESSpotLight( 0xff0000, 500 );
+ * spotLight.iesMap = texture;
+ * ```
+ *
+ * @augments Loader
+ */
 class IESLoader extends Loader {
 
+	/**
+	 * Constructs a new IES loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * The texture type.
+		 *
+		 * @type {(HalfFloatType|FloatType)}
+		 * @default HalfFloatType
+		 */
 		this.type = HalfFloatType;
 
 	}
@@ -112,6 +138,15 @@ class IESLoader extends Loader {
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded IES texture
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(DataTexture)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const loader = new FileLoader( this.manager );
@@ -129,6 +164,12 @@ class IESLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given IES data.
+	 *
+	 * @param {string} text - The raw IES data.
+	 * @return {DataTexture} THE IES data as a texutre.
+	 */
 	parse( text ) {
 
 		const type = this.type;

+ 32 - 0
examples/jsm/loaders/KMZLoader.js

@@ -7,14 +7,40 @@ import {
 import { ColladaLoader } from '../loaders/ColladaLoader.js';
 import * as fflate from '../libs/fflate.module.js';
 
+/**
+ * A loader for the KMZ format.
+ *
+ * ```js
+ * const loader = new KMZLoader();
+ * const kmz = await loader.loadAsync( './models/kmz/Box.kmz' );
+ *
+ * scene.add( kmz.scene );
+ * ```
+ *
+ * @augments Loader
+ */
 class KMZLoader extends Loader {
 
+	/**
+	 * Constructs a new KMZ loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded KMZ asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({scene:Group})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -50,6 +76,12 @@ class KMZLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given KMZ data and returns an object holding the scene.
+	 *
+	 * @param {ArrayBuffer} data - The raw KMZ data as an array buffer.
+	 * @return {{scene:Group}} The parsed KMZ asset.
+	 */
 	parse( data ) {
 
 		function findFile( url ) {

+ 86 - 18
examples/jsm/loaders/KTX2Loader.js

@@ -1,17 +1,3 @@
-/**
- * Loader for KTX 2.0 GPU Texture containers.
- *
- * KTX 2.0 is a container format for various GPU texture formats. The loader
- * supports Basis Universal GPU textures, which can be quickly transcoded to
- * a wide variety of GPU texture compression formats, as well as some
- * uncompressed DataTexture and Data3DTexture formats.
- *
- * References:
- * - KTX: http://github.khronos.org/KTX-Specification/
- * - DFD: https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor
- * - BasisU HDR: https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0
- */
-
 import {
 	CompressedTexture,
 	CompressedArrayTexture,
@@ -79,8 +65,39 @@ let _activeLoaders = 0;
 
 let _zstd;
 
+/**
+ * A loader for KTX 2.0 GPU Texture containers.
+ *
+ * KTX 2.0 is a container format for various GPU texture formats. The loader supports Basis Universal GPU textures,
+ * which can be quickly transcoded to a wide variety of GPU texture compression formats. While KTX 2.0 also allows
+ * other hardware-specific formats, this loader does not yet parse them.
+ *
+ * This loader parses the KTX 2.0 container and transcodes to a supported GPU compressed texture format.
+ * The required WASM transcoder and JS wrapper are available from the `examples/jsm/libs/basis` directory.
+ *
+ * This loader relies on Web Assembly which is not supported in older browsers.
+ *
+ * References:
+ * - [KTX specification]{@link http://github.khronos.org/KTX-Specification/}
+ * - [DFD]{@link https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor}
+ * - [BasisU HDR]{@link https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0}
+ *
+ * ```js
+ * const loader = new KTX2Loader();
+ * loader.setTranscoderPath( 'examples/jsm/libs/basis/' );
+ * loader.detectSupport( renderer );
+ * const texture = loader.loadAsync( 'diffuse.ktx2' );
+ * ```
+ *
+ * @augments Loader
+ */
 class KTX2Loader extends Loader {
 
+	/**
+	 * Constructs a new KTX2 loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
@@ -106,6 +123,14 @@ class KTX2Loader extends Loader {
 
 	}
 
+	/**
+	 * Sets the transcoder path.
+	 *
+	 * The WASM transcoder and JS wrapper are available from the `examples/jsm/libs/basis` directory.
+	 *
+	 * @param {string} path - The transcoder path to set.
+	 * @return {KTX2Loader} A reference to this loader.
+	 */
 	setTranscoderPath( path ) {
 
 		this.transcoderPath = path;
@@ -114,14 +139,28 @@ class KTX2Loader extends Loader {
 
 	}
 
-	setWorkerLimit( num ) {
+	/**
+	 * Sets the maximum number of Web Workers to be allocated by this instance.
+	 *
+	 * @param {number} workerLimit - The worker limit.
+	 * @return {KTX2Loader} A reference to this loader.
+	 */
+	setWorkerLimit( workerLimit ) {
 
-		this.workerPool.setWorkerLimit( num );
+		this.workerPool.setWorkerLimit( workerLimit );
 
 		return this;
 
 	}
 
+
+	/**
+	 * Async version of {@link KTX2Loader#detectSupport}.
+	 *
+	 * @async
+	 * @param {WebGPURenderer|WebGLRenderer} renderer - The renderer.
+	 * @return {Promise} A Promise that resolves when the support has been detected.
+	 */
 	async detectSupportAsync( renderer ) {
 
 		this.workerConfig = {
@@ -138,6 +177,13 @@ class KTX2Loader extends Loader {
 
 	}
 
+	/**
+	 * Detects hardware support for available compressed texture formats, to determine
+	 * the output format for the transcoder. Must be called before loading a texture.
+	 *
+	 * @param {WebGPURenderer|WebGLRenderer} renderer - The renderer.
+	 * @return {KTX2Loader} A reference to this loader.
+	 */
 	detectSupport( renderer ) {
 
 		if ( renderer.isWebGPURenderer === true ) {
@@ -172,6 +218,8 @@ class KTX2Loader extends Loader {
 
 	}
 
+	// TODO: Make this method private
+
 	init() {
 
 		if ( ! this.transcoderPending ) {
@@ -243,6 +291,15 @@ class KTX2Loader extends Loader {
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded KTX2 texture
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(CompressedTexture)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		if ( this.workerConfig === null ) {
@@ -264,6 +321,14 @@ class KTX2Loader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given KTX2 data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw KTX2 data as an array buffer.
+	 * @param {function(CompressedTexture)} onLoad - Executed when the loading/parsing process has been finished.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 * @returns {Promise} A Promise that resolves when the parsing has been finished.
+	 */
 	parse( buffer, onLoad, onError ) {
 
 		if ( this.workerConfig === null ) {
@@ -323,6 +388,7 @@ class KTX2Loader extends Loader {
 	}
 
 	/**
+	 * @private
 	 * @param {ArrayBuffer} buffer
 	 * @param {?Object} config
 	 * @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
@@ -364,6 +430,10 @@ class KTX2Loader extends Loader {
 
 	}
 
+	/**
+	 * Frees internal resources. This method should be called
+	 * when the loader is no longer required.
+	 */
 	dispose() {
 
 		this.workerPool.dispose();
@@ -371,8 +441,6 @@ class KTX2Loader extends Loader {
 
 		_activeLoaders --;
 
-		return this;
-
 	}
 
 }

+ 26 - 6
examples/jsm/loaders/KTXLoader.js

@@ -3,21 +3,41 @@ import {
 } from 'three';
 
 /**
- * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
- * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
+ * A loader for the KTX texture compression format.
  *
- * ported from https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts
+ * References:
+ * - [The KTX File Format and Tools]{@link https://www.khronos.org/opengles/sdk/tools/KTX/}
+ * - [Babylon.JS khronosTextureContainer.ts]{@link https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts}
+ *
+ * ```js
+ * const loader = new KTXLoader();
+ *
+ * const map = loader.load( 'textures/compressed/lensflare_ASTC8x8.ktx' )
+ * map.colorSpace = THREE.SRGBColorSpace; // only for color textures
+ * ```
+ *
+ * @augments CompressedTextureLoader
  */
-
-
 class KTXLoader extends CompressedTextureLoader {
 
+	/**
+	 * Constructs a new KTX loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Parses the given KTX texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @param {boolean} loadMipmaps - Whether to load mipmaps or not.
+	 * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data.
+	 */
 	parse( buffer, loadMipmaps ) {
 
 		const ktx = new KhronosTextureContainer( buffer, 1 );
@@ -35,7 +55,6 @@ class KTXLoader extends CompressedTextureLoader {
 
 }
 
-
 const HEADER_LEN = 12 + ( 13 * 4 ); // identifier + header elements (not including key value meta-data pairs)
 // load types
 const COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
@@ -46,6 +65,7 @@ const COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
 class KhronosTextureContainer {
 
 	/**
+	 * @private
 	 * @param {ArrayBuffer} arrayBuffer - contents of the KTX container file
 	 * @param {number} facesExpected - should be either 1 or 6, based whether a cube texture or or
 	 * @param {boolean} threeDExpected - provision for indicating that data should be a 3D texture, not implemented

+ 112 - 2
examples/jsm/loaders/LDrawLoader.js

@@ -1746,10 +1746,44 @@ function createObject( loader, elements, elementSize, isConditionalSegments = fa
 
 }
 
-//
-
+/**
+ * A loader for the LDraw format.
+ *
+ * [LDraw]{@link https://ldraw.org/} (LEGO Draw) is an [open format specification]{@link https://ldraw.org/article/218.html}
+ * for describing LEGO and other construction set 3D models.
+ *
+ * An LDraw asset (a text file usually with extension .ldr, .dat or .txt) can describe just a single construction
+ * piece, or an entire model. In the case of a model the LDraw file can reference other LDraw files, which are
+ * loaded from a library path set with `setPartsLibraryPath`. You usually download the LDraw official parts library,
+ * extract to a folder and point setPartsLibraryPath to it.
+ *
+ * Library parts will be loaded by trial and error in subfolders 'parts', 'p' and 'models'. These file accesses
+ * are not optimal for web environment, so a script tool has been made to pack an LDraw file with all its dependencies
+ * into a single file, which loads much faster. See section 'Packing LDraw models'. The LDrawLoader example loads
+ * several packed files. The official parts library is not included due to its large size.
+ *
+ * `LDrawLoader` supports the following extensions:
+ * - !COLOUR: Color and surface finish declarations.
+ * - BFC: Back Face Culling specification.
+ * - !CATEGORY: Model/part category declarations.
+ * - !KEYWORDS: Model/part keywords declarations.
+ *
+ * ```js
+ * const loader = new LDrawLoader();
+ * loader.setConditionalLineMaterial( LDrawConditionalLineMaterial ); // the type of line material depends on the used renderer
+ * const object = await loader.loadAsync( 'models/ldraw/officialLibrary/models/car.ldr_Packed.mpd' );
+ * scene.add( object );
+ * ```
+ *
+ * @augments Loader
+ */
 class LDrawLoader extends Loader {
 
+	/**
+	 * Constructs a new LDraw loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
@@ -1784,6 +1818,14 @@ class LDrawLoader extends Loader {
 
 	}
 
+	/**
+	 * This method must be called prior to `load()` unless the model to load does not reference
+	 * library parts (usually it will be a model with all its parts packed in a single file).
+	 *
+	 * @param {string} path - Path to library parts files to load referenced parts from.
+	 * This is different from Loader.setPath, which indicates the path to load the main asset from.
+	 * @return {LDrawLoader} A reference to this loader.
+	 */
 	setPartsLibraryPath( path ) {
 
 		this.partsLibraryPath = path;
@@ -1791,6 +1833,14 @@ class LDrawLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the conditional line material type which depends on the used renderer.
+	 * Use {@link LDrawConditionalLineMaterial} when using `WebGLRenderer` and
+	 * {@link LDrawConditionalLineNodeMaterial} when using `WebGPURenderer`.
+	 *
+	 * @param {(LDrawConditionalLineMaterial.constructor|LDrawConditionalLineNodeMaterial.constructor)} type - The conditional line material type.
+	 * @return {LDrawLoader} A reference to this loader.
+	 */
 	setConditionalLineMaterial( type ) {
 
 		this.ConditionalLineMaterial = type;
@@ -1799,6 +1849,17 @@ class LDrawLoader extends Loader {
 
 	}
 
+	/**
+	 * This async method preloads materials from a single LDraw file. In the official
+	 * parts library there is a special file which is loaded always the first (LDConfig.ldr)
+	 * and contains all the standard color codes. This method is intended to be used with
+	 * not packed files, for example in an editor where materials are preloaded and parts
+	 * are loaded on demand.
+	 *
+	 * @async
+	 * @param {string} url - Path of the LDraw materials asset.
+	 * @return {Promise} A Promise that resolves when the preload has finished.
+	 */
 	async preloadMaterials( url ) {
 
 		const fileLoader = new FileLoader( this.manager );
@@ -1827,6 +1888,15 @@ class LDrawLoader extends Loader {
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded LDraw asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const fileLoader = new FileLoader( this.manager );
@@ -1854,6 +1924,13 @@ class LDrawLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given LDraw data and returns the resulting group.
+	 *
+	 * @param {string} text - The raw VRML data as a string.
+	 * @param {function(Group)} onLoad - Executed when the loading/parsing process has been finished.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	parse( text, onLoad, onError ) {
 
 		this.partsCache
@@ -1888,6 +1965,14 @@ class LDrawLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets a map which maps referenced library filenames to new filenames.
+	 * If a fileMap is not specified (the default), library parts will be accessed by trial and
+	 * error in subfolders 'parts', 'p' and 'models'.
+	 *
+	 * @param {Object<string,string>} fileMap - The file map to set.
+	 * @return {LDrawLoader} A reference to this loader.
+	 */
 	setFileMap( fileMap ) {
 
 		this.fileMap = fileMap;
@@ -1912,6 +1997,12 @@ class LDrawLoader extends Loader {
 
 	}
 
+	/**
+	 * Returns a material for the given color code.
+	 *
+	 * @param {string} colorCode - The color code.
+	 * @return {?Material} The material. Returns `null` if no material has been found.
+	 */
 	getMaterial( colorCode ) {
 
 		if ( colorCode.startsWith( '0x2' ) ) {
@@ -2027,12 +2118,31 @@ class LDrawLoader extends Loader {
 
 	}
 
+	/**
+	 * Returns the Material for the main LDraw color.
+	 *
+	 * For an already loaded LDraw asset, returns the Material associated with the main color code.
+	 * This method can be useful to modify the main material of a model or part that exposes it.
+	 *
+	 * The main color code is the standard way to color an LDraw part. It is '16' for triangles and
+	 * '24' for edges. Usually a complete model will not expose the main color (that is, no part
+	 * uses the code '16' at the top level, because they are assigned other specific colors) An LDraw
+	 *  part file on the other hand will expose the code '16' to be colored, and can have additional
+	 * fixed colors.
+	 *
+	 * @return {?Material} The material. Returns `null` if no material has been found.
+	 */
 	getMainMaterial() {
 
 		return this.getMaterial( MAIN_COLOUR_CODE );
 
 	}
 
+	/**
+	 * Returns the material for the edges main LDraw color.
+	 *
+	 * @return {?Material} The material. Returns `null` if no material has been found.
+	 */
 	getMainEdgeMaterial() {
 
 		const mat = this.getMaterial( MAIN_EDGE_COLOUR_CODE );

+ 46 - 10
examples/jsm/loaders/LUT3dlLoader.js

@@ -1,41 +1,71 @@
-// http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492
-// https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258
-
 import {
 	ClampToEdgeWrapping,
 	Data3DTexture,
 	FileLoader,
-	FloatType,
 	LinearFilter,
 	Loader,
 	RGBAFormat,
 	UnsignedByteType,
 } from 'three';
 
+/**
+ * A loader for the 3DL LUT format.
+ *
+ * References:
+ * - [3D LUTs]{@link http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492}
+ * - [Format Spec for .3dl]{@link https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258}
+ *
+ * ```js
+ * const loader = new LUT3dlLoader();
+ * const map = loader.loadAsync( 'luts/Presetpro-Cinematic.3dl' );
+ * ```
+ *
+ * @augments Loader
+ */
 export class LUT3dlLoader extends Loader {
 
+	/**
+	 * Constructs a new 3DL LUT loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * The texture type.
+		 *
+		 * @type {(UnsignedByteType|FloatType)}
+		 * @default UnsignedByteType
+		 */
 		this.type = UnsignedByteType;
 
 	}
 
+	/**
+	 * Sets the texture type.
+	 *
+	 * @param {(UnsignedByteType|FloatType)} type - The texture type to set.
+	 * @return {LUT3dlLoader} A reference to this loader.
+	 */
 	setType( type ) {
 
-		if ( type !== UnsignedByteType && type !== FloatType ) {
-
-			throw new Error( 'LUT3dlLoader: Unsupported type' );
-
-		}
-
 		this.type = type;
 
 		return this;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded 3DL LUT asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({size:number,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const loader = new FileLoader( this.manager );
@@ -67,6 +97,12 @@ export class LUT3dlLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given 3DL LUT data and returns the resulting 3D data texture.
+	 *
+	 * @param {string} input - The raw 3DL LUT data as a string.
+	 * @return {{size:number,texture3D:Data3DTexture}} The parsed 3DL LUT.
+	 */
 	parse( input ) {
 
 		const regExpGridInfo = /^[\d ]+$/m;

+ 45 - 9
examples/jsm/loaders/LUTCubeLoader.js

@@ -1,40 +1,70 @@
-// https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf
-
 import {
 	ClampToEdgeWrapping,
 	Data3DTexture,
 	FileLoader,
-	FloatType,
 	LinearFilter,
 	Loader,
 	UnsignedByteType,
 	Vector3,
 } from 'three';
 
+/**
+ * A loader for the Cube LUT format.
+ *
+ * References:
+ * - [Cube LUT Specification]{@link https://web.archive.org/web/20220220033515/https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf}
+ *
+ * ```js
+ * const loader = new LUTCubeLoader();
+ * const map = loader.loadAsync( 'luts/Bourbon 64.CUBE' );
+ * ```
+ *
+ * @augments Loader
+ */
 export class LUTCubeLoader extends Loader {
 
+	/**
+	 * Constructs a new Cube LUT loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * The texture type.
+		 *
+		 * @type {(UnsignedByteType|FloatType)}
+		 * @default UnsignedByteType
+		 */
 		this.type = UnsignedByteType;
 
 	}
 
+	/**
+	 * Sets the texture type.
+	 *
+	 * @param {(UnsignedByteType|FloatType)} type - The texture type to set.
+	 * @return {LUTCubeLoader} A reference to this loader.
+	 */
 	setType( type ) {
 
-		if ( type !== UnsignedByteType && type !== FloatType ) {
-
-			throw new Error( 'LUTCubeLoader: Unsupported type' );
-
-		}
-
 		this.type = type;
 
 		return this;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded Cube LUT asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({title:string,size:number,domainMin:Vector3,domainMax:Vector3,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const loader = new FileLoader( this.manager );
@@ -66,6 +96,12 @@ export class LUTCubeLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given Cube LUT data and returns the resulting 3D data texture.
+	 *
+	 * @param {string} input - The raw Cube LUT data as a string.
+	 * @return {{title:string,size:number,domainMin:Vector3,domainMax:Vector3,texture3D:Data3DTexture}} The parsed Cube LUT.
+	 */
 	parse( input ) {
 
 		const regExpTitle = /TITLE +"([^"]*)"/;

+ 69 - 30
examples/jsm/loaders/LUTImageLoader.js

@@ -8,8 +8,23 @@ import {
 	LinearFilter,
 } from 'three';
 
+/**
+ * A loader for loading LUT images.
+ *
+ * ```js
+ * const loader = new LUTImageLoader();
+ * const map = loader.loadAsync( 'luts/NeutralLUT.png' );
+ * ```
+ *
+ * @augments Loader
+ */
 export class LUTImageLoader extends Loader {
 
+	/**
+	 * Constructs a new LUT loader.
+	 *
+	 * @param {boolean} [flipVertical=false] - Whether to vertically flip the LUT or not.
+	 */
 	constructor( flipVertical = false ) {
 
 		//The NeutralLUT.png has green at the bottom for Unreal ang green at the top for Unity URP Color Lookup
@@ -17,10 +32,25 @@ export class LUTImageLoader extends Loader {
 
 		super();
 
+		/**
+		 * Whether to vertically flip the LUT or not.
+		 *
+		 * @type {boolean}
+		 * @default false
+		 */
 		this.flip = flipVertical;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded LUT
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({size:number,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const loader = new TextureLoader( this.manager );
@@ -36,11 +66,11 @@ export class LUTImageLoader extends Loader {
 
 				if ( texture.image.width < texture.image.height ) {
 
-					imageData = this.getImageData( texture );
+					imageData = this._getImageData( texture );
 
 				} else {
 
-					imageData = this.horz2Vert( texture );
+					imageData = this._horz2Vert( texture );
 
 				}
 
@@ -66,7 +96,42 @@ export class LUTImageLoader extends Loader {
 
 	}
 
-	getImageData( texture ) {
+	/**
+	 * Parses the given LUT data and returns the resulting 3D data texture.
+	 *
+	 * @param {Uint8ClampedArray} dataArray - The raw LUT data.
+	 * @param {number} size - The LUT size.
+	 * @return {{size:number,texture3D:Data3DTexture}} An object representing the parsed LUT.
+	 */
+	parse( dataArray, size ) {
+
+		const data = new Uint8Array( dataArray );
+
+		const texture3D = new Data3DTexture();
+		texture3D.image.data = data;
+		texture3D.image.width = size;
+		texture3D.image.height = size;
+		texture3D.image.depth = size;
+		texture3D.format = RGBAFormat;
+		texture3D.type = UnsignedByteType;
+		texture3D.magFilter = LinearFilter;
+		texture3D.minFilter = LinearFilter;
+		texture3D.wrapS = ClampToEdgeWrapping;
+		texture3D.wrapT = ClampToEdgeWrapping;
+		texture3D.wrapR = ClampToEdgeWrapping;
+		texture3D.generateMipmaps = false;
+		texture3D.needsUpdate = true;
+
+		return {
+			size,
+			texture3D,
+		};
+
+	}
+
+	// internal
+
+	_getImageData( texture ) {
 
 		const width = texture.image.width;
 		const height = texture.image.height;
@@ -90,7 +155,7 @@ export class LUTImageLoader extends Loader {
 
 	}
 
-	horz2Vert( texture ) {
+	_horz2Vert( texture ) {
 
 		const width = texture.image.height;
 		const height = texture.image.width;
@@ -120,30 +185,4 @@ export class LUTImageLoader extends Loader {
 
 	}
 
-	parse( dataArray, size ) {
-
-		const data = new Uint8Array( dataArray );
-
-		const texture3D = new Data3DTexture();
-		texture3D.image.data = data;
-		texture3D.image.width = size;
-		texture3D.image.height = size;
-		texture3D.image.depth = size;
-		texture3D.format = RGBAFormat;
-		texture3D.type = UnsignedByteType;
-		texture3D.magFilter = LinearFilter;
-		texture3D.minFilter = LinearFilter;
-		texture3D.wrapS = ClampToEdgeWrapping;
-		texture3D.wrapT = ClampToEdgeWrapping;
-		texture3D.wrapR = ClampToEdgeWrapping;
-		texture3D.generateMipmaps = false;
-		texture3D.needsUpdate = true;
-
-		return {
-			size,
-			texture3D,
-		};
-
-	}
-
 }

+ 42 - 3
examples/jsm/loaders/LWOLoader.js

@@ -43,16 +43,47 @@ import { IFFParser } from './lwo/IFFParser.js';
 
 let _lwoTree;
 
+/**
+ * A loader for the LWO format.
+ *
+ * LWO3 and LWO2 formats are supported.
+ *
+ * References:
+ * - [LWO3 format specification]{@link https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo3.html}
+ * - [LWO2 format specification]{@link https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo2.html}
+ *
+ * ```js
+ * const loader = new LWOLoader();
+ * const lwoData = await loader.loadAsync( 'models/lwo/Objects/LWO3/Demo.lwo' );
+ *
+ * const mesh = object.meshes[ 0 ];
+ * scene.add( mesh );
+ * ```
+ *
+ * @augments Loader
+ */
 class LWOLoader extends Loader {
 
-	constructor( manager, parameters = {} ) {
+	/**
+	 * Constructs a new LWO loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
+	constructor( manager ) {
 
 		super( manager );
 
-		this.resourcePath = ( parameters.resourcePath !== undefined ) ? parameters.resourcePath : '';
-
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded LWO asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({meshes:Array<Mesh>,materials:Array<Material>})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -96,6 +127,14 @@ class LWOLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given LWO data and returns the resulting meshes and materials.
+	 *
+	 * @param {ArrayBuffer} iffBuffer - The raw LWO data as an array buffer.
+	 * @param {string} path - The URL base path.
+	 * @param {string} modelName - The model name.
+	 * @return {{meshes:Array<Mesh>,materials:Array<Material>}} An object holding the parse meshes and materials.
+	 */
 	parse( iffBuffer, path, modelName ) {
 
 		_lwoTree = new IFFParser().parse( iffBuffer );

+ 37 - 0
examples/jsm/loaders/LottieLoader.js

@@ -8,14 +8,51 @@ import {
 
 import lottie from '../libs/lottie_canvas.module.js';
 
+/**
+ * A loader for the Lottie texture animation format.
+ *
+ * The loader returns an instance of {@link CanvasTexture} to represent
+ * the animated texture. Two additional properties are added to each texture:
+ * - `animation`: The return value of `lottie.loadAnimation()` which is an object
+ * with an API for controlling the animation's playback.
+ * - `image`: The image container.
+ *
+ * ```js
+ * const loader = new LottieLoader();
+ * loader.setQuality( 2 );
+ * const texture = await loader.loadAsync( 'textures/lottie/24017-lottie-logo-animation.json' );
+ *
+ * const geometry = new THREE.BoxGeometry();
+ * const material = new THREE.MeshBasicMaterial( { map: texture } );
+ * const mesh = new THREE.Mesh( geometry, material );
+ * scene.add( mesh );
+ * ```
+ *
+ * @augments Loader
+ */
 class LottieLoader extends Loader {
 
+	/**
+	 * Sets the texture quality.
+	 *
+	 * @param {number} value - The texture quality.
+	 */
 	setQuality( value ) {
 
 		this._quality = value;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded Lottie asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(CanvasTexture)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 * @returns {CanvasTexture} The Lottie texture.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const quality = this._quality || 1;

+ 35 - 0
examples/jsm/loaders/MD2Loader.js

@@ -91,14 +91,43 @@ const _normalData = [
 	[ - 0.587785, - 0.425325, - 0.688191 ], [ - 0.688191, - 0.587785, - 0.425325 ]
 ];
 
+/**
+ * A loader for the MD2 format.
+ *
+ * The loader represents the animations of the MD2 asset as an array of animation
+ * clips and stores them in the `animations` property of the geometry.
+ *
+ * ```js
+ * const loader = new MD2Loader();
+ * const geometry = await loader.loadAsync( './models/md2/ogro/ogro.md2' );
+ *
+ * const animations = geometry.animations;
+ * ```
+ *
+ * @augments Loader
+ */
 class MD2Loader extends Loader {
 
+	/**
+	 * Constructs a new MD2 loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded MD2 asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({scene:Group})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -134,6 +163,12 @@ class MD2Loader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given MD2 data and returns a geometry.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw MD2 data as an array buffer.
+	 * @return {BufferGeometry} The parsed geometry data.
+	 */
 	parse( buffer ) {
 
 		const data = new DataView( buffer );

+ 56 - 12
examples/jsm/loaders/MDDLoader.js

@@ -1,15 +1,3 @@
-/**
- * MDD is a special format that stores a position for every vertex in a model for every frame in an animation.
- * Similar to BVH, it can be used to transfer animation data between different 3D applications or engines.
- *
- * MDD stores its data in binary format (big endian) in the following way:
- *
- * number of frames (a single uint32)
- * number of vertices (a single uint32)
- * time values for each frame (sequence of float32)
- * vertex data for each frame (sequence of float32)
- */
-
 import {
 	AnimationClip,
 	BufferAttribute,
@@ -18,14 +6,63 @@ import {
 	NumberKeyframeTrack
 } from 'three';
 
+/**
+ * A loader for the MDD format.
+ *
+ * MDD stores a position for every vertex in a model for every frame in an animation.
+ * Similar to BVH, it can be used to transfer animation data between different 3D applications or engines.
+ *
+ * MDD stores its data in binary format (big endian) in the following way:
+ *
+ * - number of frames (a single uint32)
+ * - number of vertices (a single uint32)
+ * - time values for each frame (sequence of float32)
+ * - vertex data for each frame (sequence of float32)
+ *
+ * ```js
+ * const loader = new MDDLoader();
+ * const result = await loader.loadAsync( 'models/mdd/cube.mdd' );
+ *
+ * const morphTargets = result.morphTargets;
+ * const clip = result.clip;
+ * // clip.optimize(); // optional
+ *
+ * const geometry = new THREE.BoxGeometry();
+ * geometry.morphAttributes.position = morphTargets; // apply morph targets (vertex data must match)
+ *
+ * const material = new THREE.MeshBasicMaterial();
+ *
+ * const mesh = new THREE.Mesh( geometry, material );
+ * scene.add( mesh );
+ *
+ * const mixer = new THREE.AnimationMixer( mesh );
+ * mixer.clipAction( clip ).play();
+ * ```
+ *
+ * @augments Loader
+ */
 class MDDLoader extends Loader {
 
+	/**
+	 * Constructs a new MDD loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded MDD asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({clip:AnimationClip, morphTargets:Array<BufferAttribute>})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -41,6 +78,13 @@ class MDDLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given MDD data and returns an object holding the animation clip and the respective
+	 * morph targets.
+	 *
+	 * @param {ArrayBuffer} data - The raw XYZ data as an array buffer.
+	 * @return {{clip:AnimationClip, morphTargets:Array<BufferAttribute>}} The result object.
+	 */
 	parse( data ) {
 
 		const view = new DataView( data );

+ 38 - 33
examples/jsm/loaders/MTLLoader.js

@@ -14,9 +14,22 @@ import {
 } from 'three';
 
 /**
- * Loads a Wavefront .mtl file specifying materials
+ * A loader for the MTL format.
+ *
+ * The Material Template Library format (MTL) or .MTL File Format is a companion file format
+ * to OBJ that describes surface shading (material) properties of objects within one or more
+ * OBJ files.
+ *
+ * ```js
+ * const loader = new MTLLoader();
+ * const materials = await loader.loadAsync( 'models/obj/male02/male02.mtl' );
+ *
+ * const objLoader = new OBJLoader();
+ * objLoader.setMaterials( materials );
+ * ```
+ *
+ * @augments Loader
  */
-
 class MTLLoader extends Loader {
 
 	constructor( manager ) {
@@ -26,17 +39,13 @@ class MTLLoader extends Loader {
 	}
 
 	/**
-	 * Loads and parses a MTL asset from a URL.
-	 *
-	 * @param {string} url - URL to the MTL file.
-	 * @param {Function} [onLoad] - Callback invoked with the loaded object.
-	 * @param {Function} [onProgress] - Callback for download progress.
-	 * @param {Function} [onError] - Callback for download errors.
+	 * Starts loading from the given URL and passes the loaded MTL asset
+	 * to the `onLoad()` callback.
 	 *
-	 * @see {@link FileLoader#setPath} {@link FileLoader#setResourcePath}
-	 *
-	 * @note In order for relative texture references to resolve correctly
-	 * you must call setResourcePath() explicitly prior to load.
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(MaterialCreator)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
 	 */
 	load( url, onLoad, onProgress, onError ) {
 
@@ -74,6 +83,12 @@ class MTLLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the material options.
+	 *
+	 * @param {MTLLoader~MaterialOptions} value - The material options.
+	 * @return {MTLLoader} A referene to this loader.
+	 */
 	setMaterialOptions( value ) {
 
 		this.materialOptions = value;
@@ -82,16 +97,11 @@ class MTLLoader extends Loader {
 	}
 
 	/**
-	 * Parses a MTL file.
-	 *
-	 * @param {string} text - Content of MTL file
-	 * @param {string} path
-	 * @return {MaterialCreator}
-	 *
-	 * @see {@link FileLoader#setPath} {@link FileLoader#setResourcePath}
+	 * Parses the given MTL data and returns the resulting material creator.
 	 *
-	 * @note In order for relative texture references to resolve correctly
-	 * you must call setResourcePath() explicitly prior to parse.
+	 * @param {string} text - The raw MTL data as a string.
+	 * @param {string} path - The URL base path.
+	 * @return {MaterialCreator} The material creator.
 	 */
 	parse( text, path ) {
 
@@ -155,18 +165,13 @@ class MTLLoader extends Loader {
 }
 
 /**
- * Create a new MTLLoader.MaterialCreator
- * @param baseUrl - Url relative to which textures are loaded
- * @param options - Set of options on how to construct the materials
- *                  side: Which side to apply the material
- *                        FrontSide (default), THREE.BackSide, THREE.DoubleSide
- *                  wrap: What type of wrapping to apply for textures
- *                        RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping
- *                  normalizeRGB: RGBs need to be normalized to 0-1 from 0-255
- *                                Default: false, assumed to be already normalized
- *                  ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's
- *                                  Default: false
- * @constructor
+ * Material options of `MTLLoader`.
+ *
+ * @typedef {Object} MTLLoader~MaterialOptions
+ * @property {(FrontSide|BackSide|DoubleSide)} [side=FrontSide] - Which side to apply the material.
+ * @property {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} [wrap=RepeatWrapping] - What type of wrapping to apply for textures.
+ * @property {boolean} [normalizeRGB=false] - Whether RGB clors should be normalized to `0-1` from `0-255`.
+ * @property {boolean} [ignoreZeroRGBs=false] - Ignore values of RGBs (Ka,Kd,Ks) that are all 0's.
  */
 
 class MaterialCreator {

+ 33 - 0
examples/jsm/loaders/MaterialXLoader.js

@@ -145,14 +145,41 @@ const MXElements = [
 const MtlXLibrary = {};
 MXElements.forEach( element => MtlXLibrary[ element.name ] = element );
 
+/**
+ * A loader for the MaterialX format.
+ *
+ * The node materials loaded with this loader can only be used with {@link WebGPURenderer}.
+ *
+ * ```js
+ * const loader = new MaterialXLoader().setPath( SAMPLE_PATH );
+ * const materials = await loader.loadAsync( 'standard_surface_brass_tiled.mtlx' );
+ * ```
+ *
+ * @augments Loader
+ */
 class MaterialXLoader extends Loader {
 
+	/**
+	 * Constructs a new MaterialX loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded MaterialX asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Object<string,NodeMaterial>)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 * @return {MaterialXLoader} A reference to this loader.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const _onError = function ( e ) {
@@ -189,6 +216,12 @@ class MaterialXLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given MaterialX data and returns the resulting materials.
+	 *
+	 * @param {string} text - The raw MaterialX data as a string.
+	 * @return {Object<string,NodeMaterial>} A dictionary holding the parse node materials.
+	 */
 	parse( text ) {
 
 		return new MaterialX( this.manager, this.path ).parse( text );

+ 36 - 5
examples/jsm/loaders/NRRDLoader.js

@@ -7,14 +7,38 @@ import {
 import * as fflate from '../libs/fflate.module.js';
 import { Volume } from '../misc/Volume.js';
 
+/**
+ * A loader for the NRRD format.
+ *
+ * ```js
+ * const loader = new NRRDLoader();
+ * const volume = await loader.loadAsync( 'models/nrrd/I.nrrd' );
+ * ```
+ *
+ * @augments Loader
+ */
 class NRRDLoader extends Loader {
 
+	/**
+	 * Constructs a new NRRD loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded NRRD asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Volume)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -51,15 +75,22 @@ class NRRDLoader extends Loader {
 	}
 
 	/**
+	 * Toggles the segmentation mode.
 	 *
-	 * @param {boolean} segmentation is a option for user to choose
-   	 */
+	 * @param {boolean} segmentation - Whether to use segmentation mode or not.
+	 */
 	setSegmentation( segmentation ) {
 
-	    this.segmentation = segmentation;
+		this.segmentation = segmentation;
 
 	}
 
+	/**
+	 * Parses the given NRRD data and returns the resulting volume data.
+	 *
+	 * @param {ArrayBuffer} data - The raw NRRD data as an array buffer.
+	 * @return {Volume} The parsed volume.
+	 */
 	parse( data ) {
 
 		// this parser is largely inspired from the XTK NRRD parser : https://github.com/xtk/X
@@ -307,7 +338,7 @@ class NRRDLoader extends Loader {
 
 				// we found two line breaks in a row
 				// now we know what the header is
-				_header = this.parseChars( _bytes, 0, i - 2 );
+				_header = this._parseChars( _bytes, 0, i - 2 );
 				// this is were the data starts
 				_data_start = i + 1;
 				break;
@@ -485,7 +516,7 @@ class NRRDLoader extends Loader {
 
 	}
 
-	parseChars( array, start, end ) {
+	_parseChars( array, start, end ) {
 
 		// without borders, use the whole array
 		if ( start === undefined ) {

+ 48 - 1
examples/jsm/loaders/OBJLoader.js

@@ -432,18 +432,53 @@ function ParserState() {
 
 }
 
-//
 
+/**
+ * A loader for the OBJ format.
+ *
+ * The [OBJ format]{@link https://en.wikipedia.org/wiki/Wavefront_.obj_file} is a simple data-format that
+ * represents 3D geometry in a human readable format as the position of each vertex, the UV position of
+ * each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list
+ * of vertices, and texture vertices.
+ *
+ * ```js
+ * const loader = new OBJLoader();
+ * const object = await loader.loadAsync( 'models/monster.obj' );
+ * scene.add( object );
+ * ```
+ *
+ * @augments Loader
+ */
 class OBJLoader extends Loader {
 
+	/**
+	 * Constructs a new OBJ loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * A reference to a material creator.
+		 *
+		 * @type {?MaterialCreator}
+		 * @default null
+		 */
 		this.materials = null;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded OBJ asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -478,6 +513,12 @@ class OBJLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets the material creator for this OBJ. This object is loaded via {@link MTLLoader}.
+	 *
+	 * @param {MaterialCreator} materials - An object that creates the materials for this OBJ.
+	 * @return {OBJLoader} A reference to this loader.
+	 */
 	setMaterials( materials ) {
 
 		this.materials = materials;
@@ -486,6 +527,12 @@ class OBJLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given OBJ data and returns the resulting group.
+	 *
+	 * @param {string} text - The raw OBJ data as a string.
+	 * @return {Group} The parsed OBJ.
+	 */
 	parse( text ) {
 
 		const state = new ParserState();

+ 47 - 0
examples/jsm/loaders/PCDLoader.js

@@ -10,16 +10,57 @@ import {
 	SRGBColorSpace
 } from 'three';
 
+/**
+ * A loader for the Point Cloud Data (PCD) format.
+ *
+ * PCDLoader supports ASCII and (compressed) binary files as well as the following PCD fields:
+ * - x y z
+ * - rgb
+ * - normal_x normal_y normal_z
+ * - intensity
+ * - label
+ *
+ * ```js
+ * const loader = new PCDLoader();
+ *
+ * const points = await loader.loadAsync( './models/pcd/binary/Zaghetto.pcd' );
+ * points.geometry.center(); // optional
+ * points.geometry.rotateX( Math.PI ); // optional
+ * scene.add( points );
+ * ```
+ *
+ * @augments Loader
+ */
 class PCDLoader extends Loader {
 
+	/**
+	 * Constructs a new PCD loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * Whether to use little Endian or not.
+		 *
+		 * @type {boolean}
+		 * @default true
+		 */
 		this.littleEndian = true;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded PCD asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Points)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -55,6 +96,12 @@ class PCDLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given PCD data and returns a point cloud.
+	 *
+	 * @param {ArrayBuffer} data - The raw PCD data as an array buffer.
+	 * @return {Points} The parsed point cloud.
+	 */
 	parse( data ) {
 
 		// from https://gitlab.com/taketwo/three-pcd-loader/blob/master/decompress-lzf.js

+ 40 - 2
examples/jsm/loaders/PDBLoader.js

@@ -7,14 +7,45 @@ import {
 	SRGBColorSpace
 } from 'three';
 
+/**
+ * A loader for the PDB format.
+ *
+ * The [Protein Data Bank]{@link https://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)}
+ * file format is a textual file describing the three-dimensional structures of molecules.
+ *
+ * ```js
+ * const loader = new PDBLoader();
+ * const pdb = await loader.loadAsync( 'models/pdb/ethanol.pdb' );
+ *
+ * const geometryAtoms = pdb.geometryAtoms;
+ * const geometryBonds = pdb.geometryBonds;
+ * const json = pdb.json;
+ * ```
+ *
+ * @augments Loader
+ */
 class PDBLoader extends Loader {
 
+	/**
+	 * Constructs a new PDB loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded PDB asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Object)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -49,10 +80,17 @@ class PDBLoader extends Loader {
 
 	}
 
-	// Based on CanvasMol PDB parser
-
+	/**
+	 * Parses the given PDB data and returns an object holding the atoms and
+	 * bond gometries as well as the raw atom data as JSON.
+	 *
+	 * @param {string} text - The raw PDB data as a string.
+	 * @return {Object} The result object.
+	 */
 	parse( text ) {
 
+		// Based on CanvasMol PDB parser
+
 		function trim( text ) {
 
 			return text.replace( /^\s\s*/, '' ).replace( /\s\s*$/, '' );

+ 62 - 32
examples/jsm/loaders/PLYLoader.js

@@ -7,55 +7,50 @@ import {
 	SRGBColorSpace
 } from 'three';
 
+const _color = new Color();
+
 /**
- * Description: A THREE loader for PLY ASCII files (known as the Polygon
+ * A loader for PLY the PLY format (known as the Polygon
  * File Format or the Stanford Triangle Format).
  *
- * Limitations: ASCII decoding assumes file is UTF-8.
- *
- * Usage:
- *	const loader = new PLYLoader();
- *	loader.load('./models/ply/ascii/dolphins.ply', function (geometry) {
- *
- *		scene.add( new THREE.Mesh( geometry ) );
- *
- *	} );
- *
- * If the PLY file uses non standard property names, they can be mapped while
- * loading. For example, the following maps the properties
- * “diffuse_(red|green|blue)” in the file to standard color names.
+ * Limitations:
+ *  - ASCII decoding assumes file is UTF-8.
  *
- * loader.setPropertyNameMapping( {
- *	diffuse_red: 'red',
- *	diffuse_green: 'green',
- *	diffuse_blue: 'blue'
- * } );
- *
- * Custom properties outside of the defaults for position, uv, normal
- * and color attributes can be added using the setCustomPropertyNameMapping method.
- * For example, the following maps the element properties “custom_property_a”
- * and “custom_property_b” to an attribute “customAttribute” with an item size of 2.
- * Attribute item sizes are set from the number of element properties in the property array.
- *
- * loader.setCustomPropertyNameMapping( {
- *	customAttribute: ['custom_property_a', 'custom_property_b'],
- * } );
+ * ```js
+ * const loader = new PLYLoader();
+ * const goemetry = await loader.loadAsync( './models/ply/ascii/dolphins.ply' );
+ * scene.add( new THREE.Mesh( geometry ) );
+ * ```
  *
+ * @augments Loader
  */
-
-const _color = new Color();
-
 class PLYLoader extends Loader {
 
+	/**
+	 * Constructs a new PLY loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		// internals
+
 		this.propertyNameMapping = {};
 		this.customPropertyMapping = {};
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded PLY asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -91,18 +86,53 @@ class PLYLoader extends Loader {
 
 	}
 
+	/**
+	 * Sets a property name mapping that maps default property names
+	 * to custom ones. For example, the following maps the properties
+	 * “diffuse_(red|green|blue)” in the file to standard color names.
+	 *
+	 * ```js
+	 * loader.setPropertyNameMapping( {
+	 * 	diffuse_red: 'red',
+	 * 	diffuse_green: 'green',
+	 * 	diffuse_blue: 'blue'
+	 * } );
+	 * ```
+	 *
+	 * @param {Object} mapping - The mapping dictionary.
+	 */
 	setPropertyNameMapping( mapping ) {
 
 		this.propertyNameMapping = mapping;
 
 	}
 
+	/**
+	 * Custom properties outside of the defaults for position, uv, normal
+	 * and color attributes can be added using the setCustomPropertyNameMapping method.
+	 * For example, the following maps the element properties “custom_property_a”
+	 * and “custom_property_b” to an attribute “customAttribute” with an item size of 2.
+	 * Attribute item sizes are set from the number of element properties in the property array.
+	 *
+	 * ```js
+	 * loader.setCustomPropertyNameMapping( {
+	 *	customAttribute: ['custom_property_a', 'custom_property_b'],
+	 * } );
+	 * ```
+	 * @param {Object} mapping - The mapping dictionary.
+	 */
 	setCustomPropertyNameMapping( mapping ) {
 
 		this.customPropertyMapping = mapping;
 
 	}
 
+	/**
+	 * Parses the given PLY data and returns the resulting geometry.
+	 *
+	 * @param {ArrayBuffer} data - The raw PLY data as an array buffer.
+	 * @return {BufferGeometry} The parsed geometry.
+	 */
 	parse( data ) {
 
 		function parseHeader( data, headerLength = 0 ) {

+ 23 - 5
examples/jsm/loaders/PVRLoader.js

@@ -6,20 +6,38 @@ import {
 	RGB_PVRTC_4BPPV1_Format
 } from 'three';
 
-/*
- *	 PVR v2 (legacy) parser
- *   TODO : Add Support for PVR v3 format
- *   TODO : implement loadMipmaps option
+/**
+ * A loader for the PVRTC texture compression format.
+ *
+ * ```js
+ * const loader = new PVRLoader();
+ *
+ * const map = loader.load( 'textures/compressed/disturb_4bpp_rgb.pvr' );
+ * map.colorSpace = THREE.SRGBColorSpace; // only for color textures
+ * ```
+ *
+ * @augments CompressedTextureLoader
  */
-
 class PVRLoader extends CompressedTextureLoader {
 
+	/**
+	 * Constructs a new PVR loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Parses the given PVRTC texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @param {boolean} loadMipmaps - Whether to load mipmaps or not. This option is not yet supported by the loader.
+	 * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data.
+	 */
 	parse( buffer, loadMipmaps ) {
 
 		const headerLengthInt = 13;

+ 38 - 5
examples/jsm/loaders/RGBELoader.js

@@ -7,23 +7,50 @@ import {
 	LinearSRGBColorSpace
 } from 'three';
 
-// https://github.com/mrdoob/three.js/issues/5552
-// http://en.wikipedia.org/wiki/RGBE_image_format
-
+/**
+ * A loader for the RGBE HDR texture format.
+ *
+ * ```js
+ * const loader = new RGBELoader();
+ * const envMap = await loader.loadAsync( 'textures/equirectangular/blouberg_sunrise_2_1k.hdr' );
+ * envMap.mapping = THREE.EquirectangularReflectionMapping;
+ *
+ * scene.environment = envMap;
+ * ```
+ *
+ * @augments DataTextureLoader
+ */
 class RGBELoader extends DataTextureLoader {
 
+	/**
+	 * Constructs a new RGBE loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * The texture type.
+		 *
+		 * @type {(HalfFloatType|FloatType)}
+		 * @default HalfFloatType
+		 */
 		this.type = HalfFloatType;
 
 	}
 
-	// adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
-
+	/**
+	 * Parses the given RGBE texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
+	 */
 	parse( buffer ) {
 
+		// adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
+
 		const
 			/* default error routine.  change this to change error handling */
 			rgbe_read_error = 1,
@@ -411,6 +438,12 @@ class RGBELoader extends DataTextureLoader {
 
 	}
 
+	/**
+	 * Sets the texture type.
+	 *
+	 * @param {(HalfFloatType|FloatType)} value - The texture type to set.
+	 * @return {RGBELoader} A reference to this loader.
+	 */
 	setDataType( value ) {
 
 		this.type = value;

+ 67 - 1
examples/jsm/loaders/RGBMLoader.js

@@ -7,17 +7,53 @@ import {
 	DataUtils
 } from 'three';
 
+/**
+ * A loader for the RGBM HDR texture format.
+ *
+ * ```js
+ * const loader = new RGBMLoader();
+ * loader.setMaxRange( 16 );
+ *
+ * const texture = await loader.loadAsync( 'textures/memorial.png' );
+ * ```
+ *
+ * @augments DataTextureLoader
+ */
 class RGBMLoader extends DataTextureLoader {
 
+	/**
+	 * Constructs a new RGBM loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * The texture type.
+		 *
+		 * @type {(HalfFloatType|FloatType)}
+		 * @default HalfFloatType
+		 */
 		this.type = HalfFloatType;
-		this.maxRange = 7; // more information about this property at https://iwasbeingirony.blogspot.com/2010/06/difference-between-rgbm-and-rgbd.html
+
+		/**
+		 * More information about this property at [The difference between RGBM and RGBD]{@link https://iwasbeingirony.blogspot.com/2010/06/difference-between-rgbm-and-rgbd.html}
+		 *
+		 * @type {(7|16)}
+		 * @default 7
+		 */
+		this.maxRange = 7;
 
 	}
 
+	/**
+	 * Sets the texture type.
+	 *
+	 * @param {(HalfFloatType|FloatType)} value - The texture type to set.
+	 * @return {RGBMLoader} A reference to this loader.
+	 */
 	setDataType( value ) {
 
 		this.type = value;
@@ -25,6 +61,12 @@ class RGBMLoader extends DataTextureLoader {
 
 	}
 
+	/**
+	 * Sets the maximum range.
+	 *
+	 * @param {number} value - The maximum range to set.
+	 * @return {RGBMLoader} A reference to this loader.
+	 */
 	setMaxRange( value ) {
 
 		this.maxRange = value;
@@ -32,6 +74,16 @@ class RGBMLoader extends DataTextureLoader {
 
 	}
 
+	/**
+	 * Starts loading from the given URLs and passes the loaded RGBM cube map
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {Array<string>} urls - The paths/URLs of the files to be loaded. This can also be a data URIs.
+	 * @param {function(CubeTexture)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 * @return {CubeTexture} The cube texture.
+	 */
 	loadCubemap( urls, onLoad, onProgress, onError ) {
 
 		const texture = new CubeTexture();
@@ -81,6 +133,14 @@ class RGBMLoader extends DataTextureLoader {
 
 	}
 
+	/**
+	 * Async version of {@link RGBMLoader#loadCubemap}.
+	 *
+	 * @async
+	 * @param {Array<string>} urls - The paths/URLs of the files to be loaded. This can also be a data URIs.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @return {Promise<CubeTexture>} A Promise that resolves with the loaded cube map.
+	 */
 	loadCubemapAsync( urls, onProgress ) {
 
 		return new Promise( ( resolve, reject ) => {
@@ -91,6 +151,12 @@ class RGBMLoader extends DataTextureLoader {
 
 	}
 
+	/**
+	 * Parses the given RGBM texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
+	 */
 	parse( buffer ) {
 
 		const img = UPNG.decode( buffer );

+ 47 - 38
examples/jsm/loaders/STLLoader.js

@@ -10,65 +10,68 @@ import {
 } from 'three';
 
 /**
- * Description: A THREE loader for STL ASCII files, as created by Solidworks and other CAD programs.
+ * A loader for the STL format, as created by Solidworks and other CAD programs.
  *
- * Supports both binary and ASCII encoded files, with automatic detection of type.
- *
- * The loader returns a non-indexed buffer geometry.
+ * Supports both binary and ASCII encoded files. The loader returns a non-indexed buffer geometry.
  *
  * Limitations:
- *  Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL).
- *  There is perhaps some question as to how valid it is to always assume little-endian-ness.
- *  ASCII decoding assumes file is UTF-8.
- *
- * Usage:
- *  const loader = new STLLoader();
- *  loader.load( './models/stl/slotted_disk.stl', function ( geometry ) {
- *    scene.add( new THREE.Mesh( geometry ) );
- *  });
+ * - Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL).
+ * - There is perhaps some question as to how valid it is to always assume little-endian-ness.
+ * - ASCII decoding assumes file is UTF-8.
  *
+ * ```js
+ * const loader = new STLLoader();
+ * const geometry = await loader.loadAsync( './models/stl/slotted_disk.stl' )
+ * scene.add( new THREE.Mesh( geometry ) );
+ * ```
  * For binary STLs geometry might contain colors for vertices. To use it:
- *  // use the same code to load STL as above
- *  if (geometry.hasColors) {
- *    material = new THREE.MeshPhongMaterial({ opacity: geometry.alpha, vertexColors: true });
- *  } else { .... }
- *  const mesh = new THREE.Mesh( geometry, material );
- *
+ * ```js
+ * // use the same code to load STL as above
+ * if ( geometry.hasColors ) {
+ * 	material = new THREE.MeshPhongMaterial( { opacity: geometry.alpha, vertexColors: true } );
+ * }
+ * const mesh = new THREE.Mesh( geometry, material );
+ * ```
  * For ASCII STLs containing multiple solids, each solid is assigned to a different group.
  * Groups can be used to assign a different color by defining an array of materials with the same length of
  * geometry.groups and passing it to the Mesh constructor:
  *
- * const mesh = new THREE.Mesh( geometry, material );
- *
- * For example:
+ * ```js
+ * const materials = [];
+ * const nGeometryGroups = geometry.groups.length;
  *
- *  const materials = [];
- *  const nGeometryGroups = geometry.groups.length;
+ * for ( let i = 0; i < nGeometryGroups; i ++ ) {
+ * 	const material = new THREE.MeshPhongMaterial( { color: colorMap[ i ], wireframe: false } );
+ * 	materials.push( material );
+ * }
  *
- *  const colorMap = ...; // Some logic to index colors.
+ * const mesh = new THREE.Mesh(geometry, materials);
+ * ```
  *
- *  for (let i = 0; i < nGeometryGroups; i++) {
- *
- *		const material = new THREE.MeshPhongMaterial({
- *			color: colorMap[i],
- *			wireframe: false
- *		});
- *
- *  }
- *
- *  materials.push(material);
- *  const mesh = new THREE.Mesh(geometry, materials);
+ * @augments Loader
  */
-
-
 class STLLoader extends Loader {
 
+	/**
+	 * Constructs a new STL loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded STL asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -105,6 +108,12 @@ class STLLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given STL data and returns the resulting geometry.
+	 *
+	 * @param {ArrayBuffer} data - The raw STL data as an array buffer.
+	 * @return {BufferGeometry} The parsed geometry.
+	 */
 	parse( data ) {
 
 		function isBinary( data ) {

+ 113 - 20
examples/jsm/loaders/SVGLoader.js

@@ -16,20 +16,84 @@ import {
 
 const COLOR_SPACE_SVG = SRGBColorSpace;
 
+/**
+ * A loader for the SVG format.
+ *
+ * Scalable Vector Graphics is an XML-based vector image format for two-dimensional graphics
+ * with support for interactivity and animation.
+ *
+ * ```js
+ * const loader = new SVGLoader();
+ * const data = await loader.loadAsync( 'data/svgSample.svg' );
+ *
+ * const paths = data.paths;
+ * const group = new THREE.Group();
+ *
+ * for ( let i = 0; i < paths.length; i ++ ) {
+ *
+ * 	const path = paths[ i ];
+ * 	const material = new THREE.MeshBasicMaterial( {
+ * 		color: path.color,
+ * 		side: THREE.DoubleSide,
+ * 		depthWrite: false
+ * 	} );
+ *
+ * 	const shapes = SVGLoader.createShapes( path );
+ *
+ * 	for ( let j = 0; j < shapes.length; j ++ ) {
+ *
+ * 		const shape = shapes[ j ];
+ * 		const geometry = new THREE.ShapeGeometry( shape );
+ * 		const mesh = new THREE.Mesh( geometry, material );
+ * 		group.add( mesh );
+ *
+ * 	}
+ *
+ * }
+ *
+ * scene.add( group );
+ * ```
+ *
+ * @augments Loader
+ */
 class SVGLoader extends Loader {
 
+	/**
+	 * Constructs a new SVG loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
-		// Default dots per inch
+		/**
+		 * Default dots per inch.
+		 *
+		 * @type {number}
+		 * @default 90
+		 */
 		this.defaultDPI = 90;
 
-		// Accepted units: 'mm', 'cm', 'in', 'pt', 'pc', 'px'
+		/**
+		 * Default unit.
+		 *
+		 * @type {('mm'|'cm'|'in'|'pt'|'pc'|'px')}
+		 * @default 'px'
+		 */
 		this.defaultUnit = 'px';
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded SVG asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function({paths:Array<ShapePath>,xml:string})} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -64,6 +128,13 @@ class SVGLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given SVG data and returns the resulting data.
+	 *
+	 * @param {string} text - The raw SVG data as a string.
+	 * @return {{paths:Array<ShapePath>,xml:string}} An object holding an array of shape paths and the
+	 * SVG XML document.
+	 */
 	parse( text ) {
 
 		const scope = this;
@@ -775,6 +846,7 @@ class SVGLoader extends Loader {
 		* According to https://www.w3.org/TR/SVG/shapes.html#RectElementRXAttribute
 		* rounded corner should be rendered to elliptical arc, but bezier curve does the job well enough
 		*/
+
 		function parseRectNode( node ) {
 
 			const x = parseFloatWithUnits( node.getAttribute( 'x' ) || 0 );
@@ -1916,11 +1988,14 @@ class SVGLoader extends Loader {
 
 	}
 
+	/**
+	 * Creates from the given shape path and array of shapes.
+	 *
+	 * @param {ShapePath} shapePath - The shape path.
+	 * @return {Array<Shape>} An array of shapes.
+	 */
 	static createShapes( shapePath ) {
 
-		// Param shapePath: a shapepath as returned by the parse function of this class
-		// Returns Shape object
-
 		const BIGNUMBER = 999999999;
 
 		const IntersectionLocationType = {
@@ -2360,15 +2435,18 @@ class SVGLoader extends Loader {
 
 	}
 
+	/**
+	 * Returns a stroke style object from the given parameters.
+	 *
+	 * @param {number} [width=1] - The stroke width.
+	 * @param {string} [color='#000'] - The stroke color, as  returned by {@link Color#getStyle}.
+	 * @param {'round'|'bevel'|'miter'|'miter-limit'} [lineJoin='miter'] - The line join style.
+	 * @param {'round'|'square'|'butt'} [lineCap='butt'] - The line cap style.
+	 * @param {number} [miterLimit=4] - Maximum join length, in multiples of the `width` parameter (join is truncated if it exceeds that distance).
+	 * @return {Object} The style object.
+	 */
 	static getStrokeStyle( width, color, lineJoin, lineCap, miterLimit ) {
 
-		// Param width: Stroke width
-		// Param color: As returned by THREE.Color.getStyle()
-		// Param lineJoin: One of "round", "bevel", "miter" or "miter-limit"
-		// Param lineCap: One of "round", "square" or "butt"
-		// Param miterLimit: Maximum join length, in multiples of the "width" parameter (join is truncated if it exceeds that distance)
-		// Returns style object
-
 		width = width !== undefined ? width : 1;
 		color = color !== undefined ? color : '#000';
 		lineJoin = lineJoin !== undefined ? lineJoin : 'miter';
@@ -2385,16 +2463,18 @@ class SVGLoader extends Loader {
 
 	}
 
+	/**
+	 * Creates a stroke from an array of points.
+	 *
+	 * @param {Array<Vector2>} points - The points in 2D space. Minimum 2 points. The path can be open or closed (last point equals to first point).
+	 * @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object.
+	 * @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps.
+	 * @param {number} [minDistance=0.001] - Points closer to this distance will be merged.
+	 * @return {?BufferGeometry} The stroke geometry. UV coordinates are generated ('u' along path. 'v' across it, from left to right).
+	 * Returns `null` if not geometry was generated.
+	 */
 	static pointsToStroke( points, style, arcDivisions, minDistance ) {
 
-		// Generates a stroke with some width around the given path.
-		// The path can be open or closed (last point equals to first point)
-		// Param points: Array of Vector2D (the path). Minimum 2 points.
-		// Param style: Object with SVG properties as returned by SVGLoader.getStrokeStyle(), or SVGLoader.parse() in the path.userData.style object
-		// Params arcDivisions: Arc divisions for round joins and endcaps. (Optional)
-		// Param minDistance: Points closer to this distance will be merged. (Optional)
-		// Returns BufferGeometry with stroke triangles (In plane z = 0). UV coordinates are generated ('u' along path. 'v' across it, from left to right)
-
 		const vertices = [];
 		const normals = [];
 		const uvs = [];
@@ -2414,6 +2494,19 @@ class SVGLoader extends Loader {
 
 	}
 
+	/**
+	 * Creates a stroke from an array of points.
+	 *
+	 * @param {Array<Vector2>} points - The points in 2D space. Minimum 2 points.
+	 * @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object.
+	 * @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps.
+	 * @param {number} [minDistance=0.001] - Points closer to this distance will be merged.
+	 * @param {Array<number>} vertices - An array holding vertices.
+	 * @param {Array<number>} normals - An array holding normals.
+	 * @param {Array<number>} uvs - An array holding uvs.
+	 * @param {number} [vertexOffset=0] - The vertex offset.
+	 * @return {number} The number of vertices.
+	 */
 	static pointsToStrokeWithBuffers( points, style, arcDivisions, minDistance, vertices, normals, uvs, vertexOffset ) {
 
 		// This function can be called to update existing arrays or buffers.

+ 81 - 61
examples/jsm/loaders/TDSLoader.js

@@ -15,21 +15,39 @@ import {
 } from 'three';
 
 /**
- * Autodesk 3DS three.js file loader, based on lib3ds.
+ * A loader for the 3DS format, based on lib3ds.
  *
  * Loads geometry with uv and materials basic properties with texture support.
  *
- * @class TDSLoader
+ * ```js
+ * const loader = new TDSLoader();
+ * loader.setResourcePath( 'models/3ds/portalgun/textures/' );
+ * const object = await loader.loadAsync( 'models/3ds/portalgun/portalgun.3ds' );
+ * scene.add( object );
+ *
+ * @augments Loader
  */
-
 class TDSLoader extends Loader {
 
+	/**
+	 * Constructs a new 3DS loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * Whether debug mode should be enabled or not.
+		 *
+		 * @type {boolean}
+		 * @default false
+		 */
 		this.debug = false;
 
+		// internals
+
 		this.group = null;
 
 		this.materials = [];
@@ -38,13 +56,13 @@ class TDSLoader extends Loader {
 	}
 
 	/**
-	 * Load 3ds file from url.
+	 * Starts loading from the given URL and passes the loaded 3DS asset
+	 * to the `onLoad()` callback.
 	 *
-	 * @method load
-	 * @param {string} url URL for the file.
-	 * @param {Function} onLoad onLoad callback, receives group Object3D as argument.
-	 * @param {Function} onProgress onProgress callback.
-	 * @param {Function} onError onError callback.
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
 	 */
 	load( url, onLoad, onProgress, onError ) {
 
@@ -85,12 +103,11 @@ class TDSLoader extends Loader {
 	}
 
 	/**
-	 * Parse arraybuffer data and load 3ds file.
+	 * Parses the given 3DS data and returns the resulting data.
 	 *
-	 * @method parse
-	 * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
-	 * @param {string} path Path for external resources.
-	 * @return {Group} Group loaded from 3ds file.
+	 * @param {ArrayBuffer} arraybuffer - The raw 3DS data as an array buffer.
+	 * @param {string} path - The asset path.
+	 * @return {Group} The parsed assset represented as a group.
 	 */
 	parse( arraybuffer, path ) {
 
@@ -113,9 +130,9 @@ class TDSLoader extends Loader {
 	/**
 	 * Decode file content to read 3ds data.
 	 *
-	 * @method readFile
-	 * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
-	 * @param {string} path Path for external resources.
+	 * @private
+	 * @param {ArrayBuffer} arraybuffer - Arraybuffer data to be loaded.
+	 * @param {string} path - Path for external resources.
 	 */
 	readFile( arraybuffer, path ) {
 
@@ -156,9 +173,9 @@ class TDSLoader extends Loader {
 	/**
 	 * Read mesh data chunk.
 	 *
-	 * @method readMeshData
-	 * @param {Chunk} chunk to read mesh from
-	 * @param {string} path Path for external resources.
+	 * @private
+	 * @param {Chunk} chunk - to read mesh from
+	 * @param {string} path - Path for external resources.
 	 */
 	readMeshData( chunk, path ) {
 
@@ -202,8 +219,8 @@ class TDSLoader extends Loader {
 	/**
 	 * Read named object chunk.
 	 *
-	 * @method readNamedObject
-	 * @param {Chunk} chunk Chunk in use.
+	 * @private
+	 * @param {Chunk} chunk - Chunk in use.
 	 */
 	readNamedObject( chunk ) {
 
@@ -233,9 +250,9 @@ class TDSLoader extends Loader {
 	/**
 	 * Read material data chunk and add it to the material list.
 	 *
-	 * @method readMaterialEntry
-	 * @param {Chunk} chunk Chunk in use.
-	 * @param {string} path Path for external resources.
+	 * @private
+	 * @param {Chunk} chunk - Chunk in use.
+	 * @param {string} path - Path for external resources.
 	 */
 	readMaterialEntry( chunk, path ) {
 
@@ -335,9 +352,9 @@ class TDSLoader extends Loader {
 	/**
 	 * Read mesh data chunk.
 	 *
-	 * @method readMesh
-	 * @param {Chunk} chunk Chunk in use.
-	 * @return {Mesh} The parsed mesh.
+	 * @private
+	 * @param {Chunk} chunk - Chunk in use.
+	 * @return {Mesh} - The parsed mesh.
 	 */
 	readMesh( chunk ) {
 
@@ -459,9 +476,9 @@ class TDSLoader extends Loader {
 	/**
 	 * Read face array data chunk.
 	 *
-	 * @method readFaceArray
-	 * @param {Chunk} chunk Chunk in use.
-	 * @param {Mesh} mesh Mesh to be filled with the data read.
+	 * @private
+	 * @param {Chunk} chunk - Chunk in use.
+	 * @param {Mesh} mesh - Mesh to be filled with the data read.
 	 */
 	readFaceArray( chunk, mesh ) {
 
@@ -527,9 +544,9 @@ class TDSLoader extends Loader {
 	/**
 	 * Read texture map data chunk.
 	 *
-	 * @method readMap
-	 * @param {Chunk} chunk Chunk in use.
-	 * @param {string} path Path for external resources.
+	 * @private
+	 * @param {Chunk} chunk - Chunk in use.
+	 * @param {string} path - Path for external resources.
 	 * @return {Texture} Texture read from this data chunk.
 	 */
 	readMap( chunk, path ) {
@@ -586,8 +603,8 @@ class TDSLoader extends Loader {
 	/**
 	 * Read material group data chunk.
 	 *
-	 * @method readMaterialGroup
-	 * @param {Chunk} chunk Chunk in use.
+	 * @private
+	 * @param {Chunk} chunk - Chunk in use.
 	 * @return {Object} Object with name and index of the object.
 	 */
 	readMaterialGroup( chunk ) {
@@ -612,9 +629,9 @@ class TDSLoader extends Loader {
 	/**
 	 * Read a color value.
 	 *
-	 * @method readColor
-	 * @param {Chunk} chunk Chunk.
-	 * @return {Color} Color value read..
+	 * @private
+	 * @param {Chunk} chunk - Chunk.
+	 * @return {Color} Color value read.
 	 */
 	readColor( chunk ) {
 
@@ -654,8 +671,8 @@ class TDSLoader extends Loader {
 	/**
 	 * Read percentage value.
 	 *
-	 * @method readPercentage
-	 * @param {Chunk} chunk Chunk to read data from.
+	 * @private
+	 * @param {Chunk} chunk - Chunk to read data from.
 	 * @return {number} Data read from the dataview.
 	 */
 	readPercentage( chunk ) {
@@ -685,8 +702,8 @@ class TDSLoader extends Loader {
 	 *
 	 * Is controlled by a flag to show or hide debug messages.
 	 *
-	 * @method debugMessage
-	 * @param {Object} message Debug message to print to the console.
+	 * @private
+	 * @param {Object} message - Debug message to print to the console.
 	 */
 	debugMessage( message ) {
 
@@ -700,17 +717,20 @@ class TDSLoader extends Loader {
 
 }
 
-
-/** Read data/sub-chunks from chunk */
+/**
+ * Read data/sub-chunks from chunk.
+ *
+ * @private
+ */
 class Chunk {
 
 	/**
 	 * Create a new chunk
 	 *
-	 * @class Chunk
-	 * @param {DataView} data DataView to read from.
-	 * @param {number} position in data.
-	 * @param {Function} debugMessage logging callback.
+	 * @private
+	 * @param {DataView} data - DataView to read from.
+	 * @param {number} position - In data.
+	 * @param {Function} debugMessage - Logging callback.
 	 */
 	constructor( data, position, debugMessage ) {
 
@@ -740,10 +760,10 @@ class Chunk {
 	}
 
 	/**
-	 * read a sub cchunk.
+	 * Reads a sub cchunk.
 	 *
-	 * @method readChunk
-	 * @return {Chunk | null} next sub chunk
+	 * @private
+	 * @return {Chunk | null} next sub chunk.
 	 */
 	readChunk() {
 
@@ -769,9 +789,9 @@ class Chunk {
 	}
 
 	/**
-	 * return the ID of this chunk as Hex
+	 * Returns the ID of this chunk as Hex
 	 *
-	 * @method idToString
+	 * @private
 	 * @return {string} hex-string of id
 	 */
 	get hexId() {
@@ -789,7 +809,7 @@ class Chunk {
 	/**
 	 * Read byte value.
 	 *
-	 * @method readByte
+	 * @private
 	 * @return {number} Data read from the dataview.
 	 */
 	readByte() {
@@ -803,7 +823,7 @@ class Chunk {
 	/**
 	 * Read 32 bit float value.
 	 *
-	 * @method readFloat
+	 * @private
 	 * @return {number} Data read from the dataview.
 	 */
 	readFloat() {
@@ -826,7 +846,7 @@ class Chunk {
 	/**
 	 * Read 32 bit signed integer value.
 	 *
-	 * @method readInt
+	 * @private
 	 * @return {number} Data read from the dataview.
 	 */
 	readInt() {
@@ -840,7 +860,7 @@ class Chunk {
 	/**
 	 * Read 16 bit signed integer value.
 	 *
-	 * @method readShort
+	 * @private
 	 * @return {number} Data read from the dataview.
 	 */
 	readShort() {
@@ -854,7 +874,7 @@ class Chunk {
 	/**
 	 * Read 64 bit unsigned integer value.
 	 *
-	 * @method readDWord
+	 * @private
 	 * @return {number} Data read from the dataview.
 	 */
 	readDWord() {
@@ -868,7 +888,7 @@ class Chunk {
 	/**
 	 * Read 32 bit unsigned integer value.
 	 *
-	 * @method readWord
+	 * @private
 	 * @return {number} Data read from the dataview.
 	 */
 	readWord() {
@@ -882,7 +902,7 @@ class Chunk {
 	/**
 	 * Read NULL terminated ASCII string value from chunk-pos.
 	 *
-	 * @method readString
+	 * @private
 	 * @return {string} Data read from the dataview.
 	 */
 	readString() {

+ 22 - 0
examples/jsm/loaders/TGALoader.js

@@ -3,14 +3,36 @@ import {
 	LinearMipmapLinearFilter
 } from 'three';
 
+/**
+ * A loader for the TGA texture format.
+ *
+ * ```js
+ * const loader = new TGALoader();
+ * const texture = await loader.loadAsync( 'textures/crate_color8.tga' );
+ * texture.colorSpace = THREE.SRGBColorSpace; // only for color textures
+ * ```
+ *
+ * @augments DataTextureLoader
+ */
 class TGALoader extends DataTextureLoader {
 
+	/**
+	 * Constructs a new TGA loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Parses the given TGA texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
+	 */
 	parse( buffer ) {
 
 		// reference from vthibault, https://github.com/vthibault/roBrowser/blob/master/src/Loaders/Targa.js

+ 22 - 0
examples/jsm/loaders/TIFFLoader.js

@@ -6,14 +6,36 @@ import {
 
 import UTIF from '../libs/utif.module.js';
 
+/**
+ * A loader for the TIFF texture format.
+ *
+ * ```js
+ * const loader = new TIFFLoader();
+ * const texture = await loader.loadAsync( 'textures/tiff/crate_lzw.tif' );
+ * texture.colorSpace = THREE.SRGBColorSpace;
+ * ```
+ *
+ * @augments DataTextureLoader
+ */
 class TIFFLoader extends DataTextureLoader {
 
+	/**
+	 * Constructs a new TIFF loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Parses the given TIFF texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
+	 */
 	parse( buffer ) {
 
 		const ifds = UTIF.decode( buffer );

+ 36 - 2
examples/jsm/loaders/TTFLoader.js

@@ -5,21 +5,49 @@ import {
 import opentype from '../libs/opentype.module.js';
 
 /**
- * Requires opentype.js to be included in the project.
+ * A loader for the TTF format.
+ *
  * Loads TTF files and converts them into typeface JSON that can be used directly
  * to create THREE.Font objects.
+ *
+ * ```js
+ * const loader = new TTFLoader();
+ * const json = await loader.loadAsync( 'fonts/ttf/kenpixel.ttf' );
+ * const font = new Font( json );
+ * ```
+ *
+ * @augments Loader
  */
-
 class TTFLoader extends Loader {
 
+	/**
+	 * Constructs a new TTF loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * Whether the TTF commands should be reversed or not.
+		 *
+		 * @type {boolean}
+		 * @default false
+		 */
 		this.reversed = false;
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded TTF asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Object)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -55,6 +83,12 @@ class TTFLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given TTF data and returns a JSON for creating a font.
+	 *
+	 * @param {ArrayBuffer} arraybuffer - The raw TTF data as an array buffer.
+	 * @return {Object} The result JSON.
+	 */
 	parse( arraybuffer ) {
 
 		function convert( font, reversed ) {

+ 33 - 0
examples/jsm/loaders/USDZLoader.js

@@ -116,14 +116,41 @@ class USDAParser {
 
 }
 
+/**
+ * A loader for the USDZ format.
+ *
+ * USDZ files that use USDC internally are not yet supported, only USDA.
+ *
+ * ```js
+ * const loader = new USDZLoader();
+ * const model = await loader.loadAsync( 'saeukkang.usdz' );
+ * scene.add( model );
+ * ```
+ *
+ * @augments Loader
+ */
 class USDZLoader extends Loader {
 
+	/**
+	 * Constructs a new USDZ loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded USDZ asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Group)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -159,6 +186,12 @@ class USDZLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given USDZ data and returns the resulting group.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw USDZ data as an array buffer.
+	 * @return {Group} The parsed asset as a group.
+	 */
 	parse( buffer ) {
 
 		const parser = new USDAParser();

+ 58 - 12
examples/jsm/loaders/UltraHDRLoader.js

@@ -12,10 +12,8 @@ import {
 	UVMapping,
 } from 'three';
 
-// UltraHDR Image Format - https://developer.android.com/media/platform/hdr-image-format
-// HDR/EXR to UltraHDR Converter - https://gainmap-creator.monogrid.com/
-
 /**
+ * UltraHDR Image Format - https://developer.android.com/media/platform/hdr-image-format
  *
  * Short format brief:
  *
@@ -30,36 +28,68 @@ import {
  * Binary image storages are prefixed with a unique 0xFFD8 16-bit descriptor.
  */
 
+
+// Calculating this SRGB powers is extremely slow for 4K images and can be sufficiently precalculated for a 3-4x speed boost
+const SRGB_TO_LINEAR = Array( 1024 )
+	.fill( 0 )
+	.map( ( _, value ) =>
+		Math.pow( ( value / 255 ) * 0.9478672986 + 0.0521327014, 2.4 )
+	);
+
 /**
+ * A loader for the Ultra HDR Image Format.
+ *
+ * Exisitng HDR or EXR textures can be converted to Ultra HDR with this [tool]{@link https://gainmap-creator.monogrid.com/}.
+ *
  * Current feature set:
  * - JPEG headers (required)
  * - XMP metadata (required)
- *  - XMP validation (not implemented)
+ * - XMP validation (not implemented)
  * - EXIF profile (not implemented)
  * - ICC profile (not implemented)
  * - Binary storage for SDR & HDR images (required)
  * - Gainmap metadata (required)
  * - Non-JPEG image formats (not implemented)
  * - Primary image as an HDR image (not implemented)
+ *
+ * ```js
+ * const loader = new UltraHDRLoader();
+ * const texture = await loader.loadAsync( 'textures/equirectangular/ice_planet_close.jpg' );
+ * texture.mapping = THREE.EquirectangularReflectionMapping;
+ *
+ * scene.background = texture;
+ * scene.environment = texture;
+ * ```
+ *
+ * @augments Loader
  */
-
-/* Calculating this SRGB powers is extremely slow for 4K images and can be sufficiently precalculated for a 3-4x speed boost */
-const SRGB_TO_LINEAR = Array( 1024 )
-	.fill( 0 )
-	.map( ( _, value ) =>
-		Math.pow( ( value / 255 ) * 0.9478672986 + 0.0521327014, 2.4 )
-	);
-
 class UltraHDRLoader extends Loader {
 
+	/**
+	 * Constructs a new Ultra HDR loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
+		/**
+		 * The texture type.
+		 *
+		 * @type {(HalfFloatType|FloatType)}
+		 * @default HalfFloatType
+		 */
 		this.type = HalfFloatType;
 
 	}
 
+	/**
+	 * Sets the texture type.
+	 *
+	 * @param {(HalfFloatType|FloatType)} value - The texture type to set.
+	 * @return {RGBELoader} A reference to this loader.
+	 */
 	setDataType( value ) {
 
 		this.type = value;
@@ -68,6 +98,12 @@ class UltraHDRLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given Ultra HDR texture data.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw texture data.
+	 * @param {Function} onLoad - The `onLoad` callback.
+	 */
 	parse( buffer, onLoad ) {
 
 		const xmpMetadata = {
@@ -262,6 +298,16 @@ class UltraHDRLoader extends Loader {
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded Ultra HDR texture
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the files to be loaded. This can also be a data URI.
+	 * @param {function(DataTexture)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 * @return {DataTexture} The Ultra HDR texture.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const texture = new DataTexture(

+ 57 - 0
examples/jsm/loaders/VOXLoader.js

@@ -13,8 +13,35 @@ import {
 	SRGBColorSpace
 } from 'three';
 
+/**
+ * A loader for the VOX format.
+ *
+ * ```js
+ * const loader = new VOXLoader();
+ * const chunks = await loader.loadAsync( 'models/vox/monu10.vox' );
+ *
+ * for ( let i = 0; i < chunks.length; i ++ ) {
+ *
+ * 	const chunk = chunks[ i ];
+ * 	const mesh = new VOXMesh( chunk );
+ * 	mesh.scale.setScalar( 0.0015 );
+ * 	scene.add( mesh );
+ *
+ * }
+ * ```
+ * @augments Loader
+ */
 class VOXLoader extends Loader {
 
+	/**
+	 * Starts loading from the given URL and passes the loaded VOX asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Array<Object>)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -49,6 +76,12 @@ class VOXLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given VOX data and returns the resulting chunks.
+	 *
+	 * @param {ArrayBuffer} buffer - The raw VOX data as an array buffer.
+	 * @return {Array<Object>} The parsed chunks.
+	 */
 	parse( buffer ) {
 
 		const data = new DataView( buffer );
@@ -173,8 +206,20 @@ class VOXLoader extends Loader {
 
 }
 
+/**
+ * A VOX mesh.
+ *
+ * Instances of this class are created from the loaded chunks of {@link VOXLoader}.
+ *
+ * @augments Mesh
+ */
 class VOXMesh extends Mesh {
 
+	/**
+	 * Constructs a new VOX mesh.
+	 *
+	 * @param {Object} chunk - A VOX chunk loaded via {@link VOXLoader}.
+	 */
 	constructor( chunk ) {
 
 		const data = chunk.data;
@@ -279,8 +324,20 @@ class VOXMesh extends Mesh {
 
 }
 
+/**
+ * A VOX 3D texture.
+ *
+ * Instances of this class are created from the loaded chunks of {@link VOXLoader}.
+ *
+ * @augments Data3DTexture
+ */
 class VOXData3DTexture extends Data3DTexture {
 
+	/**
+	 * Constructs a new VOX 3D texture.
+	 *
+	 * @param {Object} chunk - A VOX chunk loaded via {@link VOXLoader}.
+	 */
 	constructor( chunk ) {
 
 		const data = chunk.data;

+ 32 - 1
examples/jsm/loaders/VRMLLoader.js

@@ -36,15 +36,39 @@ import {
 } from 'three';
 import chevrotain from '../libs/chevrotain.module.min.js';
 
-
+/**
+ * A loader for the VRML format.
+ *
+ * ```js
+ * const loader = new VRMLLoader();
+ * const object = await loader.loadAsync( 'models/vrml/house.wrl' );
+ * scene.add( object );
+ * ```
+ *
+ * @augments Loader
+ */
 class VRMLLoader extends Loader {
 
+	/**
+	 * Constructs a new VRML loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded VRML asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(Scene)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -81,6 +105,13 @@ class VRMLLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given VRML data and returns the resulting scene.
+	 *
+	 * @param {string} data - The raw VRML data as a string.
+	 * @param {string} path - The URL base path.
+	 * @return {Scene} The parsed scene.
+	 */
 	parse( data, path ) {
 
 		const nodeMap = {};

+ 38 - 0
examples/jsm/loaders/VTKLoader.js

@@ -9,14 +9,46 @@ import {
 } from 'three';
 import * as fflate from '../libs/fflate.module.js';
 
+/**
+ * A loader for the VTK format.
+ *
+ * This loader only supports the `POLYDATA` dataset format so far. Other formats
+ * (structured points, structured grid, rectilinear grid, unstructured grid, appended)
+ * are not supported.
+ *
+ * ```js
+ * const loader = new VTKLoader();
+ * const geometry = await loader.loadAsync( 'models/vtk/liver.vtk' );
+ * geometry.computeVertexNormals();
+ *
+ * const mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial() );
+ * scene.add( mesh );
+ * ```
+ *
+ * @augments Loader
+ */
 class VTKLoader extends Loader {
 
+	/**
+	 * Constructs a new VTK loader.
+	 *
+	 * @param {LoadingManager} [manager] - The loading manager.
+	 */
 	constructor( manager ) {
 
 		super( manager );
 
 	}
 
+	/**
+	 * Starts loading from the given URL and passes the loaded VRML asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -52,6 +84,12 @@ class VTKLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given VTK data and returns the resulting geometry.
+	 *
+	 * @param {ArrayBuffer} data - The raw VTK data as an array buffer
+	 * @return {BufferGeometry} The parsed geometry.
+	 */
 	parse( data ) {
 
 		function parseASCII( data ) {

+ 35 - 0
examples/jsm/loaders/XYZLoader.js

@@ -7,8 +7,37 @@ import {
 	SRGBColorSpace
 } from 'three';
 
+/**
+ * A loader for the XYZ format.
+ *
+ * XYZ is a very simple format for storing point clouds. The layouts
+ * `XYZ` (points) and `XYZRGB` (points + colors) are supported.
+ *
+ * ```js
+ * const loader = new XYZLoader();
+ * const geometry = await loader.loadAsync( 'models/xyz/helix_201.xyz' );
+ * geometry.center();
+ *
+ * const vertexColors = ( geometry.hasAttribute( 'color' ) === true );
+ * const material = new THREE.PointsMaterial( { size: 0.1, vertexColors: vertexColors } );
+ *
+ * const points = new THREE.Points( geometry, material );
+ * scene.add( points );
+ * ```
+ *
+ * @augments Loader
+ */
 class XYZLoader extends Loader {
 
+	/**
+	 * Starts loading from the given URL and passes the loaded XYZ asset
+	 * to the `onLoad()` callback.
+	 *
+	 * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
+	 * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished.
+	 * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
+	 * @param {onErrorCallback} onError - Executed when errors occur.
+	 */
 	load( url, onLoad, onProgress, onError ) {
 
 		const scope = this;
@@ -43,6 +72,12 @@ class XYZLoader extends Loader {
 
 	}
 
+	/**
+	 * Parses the given XYZ data and returns the resulting geometry.
+	 *
+	 * @param {string} text - The raw XYZ data as a string.
+	 * @return {BufferGeometry} The geometry representing the point cloud.
+	 */
 	parse( text ) {
 
 		const lines = text.split( '\n' );

+ 12 - 0
src/loaders/CompressedTextureLoader.js

@@ -151,5 +151,17 @@ class CompressedTextureLoader extends Loader {
 
 }
 
+/**
+ * Represents the result object type of the `parse()` method.
+ *
+ * @typedef {Object} CompressedTextureLoader~TexData
+ * @property {number} width - The width of the base mip.
+ * @property {number} height - The width of the base mip.
+ * @property {boolean} isCubemap - Whether the data represent a cubemap or not.
+ * @property {number} mipmapCount - The mipmap count.
+ * @property {Array<{data:TypedArray,width:number,height:number}>} mipmaps - An array holding the mipmaps.
+ * Each entry holds the data and the dimensions for each level.
+ * @property {number} format - The texture format.
+ **/
 
 export { CompressedTextureLoader };

+ 20 - 0
src/loaders/DataTextureLoader.js

@@ -148,5 +148,25 @@ class DataTextureLoader extends Loader {
 
 }
 
+/**
+ * Represents the result object type of the `parse()` method.
+ *
+ * @typedef {Object} DataTextureLoader~TexData
+ * @property {Object} [image] - An object holding width, height and the texture data.
+ * @property {number} [width] - The width of the base mip.
+ * @property {number} [height] - The width of the base mip.
+ * @property {TypedArray} [data] - The texture data.
+ * @property {number} [format] - The texture format.
+ * @property {number} [type] - The texture type.
+ * @property {boolean} [flipY] - If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU.
+ * @property {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.
+ * @property {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.
+ * @property {number} [anisotropy=1] - The anisotropy value.
+ * @property {boolean} [generateMipmaps] - Whether to generate mipmaps or not.
+ * @property {string} [colorSpace] - The color space.
+ * @property {number} [magFilter] - The mag filter.
+ * @property {number} [minFilter] - The min filter.
+ * @property {Array<Object>} [mipmaps] - The mipmaps.
+ **/
 
 export { DataTextureLoader };

+ 2 - 0
utils/docs/jsdoc.config.json

@@ -26,6 +26,7 @@
             "examples/jsm/lighting",
             "examples/jsm/lights",
             "examples/jsm/lines",
+            "examples/jsm/loaders",
             "examples/jsm/materials",
             "examples/jsm/math",
             "examples/jsm/misc",
@@ -45,6 +46,7 @@
             "examples/jsm/helpers/TextureHelperGPU.js",
             "examples/jsm/libs",
             "examples/jsm/lines/webgpu",
+            "examples/jsm/loaders/lwo",
             "examples/jsm/materials/LDrawConditionalLineNodeMaterial.js",
             "examples/jsm/misc/ProgressiveLightMapGPU.js",
             "examples/jsm/modifiers/CurveModifierGPU.js",

粤ICP备19079148号