BufferGeometryLoader.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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>Code Example</h2>
  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>Examples</h2>
  42. <p>
  43. [example:webgl_performance WebGL / performance]
  44. </p>
  45. <h2>Constructor</h2>
  46. <h3>[name]( [param:LoadingManager manager] )</h3>
  47. <p>
  48. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  49. </p>
  50. <p>
  51. Creates a new [name].
  52. </p>
  53. <h2>Properties</h2>
  54. <p>See the base [page:Loader] class for common properties.</p>
  55. <h2>Methods</h2>
  56. <p>See the base [page:Loader] class for common methods.</p>
  57. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  58. <p>
  59. [page:String url] — the path or URL to the file. This can also be a
  60. [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].d<br />
  61. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].<br />
  62. [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 />
  63. [page:Function onError] — Will be called when load errors.<br />
  64. </p>
  65. <p>
  66. Begin loading from url and call onLoad with the parsed response content.
  67. </p>
  68. <h3>[method:BufferGeometry parse]( [param:Object json] )</h3>
  69. <p>
  70. [page:Object json] — The <em>JSON</em> structure to parse.<br /><br />
  71. Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
  72. </p>
  73. <h2>Source</h2>
  74. <p>
  75. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  76. </p>
  77. </body>
  78. </html>