BufferGeometryLoader.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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">
  13. A loader for loading a [page:BufferGeometry].
  14. This uses the [page:FileLoader] internally for loading files.
  15. </div>
  16. <h2>Example</h2>
  17. [example:webgl_geometry_colors_lookuptable WebGL / geometry / colors / lookuptable]
  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. // Function when resource is loaded
  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. // Function called when download progresses
  32. function ( xhr ) {
  33. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  34. },
  35. // Function called when download errors
  36. function ( xhr ) {
  37. console.log( 'An error happened' );
  38. }
  39. );
  40. </code>
  41. <h2>Constructor</h2>
  42. <h3>[name]( [page:LoadingManager manager] )</h3>
  43. <div>
  44. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  45. </div>
  46. <div>
  47. Creates a new [name].
  48. </div>
  49. <h2>Properties</h2>
  50. <h3>[property:LoadingManager manager]</h3>
  51. <div>
  52. The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
  53. </div>
  54. <h2>Methods</h2>
  55. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  56. <div>
  57. [page:String url] — required<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, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  60. [page:Function onError] — Will be called when load errors.<br />
  61. </div>
  62. <div>
  63. Begin loading from url and call onLoad with the parsed response content.
  64. </div>
  65. <h3>[method:BufferGeometry parse]( [page:Object json] )</h3>
  66. <div>
  67. [page:Object json] — The <em>JSON</em> structure to parse.
  68. </div>
  69. <div>
  70. Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
  71. </div>
  72. <h2>Source</h2>
  73. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  74. </body>
  75. </html>