BufferGeometryLoader.html 2.3 KB

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