Browse Source

Completed LoaderSupport documentation.

Kai Salmen 7 years ago
parent
commit
f75c797868
2 changed files with 489 additions and 64 deletions
  1. 408 46
      docs/examples/loaders/LoaderSupport.html
  2. 81 18
      examples/js/loaders/LoaderSupport.js

+ 408 - 46
docs/examples/loaders/LoaderSupport.html

@@ -11,16 +11,20 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">Supporting classes for file loaders.</div>
+		<div class="desc">Supporting classes for file loaders and web worker based loaders.</div>
 
 		<h2>Sub-Classes</h2>
 		[page:LoaderSupport.Builder]<br>
 		[page:LoaderSupport.LoadedMeshUserOverride]<br>
-		[page:LoaderSupport.Commons]<br>
+		[page:LoaderSupport.WorkerSupport]<br>
+		[page:LoaderSupport.WorkerRunnerRefImpl]<br>
+		[page:LoaderSupport.WorkerDirector]<br>
 		[page:LoaderSupport.PrepData]<br>
+		[page:LoaderSupport.Commons]<br>
 		[page:LoaderSupport.Callbacks]<br>
-		[page:LoaderSupport.WorkerDirector]<br>
-		[page:LoaderSupport.WorkerSupport]
+		[page:LoaderSupport.Validator]<br>
+		[page:LoaderSupport.ConsoleLogger]
+
 
 		<h2>Example</h2>
 
@@ -34,12 +38,29 @@
 
 		<h3>Builder()</h3>
 		<div>
-			Builds one or many THREE.Mesh from one raw set of Arraybuffers, materialGroup descriptions and further parameters.
+			Builds one or many [page:Mesh] from one raw set of Arraybuffers, materialGroup descriptions and further parameters.
 			Supports vertex, vertexColor, normal, uv and index buffers.
 		</div>
 
+
 		<h2>Methods</h2>
-		TODO
+
+		<h3>[method:null setMaterials] ( Array of [page:Material materials] )</h3>
+		<div>
+			Array of [page:Material materials] - Array of [page:Material Materials]
+		</div>
+		<div>
+			Set materials loaded by any supplier of an Array of [page:Material Materials].
+		</div>
+
+
+		<h3>[method:Array buildMeshes] (Object payload)</h3>
+		<div>
+			[page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes.
+		</div>
+		<div>
+			Builds one or multiple meshes from the data described in the payload (buffers, params, material info.
+		</div>
 		<br>
 		<br>
 
@@ -47,7 +68,7 @@
 		<a name="LoadedMeshUserOverride"></a><h1>LoadedMeshUserOverride</h1>
 		<h2>Constructor</h2>
 
-		<h3>LoadedMeshUserOverride( [page:Boolean disregardMesh], [page:THREE.BufferGeometry bufferGeometry], [page:THREE.Material material] )</h3>
+		<h3>LoadedMeshUserOverride( [page:Boolean disregardMesh], [page:BufferGeometry bufferGeometry] )</h3>
 		<div>
 			[page:Boolean disregardMesh] - Tell implementation to completely disregard this mesh<br>
 			[page:Boolean alteredMesh] - Tell implementation that mesh(es) have been altered or added
@@ -56,23 +77,199 @@
 			Object to return by callback onMeshAlter. Used to disregard a certain mesh or to return one to many meshes.
 		</div>
 
+
 		<h2>Methods</h2>
-		TODO
+
+		<h3>[method:null addMesh] ( [page:Mesh mesh] )</h3>
+		<div>
+			[page:Mesh mesh] - Mesh
+		</div>
+		<div>
+			Add a mesh created within callback.
+		</div>
+
+
+		<h3>[method:boolean isDisregardMesh] ()</h3>
+		<div>
+			Answers if mesh shall be disregarded completely.
+		</div>
+
+
+		<h3>[method:boolean providesAlteredMeshes] ()</h3>
+		<div>
+			Answers if new mesh(es) were created.
+		</div>
 		<br>
 		<br>
 
 
-		<h3>Commons()</h3>
+		<a name="WorkerSupport"></a><h1>WorkerSupport</h1>
+		<h2>Constructor</h2>
+
+		<h3>WorkerSupport( [page:LoaderSupport.ConsoleLogger logger] )</h3>
 		<div>
-			Base class to be used by loaders.
+			[page:LoaderSupport.ConsoleLogger logger] - logger to be used
 		</div>
+		<div>
+			This class provides means to transform existing parser code into a web worker.
+			It defines a simple communication protocol which allows to configure the worker and receive raw mesh data during execution.
+		</div>
+
 
 		<h2>Methods</h2>
-		TODO
+
+		<h3>[method:null validate] ( [page:Function functionCodeBuilder], [page:Boolean forceWorkerReload], [page:LoaderSupport.WorkerRunnerRefImpl runnerImpl] )</h3>
+		<div>
+			[page:Function functionCodeBuilder] - Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.
+			[page:Boolean forceWorkerReload] - Force re-build of the worker code.
+			[page:LoaderSupport.WorkerRunnerRefImpl runnerImpl] - The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.
+		</div>
+		<div>
+			Validate the status of worker code and the derived worker.
+		</div>
+
+
+		<h3>[method:null setTerminateRequested] ( [page:Boolean terminateRequested] )</h3>
+		<div>
+			[page:Boolean terminateRequested] - True or false.
+		</div>
+		<div>
+			Request termination of worker once parser is finished.
+		</div>
+
+
+		<h3>[method:null terminateWorker] ()</h3>
+		<div>
+			Terminate the worker and the code.
+		</div>
+
+
+		<h3>[method:null setCallbacks] ( [page:Function builder], [page:Function onLoad] )</h3>
+		<div>
+			[page:Function builder] - The builder function. Default is [page:LoaderSupport.Builder].
+			[page:Function onLoad] - The function that is called when parsing is complete.
+		</div>
+		<div>
+			Specify functions that should be build when new raw mesh data becomes available and when the parser is finished.
+		</div>
+
+
+		<h3>[method:null run] ( [page:Object payload] )</h3>
+		<div>
+			[page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes.
+		</div>
+		<div>
+			Runs the parser with the provided configuration.
+		</div>
 		<br>
 		<br>
 
 
+		<a name="WorkerRunnerRefImpl"></a><h1>WorkerRunnerRefImpl</h1>
+		<h2>Constructor</h2>
+
+		<h3>WorkerRunnerRefImpl()</h3>
+		<div>
+			Default implementation of the WorkerRunner responsible for creation and configuration of the parser within the worker.
+		</div>
+
+
+		<h2>Methods</h2>
+
+		<h3>[method:null applyProperties] ( [page:Object parser], [page:Object params] )</h3>
+		<div>
+			[page:Object parser] - The parser instance
+			[page:Object params] - The parameter object
+		</div>
+		<div>
+			Applies values from parameter object via set functions or via direct assignment.
+		</div>
+
+
+		<h3>[method:null run] ( [page:Object payload] )</h3>
+		<div>
+			[page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes.
+		</div>
+		<div>
+			Configures the Parser implementation according the supplied configuration object.
+		</div>
+		<br>
+		<br>
+
+
+		<a name="WorkerDirector"></a><h1>WorkerDirector</h1>
+		<h2>Constructor</h2>
+
+		<h3>WorkerDirector( [page:String classDef], [page:LoaderSupport.ConsoleLogger logger] )</h3>
+		<div>
+			[page:String classDef] - Class definition to be used for construction<br>
+			[page:LoaderSupport.ConsoleLogger logger] - logger to be used
+		</div>
+		<div>
+			Orchestrate loading of multiple OBJ files/data from an instruction queue with a configurable amount of workers (1-16).<br>
+			- Workflow:<br>
+			- prepareWorkers<br>
+			- enqueueForRun<br>
+			- processQueue<br>
+			- deregister
+		</div>
+
+
+		<h2>Methods</h2>
+
+		<h3>[method:null prepareWorkers]( [page:WWOBJLoader2.Callbacks globalCallbacks], [page:Number maxQueueSize], [page:Number maxWebWorkers] )</h3>
+		<div>
+			[page:LoaderSupport.Callbacks globalCallbacks] - Register global callbacks used by all web workers<br>
+			[page:Number maxQueueSize] - Set the maximum size of the instruction queue (1-1024)<br>
+			[page:Number maxWebWorkers] - Set the maximum amount of workers (1-16)
+		</div>
+		<div>
+			Create or destroy workers according limits. Set the name and register callbacks for dynamically created web workers.
+		</div>
+
+
+		<h3>[method:null enqueueForRun]( [page:LoaderSupport.PrepData runParams] )</h3>
+		<div>
+			[page:LoaderSupport.PrepData runParams]
+		</div>
+		<div>
+			Store run instructions in internal instructionQueue.
+		</div>
+
+
+		<h3>[method:null processQueue]()</h3>
+		<div>
+			Process the instructionQueue until it is depleted.
+		</div>
+
+
+		<h3>[method:null deregister]()</h3>
+		<div>
+			Terminate all workers.
+		</div>
+
+
+		<h3>[method:null getMaxQueueSize]()</h3>
+		<div>
+			Returns the maximum length of the instruction queue.
+		</div>
+
+
+		<h3>[method:null getMaxWebWorkers]()</h3>
+		<div>
+			Returns the maximum number of workers.
+		</div>
+
+
+		<h3>[method:null setCrossOrigin]( [page:String crossOrigin] )</h3>
+		<div>
+			[page:String crossOrigin] - CORS value
+		</div>
+		<div>
+			Sets the CORS string to be used.
+		</div>
+
+
 		<a name="PrepData"></a><h1>PrepData</h1>
 		<h2>Constructor</h2>
 
@@ -84,6 +281,7 @@
 			Configuration instructions to be used by run method.
 		</div>
 
+
 		<h2>Methods</h2>
 
 		<h3>[method:null setStreamMeshesTo] ( [page:Object3D streamMeshesTo] )</h3>
@@ -157,6 +355,94 @@
 		<br>
 
 
+		<a name="Commons"></a><h1>Commons</h1>
+		<h2>Constructor</h2>
+
+		<h3>Commons( [page:LoaderSupport.ConsoleLogger logger], [page:LoadingManager manager] )</h3>
+		<div>
+			[page:LoaderSupport.ConsoleLogger logger] - logger to be used
+			[page:LoadingManager manager] - The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+		</div>
+		<div>
+			Base class to be used by loaders.
+		</div>
+
+
+		<h2>Methods</h2>
+
+		<h3>[method:ConsoleLogger getLogger] ()</h3>
+		<div>
+			Returns [page:LoaderSupport.ConsoleLogger].
+		</div>
+
+
+		<h3>[method:null setModelName] ( [page:String modelName] )</h3>
+		<div>
+			[page:String modelName]
+		</div>
+		<div>
+			Set the name of the model.
+		</div>
+
+
+		<h3>[method:null setPath] ( [page:String path] )</h3>
+		<div>
+			[page:String path] - URL
+		</div>
+		<div>
+			The URL of the base path.
+		</div>
+
+
+		<h3>[method:null setStreamMeshesTo] ( [page:Object3D streamMeshesTo] )</h3>
+		<div>
+			[page:Object3D streamMeshesTo] - Object already attached to scenegraph where new meshes will be attached to
+		</div>
+		<div>
+			Set the node where the loaded objects will be attached directly.
+		</div>
+
+
+		<h3>[method:null setMaterials] ( Array of [page:Material materials] )</h3>
+		<div>
+			Array of [page:Material materials] - Array of [page:Material Materials]
+		</div>
+		<div>
+			Set materials loaded by MTLLoader or any other supplier of an Array of [page:Material Materials].
+		</div>
+
+
+		<h3>[method:null setUseIndices]( [page:Boolean useIndices] )</h3>
+		<div>
+			[page:Boolean useIndices]
+		</div>
+		<div>
+			Instructs loaders to create indexed [page:BufferGeometry].
+		</div>
+
+
+		<h3>[method:null setDisregardNormals]( [page:Boolean disregardNormals] )</h3>
+		<div>
+			[page:Boolean disregardNormals]
+		</div>
+		<div>
+			Tells whether normals should be completely disregarded and regenerated.
+		</div>
+
+
+		<h3>[method:null onProgress]( [page:String type], [page:String text], [page:Number numericalValue] )</h3>
+		<div>
+			[page:String type] - The type of event<br>
+			[page:String text] - Textual description of the event<br>
+			[page:Number numericalValue] - Numerical value describing the progress
+		</div>
+		<div>
+			Announce feedback which is give to the registered [page:LoaderSupport.Callbacks].
+		</div>
+		<br>
+		<br>
+
+
 		<a name="Callbacks"></a><h1>Callbacks</h1>
 		<h2>Constructor</h2>
 
@@ -165,92 +451,168 @@
 			Callbacks utilized by loaders and builder.
 		</div>
 
+
 		<h2>Methods</h2>
-		TODO
+
+		<h3>[method:null setCallbackOnProgress]( [page:Function callbackOnProgress] )</h3>
+		<div>
+			[page:Function callbackOnProgress] - Callback function for described functionality
+		</div>
+		<div>
+			Register callback function that is invoked by internal function "announceProgress" to print feedback.
+		</div>
+
+
+		<h3>[method:null setCallbackOnMeshAlter]( [page:Function callbackOnMeshAlter] )</h3>
+		<div>
+			[page:Function callbackOnMeshAlter] - Callback function for described functionality
+		</div>
+		<div>
+			Register callback function that is called every time a mesh was loaded.
+			Use [page:LoadedMeshUserOverride] for alteration instructions (geometry, material or disregard mesh).
+		</div>
+
+
+		<h3>[method:null setCallbackOnLoad]( [page:Function callbackOnLoad] )</h3>
+		<div>
+			[page:Function callbackOnLoad] - Callback function for described functionality
+		</div>
+		<div>
+			Register callback function that is called once loading of the complete OBJ file is completed.
+		</div>
 		<br>
 		<br>
 
 
-		<a name="WorkerDirector"></a><h1>WorkerDirector</h1>
+		<a name="Validator"></a><h1>Validator</h1>
 		<h2>Constructor</h2>
 
-		<h3>WorkerDirector( [page:String classDef], [page:LoaderSupport.ConsoleLogger logger] )</h3>
+		<h3>Validator()</h3>
 		<div>
-			[page:String classDef] - Class definition to be used for construction<br>
-			[page:LoaderSupport.ConsoleLogger logger] - logger to be used
+			Validation functions.
 		</div>
+
+
+		<h2>Methods</h2>
+
+		<h3>[method:null isValid]( [page:Object input] )</h3>
 		<div>
-			Orchestrate loading of multiple OBJ files/data from an instruction queue with a configurable amount of workers (1-16).<br>
-			- Workflow:<br>
-			- prepareWorkers<br>
-			- enqueueForRun<br>
-			- processQueue<br>
-			- deregister
+			[page:Object input] - Can be anything
+		</div>
+		<div>
+			If given input is null or undefined, false is returned otherwise true.
 		</div>
 
 
-		<h3>[method:null prepareWorkers]( [page:WWOBJLoader2.Callbacks globalCallbacks], [page:Number maxQueueSize], [page:Number maxWebWorkers] )</h3>
+		<h3>[method:null verifyInput]( [page:Object input], [page:Object defaultValue] )</h3>
 		<div>
-			[page:LoaderSupport.Callbacks globalCallbacks] - Register global callbacks used by all web workers<br>
-			[page:Number maxQueueSize] - Set the maximum size of the instruction queue (1-1024)<br>
-			[page:Number maxWebWorkers] - Set the maximum amount of workers (1-16)
+			[page:Object input] - Can be anything
+			[page:Object defaultValue] - Can be anything
 		</div>
 		<div>
-			Create or destroy workers according limits. Set the name and register callbacks for dynamically created web workers.
+			If given input is null or undefined, the defaultValue is returned otherwise the given input.
 		</div>
+		<br>
+		<br>
 
 
-		<h3>[method:null enqueueForRun]( [page:LoaderSupport.PrepData runParams] )</h3>
+		<a name="ConsoleLogger"></a><h1>ConsoleLogger</h1>
+		<h2>Constructor</h2>
+
+		<h3>ConsoleLogger( [page:Boolean enabled], [page:Boolean debug] )</h3>
 		<div>
-			[page:LoaderSupport.PrepData runParams]
+			[page:Boolean enabled] - Tell if logger is enabled.
+			[page:Boolean debug] - Toggle debug logging.
+		<div>
+			Logging wrapper for console.
 		</div>
+
+
+		<h2>Methods</h2>
+
+		<h3>[method:null setDebug]( [page:Boolean debug] )</h3>
 		<div>
-			Store run instructions in internal instructionQueue.
+			[page:Boolean debug] - True or False
+		</div>
+		<div>
+			Enable or disable debug logging.
 		</div>
 
 
-		<h3>[method:null processQueue]()</h3>
+		<h3>[method:Boolean isDebug]()</h3>
 		<div>
-			Process the instructionQueue until it is depleted.
+			Returns if is enabled and debug.
 		</div>
 
+		<h3>[method:null setEnabled]( [page:Boolean enabled] )</h3>
+		<div>
+			[page:Boolean enabled] - True or False
+		</div>
+		<div>
+			Enable or disable info, debug and time logging.
+		</div>
 
-		<h3>[method:null deregister]()</h3>
+
+		<h3>[method:Boolean isEnabled]()</h3>
 		<div>
-			Terminate all workers.
+			Returns if is enabled.
 		</div>
 
 
-		<h3>[method:null getMaxQueueSize]()</h3>
+		<h3>[method:null logDebug]( [page:String message] )</h3>
 		<div>
-			Returns the maximum length of the instruction queue.
+			[page:String message] - Message to log
+		</div>
+		<div>
+			Log a debug message if enabled and debug is set.
 		</div>
 
 
-		<h3>[method:null getMaxWebWorkers]()</h3>
+		<h3>[method:null logInfo]( [page:String message] )</h3>
 		<div>
-			Returns the maximum number of workers.
+			[page:String message] - Message to log
+		</div>
+		<div>
+			Log an info message if enabled.
 		</div>
 
 
-		<h3>[method:null setCrossOrigin]( [page:String crossOrigin] )</h3>
+		<h3>[method:null logWarn]( [page:String message] )</h3>
 		<div>
-			[page:String crossOrigin] - CORS value
+			[page:String message] - Message to log
 		</div>
 		<div>
-			Sets the CORS string to be used.
+			Log a warn message (always).
 		</div>
 
 
-		<h3>WorkerSupport()</h3>
+		<h3>[method:null logError]( [page:String message] )</h3>
+		<div>
+			[page:String message] - Message to log
+		</div>
 		<div>
-			WorkerSupport
+			Log an error message (always).
 		</div>
 
-		<h2>Methods</h2>
-		TODO
-		<br>
 
+		<h3>[method:null logTimeStart]( [page:String id] )</h3>
+		<div>
+			[page:String id] - Time identification
+		</div>
+		<div>
+			Start time measurement with provided id.
+		</div>
+
+
+		<h3>[method:null logTimeEnd]( [page:String id] )</h3>
+		<div>
+			[page:String id] - Time identification
+		</div>
+		<div>
+			Stop time measurement started with provided id.
+		</div>
+		<br>
+		<br>
 
 		<h2>Source</h2>
 

+ 81 - 18
examples/js/loaders/LoaderSupport.js

@@ -8,14 +8,14 @@
 if ( THREE.LoaderSupport === undefined ) { THREE.LoaderSupport = {} }
 
 /**
- * Validation functions
+ * Validation functions.
  * @class
  */
 THREE.LoaderSupport.Validator = {
 	/**
 	 * If given input is null or undefined, false is returned otherwise true.
 	 *
-	 * @param input Anything
+	 * @param input Can be anything
 	 * @returns {boolean}
 	 */
 	isValid: function( input ) {
@@ -24,8 +24,8 @@ THREE.LoaderSupport.Validator = {
 	/**
 	 * If given input is null or undefined, the defaultValue is returned otherwise the given input.
 	 *
-	 * @param input Anything
-	 * @param defaultValue Anything
+	 * @param input Can be anything
+	 * @param defaultValue Can be anything
 	 * @returns {*}
 	 */
 	verifyInput: function( input, defaultValue ) {
@@ -35,8 +35,11 @@ THREE.LoaderSupport.Validator = {
 
 
 /**
- * Logging wrapper for console
+ * Logging wrapper for console.
  * @class
+ *
+ * @param {boolean} enabled=true Tell if logger is enabled.
+ * @param {boolean} debug=false Toggle debug logging.
  */
 THREE.LoaderSupport.ConsoleLogger = (function () {
 
@@ -46,7 +49,7 @@ THREE.LoaderSupport.ConsoleLogger = (function () {
 	}
 
 	/**
-	 * Enable or disable debug logging
+	 * Enable or disable debug logging.
 	 * @memberOf THREE.LoaderSupport.ConsoleLogger
 	 *
 	 * @param {boolean} debug True or False
@@ -56,7 +59,7 @@ THREE.LoaderSupport.ConsoleLogger = (function () {
 	};
 
 	/**
-	 * Returns if is enabled and debug
+	 * Returns if is enabled and debug.
 	 * @memberOf THREE.LoaderSupport.ConsoleLogger
 	 *
 	 * @returns {boolean}
@@ -66,7 +69,7 @@ THREE.LoaderSupport.ConsoleLogger = (function () {
 	};
 
 	/**
-	 * Enable or disable info, debug and time logging
+	 * Enable or disable info, debug and time logging.
 	 * @memberOf THREE.LoaderSupport.ConsoleLogger
 	 *
 	 * @param {boolean} enabled True or False
@@ -136,7 +139,7 @@ THREE.LoaderSupport.ConsoleLogger = (function () {
 	};
 
 	/**
-	 * Start time measurement with provided id.
+	 * Stop time measurement started with provided id.
 	 * @memberOf THREE.LoaderSupport.ConsoleLogger
 	 *
 	 * @param {string} id Time identification
@@ -184,7 +187,7 @@ THREE.LoaderSupport.Callbacks = (function () {
 	};
 
 	/**
-	 * Register callback function that is called once loading of the complete model is completed.
+	 * Register callback function that is called once loading of the complete OBJ file is completed.
 	 * @memberOf THREE.LoaderSupport.Callbacks
 	 *
 	 * @param {callback} callbackOnLoad Callback function for described functionality
@@ -262,10 +265,10 @@ THREE.LoaderSupport.Builder = (function () {
 	};
 
 	/**
-	 * Builds one or multiple meshes from the data described in the payload (buffers, params, material info,
+	 * Builds one or multiple meshes from the data described in the payload (buffers, params, material info.
 	 * @memberOf THREE.LoaderSupport.Builder
 	 *
-	 * @param {Object} payload buffers, params, materials
+	 * @param {Object} payload Raw mesh description (buffers, params, materials) used to build one to many meshes.
 	 * @returns {THREE.Mesh[]} mesh Array of {@link THREE.Mesh}
 	 */
 	Builder.prototype.buildMeshes = function ( payload ) {
@@ -451,6 +454,9 @@ THREE.LoaderSupport.Builder = (function () {
 /**
  * Base class to be used by loaders.
  * @class
+ *
+ * @param {THREE.LoaderSupport.ConsoleLogger} logger logger to be used
+ * @param {THREE.DefaultLoadingManager} [manager] The loadingManager for the loader to use. Default is {@link THREE.DefaultLoadingManager}
  */
 THREE.LoaderSupport.Commons = (function () {
 
@@ -563,13 +569,13 @@ THREE.LoaderSupport.Commons = (function () {
 	};
 
 	/**
-	 * Announce feedback which is give to the registered callbacks
+	 * Announce feedback which is give to the registered callbacks.
 	 * @memberOf THREE.LoaderSupport.Commons
 	 * @private
 	 *
-	 * @param {string} type
-	 * @param {string} text
-	 * @param {number} numericalValue
+	 * @param {string} type The type of event
+	 * @param {string} text Textual description of the event
+	 * @param {number} numericalValue Numerical value describing the progress
 	 */
 	Commons.prototype.onProgress = function ( type, text, numericalValue ) {
 		var content = Validator.isValid( text ) ? text: '';
@@ -616,6 +622,7 @@ THREE.LoaderSupport.LoadedMeshUserOverride = (function () {
 	 */
 	LoadedMeshUserOverride.prototype.addMesh = function ( mesh ) {
 		this.meshes.push( mesh );
+		this.alteredMesh = true;
 	};
 
 	/**
@@ -808,6 +815,11 @@ THREE.LoaderSupport.PrepData = (function () {
 	return PrepData;
 })();
 
+/**
+ * Default implementation of the WorkerRunner responsible for creation and configuration of the parser within the worker.
+ *
+ * @class
+ */
 THREE.LoaderSupport.WorkerRunnerRefImpl = (function () {
 
 	function WorkerRunnerRefImpl() {
@@ -818,6 +830,13 @@ THREE.LoaderSupport.WorkerRunnerRefImpl = (function () {
 		self.addEventListener( 'message', scopedRunner, false );
 	}
 
+	/**
+	 * Applies values from parameter object via set functions or via direct assignment.
+	 * @memberOf THREE.LoaderSupport.WorkerRunnerRefImpl
+	 *
+	 * @param {Object} parser The parser instance
+	 * @param {Object} params The parameter object
+	 */
 	WorkerRunnerRefImpl.prototype.applyProperties = function ( parser, params ) {
 		var property, funcName, values;
 		for ( property in params ) {
@@ -836,6 +855,12 @@ THREE.LoaderSupport.WorkerRunnerRefImpl = (function () {
 		}
 	};
 
+	/**
+	 * Configures the Parser implementation according the supplied configuration object.
+	 * @memberOf THREE.LoaderSupport.WorkerRunnerRefImpl
+	 *
+	 * @param {Object} payload Raw mesh description (buffers, params, materials) used to build one to many meshes.
+	 */
 	WorkerRunnerRefImpl.prototype.run = function ( payload ) {
 		var logger = new ConsoleLogger( payload.logger.enabled, payload.logger.debug );
 
@@ -876,6 +901,13 @@ THREE.LoaderSupport.WorkerRunnerRefImpl = (function () {
 	return WorkerRunnerRefImpl;
 })();
 
+/**
+ * This class provides means to transform existing parser code into a web worker. It defines a simple communication protocol
+ * which allows to configure the worker and receive raw mesh data during execution.
+ * @class
+ *
+ * @param {THREE.LoaderSupport.ConsoleLogger} logger logger to be used
+ */
 THREE.LoaderSupport.WorkerSupport = (function () {
 
 	var WORKER_SUPPORT_VERSION = '1.0.0';
@@ -902,6 +934,14 @@ THREE.LoaderSupport.WorkerSupport = (function () {
 		};
 	}
 
+	/**
+	 * Validate the status of worker code and the derived worker.
+	 * @memberOf THREE.LoaderSupport.WorkerSupport
+	 *
+	 * @param {Function} functionCodeBuilder Function that is invoked with funcBuildObject and funcBuildSingelton that allows stringification of objects and singletons.
+	 * @param {boolean} forceWorkerReload Force re-build of the worker code.
+	 * @param {THREE.LoaderSupport.WorkerRunnerRefImpl} runnerImpl The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.
+	 */
 	WorkerSupport.prototype.validate = function ( functionCodeBuilder, forceWorkerReload, runnerImpl ) {
 		this.running = false;
 		if ( forceWorkerReload ) {
@@ -970,6 +1010,10 @@ THREE.LoaderSupport.WorkerSupport = (function () {
 		}
 	};
 
+	/**
+	 * Terminate the worker and the code.
+	 * @memberOf THREE.LoaderSupport.WorkerSupport
+	 */
 	WorkerSupport.prototype.terminateWorker = function () {
 		if ( Validator.isValid( this.worker ) ) {
 			this.worker.terminate();
@@ -978,6 +1022,13 @@ THREE.LoaderSupport.WorkerSupport = (function () {
 		this.workerCode = null;
 	};
 
+	/**
+	 * Specify functions that should be build when new raw mesh data becomes available and when the parser is finished.
+	 * @memberOf THREE.LoaderSupport.WorkerSupport
+	 *
+	 * @param {Function} builder The builder function. Default is {@link THREE.LoaderSupport.Builder}.
+	 * @param {Function} onLoad The function that is called when parsing is complete.
+	 */
 	WorkerSupport.prototype.setCallbacks = function ( builder, onLoad ) {
 		this.callbacks = {
 			builder: builder,
@@ -1040,16 +1091,28 @@ THREE.LoaderSupport.WorkerSupport = (function () {
 		return objectString;
 	};
 
+	/**
+	 * Request termination of worker once parser is finished.
+	 * @memberOf THREE.LoaderSupport.WorkerSupport
+	 *
+	 * @param {boolean} terminateRequested True or false.
+	 */
 	WorkerSupport.prototype.setTerminateRequested = function ( terminateRequested ) {
 		this.terminateRequested = terminateRequested === true;
 	};
 
-	WorkerSupport.prototype.run = function ( messageObject ) {
+	/**
+	 * Runs the parser with the provided configuration.
+	 * @memberOf THREE.LoaderSupport.WorkerSupport
+	 *
+	 * @param {Object} payload Raw mesh description (buffers, params, materials) used to build one to many meshes.
+	 */
+	WorkerSupport.prototype.run = function ( payload ) {
 		if ( ! Validator.isValid( this.callbacks.builder ) ) throw 'Unable to run as no "builder" callback is set.';
 		if ( ! Validator.isValid( this.callbacks.onLoad ) ) throw 'Unable to run as no "onLoad" callback is set.';
 		if ( Validator.isValid( this.worker ) ) {
 			this.running = true;
-			this.worker.postMessage( messageObject );
+			this.worker.postMessage( payload );
 		}
 	};