PCDLoader.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Loader] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">A loader for loading a <em>.pcd</em> resource. <br />
  13. Point Cloud Data is a file format for <a href="https://en.wikipedia.org/wiki/Point_Cloud_Library">Point Cloud Library</a>. <br />
  14. Loader support ascii and (compressed) binary.
  15. </p>
  16. <h2>Code Example</h2>
  17. <code>
  18. // instantiate a loader
  19. const loader = new PCDLoader();
  20. // load a resource
  21. loader.load(
  22. // resource URL
  23. 'pointcloud.pcd',
  24. // called when the resource is loaded
  25. function ( mesh ) {
  26. scene.add( mesh );
  27. },
  28. // called when loading is in progresses
  29. function ( xhr ) {
  30. console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
  31. },
  32. // called when loading has errors
  33. function ( error ) {
  34. console.log( 'An error happened' );
  35. }
  36. );
  37. </code>
  38. <h2>Examples</h2>
  39. <p>
  40. [example:webgl_loader_pcd]
  41. </p>
  42. <h2>Constructor</h2>
  43. <h3>[name]( [param:LoadingManager manager] )</h3>
  44. <p>
  45. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  46. </p>
  47. <p>
  48. Creates a new [name].
  49. </p>
  50. <h2>Properties</h2>
  51. <p>See the base [page:Loader] class for common properties.</p>
  52. <h3>[page:Boolean littleEndian]</h3>
  53. <p>
  54. Default value is true.
  55. </p>
  56. <h2>Methods</h2>
  57. <p>See the base [page:Loader] class for common methods.</p>
  58. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  59. <p>
  60. [page:String url] — A string containing the path/URL of the <em>.pcd</em> file.<br />
  61. [page:Function onLoad] — (optional) A function to be called after loading is successfully completed. The function receives loaded [page:Object3D] as an argument.<br />
  62. [page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains [page:Integer total] and [page:Integer loaded] bytes.<br />
  63. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br />
  64. </p>
  65. <p>
  66. Begin loading from url and call onLoad with the parsed response content.
  67. </p>
  68. <h3>[method:Object3D parse]( [param:Arraybuffer data],[param:String url] )</h3>
  69. <p>
  70. [page:Arraybuffer data] — The binary structure to parse.
  71. </p>
  72. <p>
  73. [page:String url] — The file name or file url.
  74. </p>
  75. <p>
  76. Parse an <em>pcd</em> binary structure and return an [page:Object3D].<br />
  77. The object is converted to [page:Points] with a [page:BufferGeometry] and a [page:PointsMaterial].
  78. </p>
  79. <h2>Source</h2>
  80. <p>
  81. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js examples/jsm/loaders/PCDLoader.js]
  82. </p>
  83. </body>
  84. </html>