BufferGeometryLoader.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. <div class="desc">A loader for loading a [page:BufferGeometry].</div>
  13. <h2>Constructor</h2>
  14. <h3>[name]( [page:LoadingManager manager] )</h3>
  15. <div>
  16. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  17. </div>
  18. <div>
  19. Creates a new [name].
  20. </div>
  21. <h2>Properties</h2>
  22. <h2>Methods</h2>
  23. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  24. <div>
  25. [page:String url] — required<br />
  26. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].<br />
  27. [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  28. [page:Function onError] — Will be called when load errors.<br />
  29. </div>
  30. <div>
  31. Begin loading from url and call onLoad with the parsed response content.
  32. </div>
  33. <h3>[method:BufferGeometry parse]( [page:Object json] )</h3>
  34. <div>
  35. [page:Object json] — The <em>JSON</em> structure to parse.
  36. </div>
  37. <div>
  38. Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
  39. </div>
  40. <h2>Example</h2>
  41. <code>
  42. // instantiate a loader
  43. var loader = new THREE.BufferGeometryLoader();
  44. // load a resource
  45. loader.load(
  46. // resource URL
  47. 'models/json/pressure.json',
  48. // Function when resource is loaded
  49. function ( geometry ) {
  50. var material = new THREE.MeshLambertMaterial( { color: 0xF5F5F5 } );
  51. var object = new THREE.Mesh( geometry, material );
  52. scene.add( object );
  53. },
  54. // Function called when download progresses
  55. function ( xhr ) {
  56. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  57. },
  58. // Function called when download errors
  59. function ( xhr ) {
  60. console.log( 'An error happened' );
  61. }
  62. );
  63. </code>
  64. <h2>Source</h2>
  65. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  66. </body>
  67. </html>