BufferGeometryLoader.html 2.7 KB

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