OBJLoader2Parallel.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <p class="desc">A loader for loading a <em>.obj</em> resource.<br />
  13. The <a href="https://en.wikipedia.org/wiki/Wavefront_.obj_file">OBJ file format</a> is a simple data-format
  14. that represents 3D geometry in a human readable format as, the position of each vertex, the UV position of
  15. each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list of
  16. vertices, and texture vertices.
  17. </p>
  18. <h2>Code Example</h2>
  19. <code>
  20. // instantiate the loader
  21. let objLoader2Parallel = new OBJLoader2Parallel();
  22. // define where to attach the data
  23. let local = new THREE.Object3D();
  24. // function called on successful completion of parsing
  25. function callbackOnLoad( object3d, message ) {
  26. local.add( object3d );
  27. }
  28. // load a resource from provided URL in parallel to Main
  29. objLoader2Parallel.load( 'models/obj/walt/WaltHead.obj', callbackOnLoad, null, null, null );
  30. </code>
  31. <h2>Examples</h2>
  32. <p>
  33. [example:webgl_loader_obj2_options] - Example for multiple use-cases (parse and load, sync (see [page:OBJLoader2]) or in parallel to main)
  34. </p>
  35. <h2>Constructor</h2>
  36. <h3>[name]( [param:LoadingManager manager] )</h3>
  37. <p>
  38. [page:LoadingManager manager] - The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br>
  39. </p>
  40. <p>
  41. Creates a new [name]. Use it to load OBJ data from files or to parse OBJ data from arraybuffer.
  42. It extends [page:OBJLoader2] with the capability to run the parser in a web worker.
  43. </p>
  44. <h2>Properties</h2>
  45. <p>See the base [page:OBJLoader2] class for common properties.</p>
  46. <h2>Methods</h2>
  47. <p>See the base [page:OBJLoader2] class for common methods. </p>
  48. <h3>[method:Object3D parse]</h3>
  49. <p>See [page:OBJLoader2.parse].<br>
  50. The callback [page:OBJLoader2.setCallbackOnLoad OBJLoader2.onLoad] needs to be set to be able to receive the content if used in parallel mode.
  51. Fallback is possible via [page:OBJLoader2Parallel.setExecuteParallel].
  52. </p>
  53. <h3>[method:null load]</h3>
  54. <p>See [page:OBJLoader2.load].</p>
  55. <h3>[method:OBJLoader2Parallel setExecuteParallel] ( [param:boolean executeParallel] )</h3>
  56. <p>
  57. [page:boolean executeParallel] - True or False
  58. </p>
  59. <p>
  60. Execution of parse in parallel via Worker is default, but synchronous [page:OBJLoader2] parsing can be enforced via false here.
  61. </p>
  62. <h3>[method:OBJLoader2Parallel setPreferJsmWorker] ( [param:boolean preferJsmWorker] )</h3>
  63. <p>
  64. [page:boolean preferJsmWorker] - True or False
  65. </p>
  66. <p>
  67. Set whether jsm modules in workers should be used. This requires browser support which is currently only experimental.
  68. </p>
  69. <h3>[method:WorkerExecutionSupport getWorkerExecutionSupport] ()</h3>
  70. <p>
  71. Allow to get hold of [page:WorkerExecutionSupport] for configuration purposes.
  72. </p>
  73. <h3>[method:CodeBuilderInstructions buildWorkerCode] ()</h3>
  74. <p>
  75. Provide instructions on what is to be contained in the worker.
  76. </p>
  77. <h2>Source</h2>
  78. <p>
  79. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/OBJLoader2Parallel.js examples/jsm/loaders/OBJLoader2Parallel.js]
  80. </p>
  81. </body>
  82. </html>