123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- <!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.PrepDataCallbacks]<br>
- [page:WWOBJLoader2.LoadedMeshUserOverride]<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. Use [page:WWOBJLoader2.LoadedMeshUserOverride] for alteration instructions (geometry, material or disregard mesh).
- </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>
- <h3>[method:null clearAllCallbacks]()</h3>
- <div>
- Clears all registered callbacks.
- </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
- </div>
- <div>
- Instruction to configure [page:WWOBJLoader2.prepareRun] to load OBJ from given ArrayBuffer and MTL from given String.
- </div>
- <h2>Methods</h2>
- <h3>[method:PrepDataCallbacks getCallbacks]()</h3>
- <div>
- Returns all callbacks as [page:WWOBJLoader2.PrepDataCallbacks].
- </div>
- <h3>[method:null setRequestTerminate]( [page:Boolean requestTerminate] )</h3>
- <div>
- [page:Boolean requestTerminate] — Default is false
- </div>
- <div>
- Request termination of web worker and free local resources after execution.
- </div>
- <h3>[method:null setSceneGraphBaseNode]( [page:THREE.Object3D sceneGraphBaseNode] )</h3>
- <div>
- [page:Object3D sceneGraphBaseNode] — Scene graph object
- </div>
- <div>
- [page:Object3D] where meshes will be attached.
- </div>
- <h3>[method:null setStreamMeshes]( [page:Boolean streamMeshes] )</h3>
- <div>
- [page:Boolean streamMeshes] — Default is true
- </div>
- <div>
- Singles meshes are directly integrated into scene when loaded or later.
- </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
- </div>
- <div>
- Instruction to configure [page:WWOBJLoader2.prepareRun] to load OBJ and MTL from files.
- </div>
- <h2>Methods</h2>
- <h3>[method:PrepDataCallbacks getCallbacks]()</h3>
- <div>
- Returns all callbacks as [page:WWOBJLoader2.PrepDataCallbacks].
- </div>
- <h3>[method:null setRequestTerminate]( [page:Boolean requestTerminate] )</h3>
- <div>
- [page:Boolean requestTerminate] — Default is false
- </div>
- <div>
- Request termination of web worker and free local resources after execution.
- </div>
- <h3>[method:null setSceneGraphBaseNode]( [page:THREE.Object3D sceneGraphBaseNode] )</h3>
- <div>
- [page:Object3D sceneGraphBaseNode] — Scene graph object
- </div>
- <div>
- [page:Object3D] where meshes will be attached.
- </div>
- <h3>[method:null setStreamMeshes]( [page:Boolean streamMeshes] )</h3>
- <div>
- [page:Boolean streamMeshes] — Default is true
- </div>
- <div>
- Singles meshes are directly integrated into scene when loaded or later.
- </div>
- <br>
- <br>
- <a name="PrepDataCallbacks"></a><h1>PrepDataCallbacks</h1>
- <h2>Constructor</h2>
- <h3>PrepDataCallbacks()</h3>
- <div>
- Callbacks utilized by functions working with [page:WWOBJLoader2.PrepDataArrayBuffer] or [page:WWOBJLoader2.PrepDataFile].
- </div>
- <h2>Methods</h2>
- <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 registerCallbackErrorWhileLoading]( [page:Function callbackErrorWhileLoading] )</h3>
- <div>
- [page:Function callbackErrorWhileLoading] — Callback function for described functionality
- </div>
- <div>
- Report if an error prevented loading.
- </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. Use [page:WWOBJLoader2.LoadedMeshUserOverride] for alteration instructions (geometry, material or disregard mesh).
- </div>
- <br>
- <br>
- <a name="LoadedMeshUserOverride"></a><h1>LoadedMeshUserOverride</h1>
- <h2>Constructor</h2>
- <h3>LoadedMeshUserOverride( [page:Boolean disregardMesh], [page:THREE.BufferGeometry bufferGeometry], [page:THREE.Material material] )</h3>
- <div>
- [page:Boolean disregardMesh] — Tell [page:WWOBJLoader2] to completely disregard this mesh<br>
- [page:BufferGeometry bufferGeometry] — The [page:BufferGeometry] to be used<br>
- [page:Material material] — The [page:Material] to be used
- </div>
- <div>
- Object to return by THREE.OBJLoader2.WWOBJLoader2.callbacks.meshLoaded. Used to adjust bufferGeometry or material or prevent complete loading of mesh.
- </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]( [page:WWOBJLoader2.PrepDataCallbacks globalCallbacks], [page:Number maxQueueSize], [page:Number maxWebWorkers] )</h3>
- <div>
- [page:WWOBJLoader2.PrepDataCallbacks 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: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>
|