|
@@ -0,0 +1,261 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+ <head>
|
|
|
+ <meta charset="utf-8" />
|
|
|
+ <base href="../../" />
|
|
|
+ <script src="list.js"></script>
|
|
|
+ <script src="page.js"></script>
|
|
|
+ <link type="text/css" rel="stylesheet" href="page.css" />
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+
|
|
|
+ <h1>[name]</h1>
|
|
|
+
|
|
|
+ <div class="desc">A loader for loading an <em>.obj</em> resource within a web worker.</div>
|
|
|
+
|
|
|
+ <h2>Sub-Classes</h2>
|
|
|
+ [page:WWOBJLoader2.PrepDataArrayBuffer]<br>
|
|
|
+ [page:WWOBJLoader2.PrepDataFile]<br>
|
|
|
+ [page:WWOBJLoader2.WWOBJLoader2Director]
|
|
|
+
|
|
|
+ <h2>Example</h2>
|
|
|
+
|
|
|
+ <code>
|
|
|
+ // instantiate the loader
|
|
|
+ var loader = new THREE.OBJLoader2.WWOBJLoader2();
|
|
|
+
|
|
|
+ // load an OBJ file by providing a name, the path and the file name
|
|
|
+ var prepData = new THREE.OBJLoader2.WWOBJLoader2.PrepDataFile(
|
|
|
+ 'female02',
|
|
|
+ 'obj/female02/',
|
|
|
+ 'female02.obj'
|
|
|
+ );
|
|
|
+
|
|
|
+ // set where to add the loaded data in the scene graph.
|
|
|
+ prepData.setSceneGraphBaseNode( scene );
|
|
|
+
|
|
|
+ // provide the preparation data to the loader and let it run.
|
|
|
+ loader.prepareRun( prepData );
|
|
|
+ loader.run();
|
|
|
+ </code>
|
|
|
+
|
|
|
+ [example:webgl_loader_obj2_ww] — Simple example that allows to load own models via file selection.<br>
|
|
|
+ [example:webgl_loader_obj2_ww_parallels] — Advanced example using [page:WWOBJLoader2.WWOBJLoader2Director] for orchestration of multiple workers.
|
|
|
+
|
|
|
+
|
|
|
+ <h2>Constructor</h2>
|
|
|
+
|
|
|
+ <h3>[name]()</h3>
|
|
|
+ <div>
|
|
|
+ OBJ data will be loaded by dynamically created web worker.<br>
|
|
|
+ First feed instructions with: [page:WWOBJLoader2.prepareRun prepareRun]<br>
|
|
|
+ Then execute with: [page:WWOBJLoader2.run run]
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <h2>Properties</h2>
|
|
|
+
|
|
|
+
|
|
|
+ <h2>Methods</h2>
|
|
|
+
|
|
|
+ <h3>[method:null prepareRun]( [page:Object params] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Object params] — Either [page:WWOBJLoader2.PrepDataArrayBuffer] or [page:WWOBJLoader2.PrepDataFile]
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Set all parameters for required for execution of [page:WWOBJLoader2.run run].
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h3>[method:null run]()</h3>
|
|
|
+ <div>
|
|
|
+ Run the loader according the preparation instruction provided in [page:WWOBJLoader2.prepareRun prepareRun].
|
|
|
+ </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>
|
|
|
+
|
|
|
+
|
|
|
+ <h3>[method:null setDebug]( [page:Boolean enabled] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Boolean enabled] — True or false
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Enable or disable debug logging.
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h3>[method:null setRequestTerminate]( [page:Boolean requestTerminate] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Boolean requestTerminate] — True or false
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Call requestTerminate to terminate the web worker and free local resource after execution.
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h3>[method:null registerCallbackCompletedLoading]( [page:Function callbackCompletedLoading] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Function callbackCompletedLoading] — Callback function for described functionality
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Register callback function that is called once loading of the complete model is completed.
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h3>[method:null registerCallbackProgress]( [page:Function callbackProgress] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Function callbackProgress] — Callback function for described functionality
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Register callback function that is invoked by internal function "_announceProgress" to print feedback.
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h3>[method:null registerCallbackMaterialsLoaded]( [page:Function callbackMaterialsLoaded] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Function callbackMaterialsLoaded] — Callback function for described functionality
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Register callback function that is called once materials have been loaded. It allows to alter and return materials.
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h3>[method:null registerCallbackMeshLoaded]( [page:Function callbackMeshLoaded] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Function callbackMeshLoaded] — Callback function for described functionality
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Register callback function that is called every time a mesh was loaded. Return altered [page:Material] or null from callback.
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <h3>[method:null registerCallbackErrorWhileLoading]( [page:Function callbackErrorWhileLoading] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Function callbackErrorWhileLoading] — Callback function for described functionality
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Register callback function that is called to report an error that prevented loading.
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h2>Sub-Classes</h2>
|
|
|
+ <br>
|
|
|
+ <a name="PrepDataArrayBuffer"></a><h1>PrepDataArrayBuffer</h1>
|
|
|
+ <h2>Constructor</h2>
|
|
|
+
|
|
|
+ <h3>PrepDataArrayBuffer( [page:String modelName], [page:Uint8Array objAsArrayBuffer], [page:String pathTexture], [page:String mtlAsString] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:String modelName] — Overall name of the model<br>
|
|
|
+ [page:Uint8Array objAsArrayBuffer] — OBJ file content as ArrayBuffer<br>
|
|
|
+ [page:String pathTexture] — Path to texture files<br>
|
|
|
+ [page:String mtlAsString] — MTL file content as string
|
|
|
+ [page:Object3D sceneGraphBaseNode] [page:Object3D] where meshes will be attached
|
|
|
+ [page:Boolean streamMeshes] Singles meshes are directly integrated into scene when loaded or later
|
|
|
+ [page:Boolean requestTerminate] Request termination of web worker and free local resources after execution
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Instruction to configure [page:WWOBJLoader2.prepareRun] to load OBJ from given ArrayBuffer and MTL from given String.
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <br>
|
|
|
+
|
|
|
+
|
|
|
+ <a name="PrepDataFile"></a><h1>PrepDataFile</h1>
|
|
|
+ <h2>Constructor</h2>
|
|
|
+
|
|
|
+ <h3>PrepDataFile( [page:String modelName], [page:String pathObj], [page:String fileObj], [page:String pathTexture], [page:String fileMtl] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:String modelName] — Overall name of the model<br>
|
|
|
+ [page:String pathObj] — Path to OBJ file<br>
|
|
|
+ [page:String fileObj] — OBJ file name<br>
|
|
|
+ [page:String pathTexture] — Path to texture files<br>
|
|
|
+ [page:String fileMtl] — MTL file name
|
|
|
+ [page:Object3D sceneGraphBaseNode] [page:Object3D] where meshes will be attached
|
|
|
+ [page:Boolean streamMeshes] Singles meshes are directly integrated into scene when loaded or later
|
|
|
+ [page:Boolean requestTerminate] Request termination of web worker and free local resources after execution
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ Instruction to configure [page:WWOBJLoader2.prepareRun] to load OBJ and MTL from files.
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <br>
|
|
|
+
|
|
|
+
|
|
|
+ <a name="WWOBJLoader2Director"></a><h1>WWOBJLoader2Director</h1>
|
|
|
+ <h2>Constructor</h2>
|
|
|
+
|
|
|
+ <h3>WWOBJLoader2Director()</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
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <h3>[method:null prepareWorkers]( Array of [page:Function callbacks], [page:Number maxQueueSize], [page:Number maxWebWorkers] )</h3>
|
|
|
+ <div>
|
|
|
+ Array of [page:Function callbacks] — Register callbacks for all web workers: progress, completedLoading, errorWhileLoading, materialsLoaded, meshLoaded<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:Object runParams] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:Object runParams] — Either [page:WWOBJLoader2.PrepDataArrayBuffer] or [page:WWOBJLoader2.PrepDataFile]
|
|
|
+ </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>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <h2>Source</h2>
|
|
|
+
|
|
|
+ [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/OBJLoader2.js examples/js/loaders/OBJLoader2.js]
|
|
|
+
|
|
|
+ </body>
|
|
|
+</html>
|