Supporting classes for file loaders and web worker based loaders.
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.
[page:Boolean enabled] True or false.
[page:Boolean debug] True or false.
Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
Initializes the Builder (currently only default material initialisation).
Array of [page:Material materials] - Array of [page:Material Materials]
Set materials loaded by any supplier of an Array of [page:Material Materials].
[page:Object payload] - Raw Mesh or Material descriptions.
Delegates processing of the payload (mesh building or material update) to the corresponding functions (BW-compatibility).
[page:Object meshPayload] - Raw mesh description (buffers, params, materials) used to build one to many meshes.
Builds one or multiple meshes from the data described in the payload (buffers, params, material info).
[page:Object materialPayload] - Material update instructions
Updates the materials with contained material objects (sync) or from alteration instructions (async).
Returns the mapping object of material name and corresponding jsonified material.
Returns the mapping object of material name and corresponding material.
[page:Boolean disregardMesh] - Tell implementation to completely disregard this mesh
[page:Boolean alteredMesh] - Tell implementation that mesh(es) have been altered or added
Object to return by callback onMeshAlter. Used to disregard a certain mesh or to return one to many meshes.
[page:Mesh mesh] - Mesh
Add a mesh created within callback.
Answers if mesh shall be disregarded completely.
Answers if new mesh(es) were created.
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.
[page:Boolean enabled] True or false.
[page:Boolean debug] True or false.
Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
[page:Boolean forceWorkerDataCopy] True or false.
Forces all ArrayBuffers to be transferred to worker to be copied.
[page:Function functionCodeBuilder] - Function that is invoked with funcBuildObject and funcBuildSingleton that allows stringification of objects and singletons.
Array of [page:String libLocations] - URL of libraries that shall be added to worker code relative to libPath.
[page:String libPath] - Base path used for loading libraries.
[page:LoaderSupport.WorkerRunnerRefImpl runnerImpl] - The default worker parser wrapper implementation (communication and execution). An extended class could be passed here.
Validate the status of worker code and the derived worker.
[page:Boolean terminateRequested] - True or false.
Request termination of worker once parser is finished.
[page:Function builder] - The builder function. Default is [page:LoaderSupport.Builder].
[page:Function onLoad] - The function that is called when parsing is complete.
Specify functions that should be build when new raw mesh data becomes available and when the parser is finished.
[page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes.
Runs the parser with the provided configuration.
Default implementation of the WorkerRunner responsible for creation and configuration of the parser within the worker.
[page:Object parser] - The parser instance
[page:Object params] - The parameter object
Applies values from parameter object via set functions or via direct assignment.
[page:Object payload] - Raw mesh description (buffers, params, materials) used to build one to many meshes.
Configures the Parser implementation according the supplied configuration object.
[page:String classDef] - Class definition to be used for construction
Orchestrate loading of multiple OBJ files/data from an instruction queue with a configurable amount of workers (1-16).
- Workflow:
- prepareWorkers
- enqueueForRun
- processQueue
- tearDown
[page:Boolean enabled] True or false.
[page:Boolean debug] True or false.
Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
[page:Boolean forceWorkerDataCopy] True or false.
Forces all ArrayBuffers to be transferred to worker to be copied.
[page:LoaderSupport.Callbacks globalCallbacks] - Register global callbacks used by all web workers
[page:Number maxQueueSize] - Set the maximum size of the instruction queue (1-1024)
[page:Number maxWebWorkers] - Set the maximum amount of workers (1-16)
Create or destroy workers according limits. Set the name and register callbacks for dynamically created web workers.
[page:LoaderSupport.PrepData runParams]
Store run instructions in internal instructionQueue.
Process the instructionQueue until it is depleted.
[page:Function callbackOnFinishedProcessing] - Function called once all workers finished processing.
Terminate all workers.
Returns the maximum length of the instruction queue.
Returns the maximum number of workers.
Returns if any workers are running.
[page:String crossOrigin] - CORS value
Sets the CORS string to be used.
[page:String url] - URL to the file
[page:String extension] - The file extension (type)
A resource description used by [page:LoaderSupport.PrepData] and others.
[page:Object content] - The file content as ArrayBuffer or text
Set the content of this resource
[page:String resourcePath] - URL
Allows to specify resourcePath for dependencies of specified resource.
[page:String modelName] - Overall name of the model
Configuration instructions to be used by run method.
[page:Boolean enabled] True or false.
[page:Boolean debug] True or false.
Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
Returns all callbacks as [page:LoaderSupport.Callbacks].
[page:LoaderSupport.ResourceDescriptor resource] Adds a [page:LoaderSupport.ResourceDescriptor]
Add a resource description.
[page:LoaderSupport.ResourceDescriptor resources] - Array of [page:LoaderSupport.ResourceDescriptor]
[page:Object fileDesc] - Object describing which resources are of interest (ext, type (string or UInt8Array) and ignore (boolean))
Identify files or content of interest from an Array of [page:LoaderSupport.ResourceDescriptor]. Returns Object with each "ext" and the corresponding [page:LoaderSupport.ResourceDescriptor]
Clones this object and returns it afterwards. Callbacks and resources are not cloned deep (references!).
Callbacks utilized by loaders and builder.
[page:Function callbackOnProgress] - Callback function for described functionality
Register callback function that is invoked by internal function "announceProgress" to print feedback.
[page:Function callbackOnReportError] - Callback function for described functionality
Register callback function that is invoked when an error is reported.
[page:Function callbackOnMeshAlter] - Callback function for described functionality
Register callback function that is called every time a mesh was loaded. Use [page:LoadedMeshUserOverride] for alteration instructions (geometry, material or disregard mesh).
[page:Function callbackOnLoad] - Callback function for described functionality
Register callback function that is called once loading of the complete OBJ file is completed.
[page:Function callbackOnLoadMaterials] - Callback function for described functionality
Register callback function that is called when materials have been loaded.
Validation functions.
[page:Object input] - Can be anything
If given input is null or undefined, false is returned otherwise true.
[page:Object input] - Can be anything
[page:Object defaultValue] - Can be anything
If given input is null or undefined, the defaultValue is returned otherwise the given input.
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/LoaderSupport.js examples/js/loaders/LoaderSupport.js]