BufferGeometryLoader.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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">
  13. A loader for loading a [page:BufferGeometry].
  14. This uses the [page:FileLoader] internally for loading files.
  15. </p>
  16. <h2>Example</h2>
  17. [example:webgl_geometry_colors_lookuptable WebGL / geometry / colors / lookuptable]
  18. <code>
  19. // instantiate a loader
  20. var loader = new THREE.BufferGeometryLoader();
  21. // load a resource
  22. loader.load(
  23. // resource URL
  24. 'models/json/pressure.json',
  25. // onLoad callback
  26. function ( geometry ) {
  27. var material = new THREE.MeshLambertMaterial( { color: 0xF5F5F5 } );
  28. var object = new THREE.Mesh( geometry, material );
  29. scene.add( object );
  30. },
  31. // onProgress callback
  32. function ( xhr ) {
  33. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  34. },
  35. // onError callback
  36. function ( err ) {
  37. console.log( 'An error happened' );
  38. }
  39. );
  40. </code>
  41. <h2>Constructor</h2>
  42. <h3>[name]( [param:LoadingManager manager] )</h3>
  43. <p>
  44. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  45. </p>
  46. <p>
  47. Creates a new [name].
  48. </p>
  49. <h2>Properties</h2>
  50. <h3>[property:LoadingManager manager]</h3>
  51. <p>
  52. The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
  53. </p>
  54. <h2>Methods</h2>
  55. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  56. <p>
  57. [page:String url] — the path or URL to the file. This can also be a
  58. [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].d<br />
  59. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].<br />
  60. [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  61. [page:Function onError] — Will be called when load errors.<br />
  62. </p>
  63. <p>
  64. Begin loading from url and call onLoad with the parsed response content.
  65. </p>
  66. <h3>[method:BufferGeometry parse]( [param:Object json] )</h3>
  67. <p>
  68. [page:Object json] — The <em>JSON</em> structure to parse.<br /><br />
  69. Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
  70. </p>
  71. <h2>Source</h2>
  72. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  73. </body>
  74. </html>