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