PCDLoader.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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">
  13. A loader for the PCD (Point Cloud Data) file format. [name] supports ASCII and (compressed) binary files as well as the following PCD fields:
  14. <ul>
  15. <li>x y z</li>
  16. <li>rgb</li>
  17. <li>normal_x normal_y normal_z</li>
  18. <li>intensity</li>
  19. <li>label</li>
  20. </ul>
  21. </p>
  22. <h2>Code Example</h2>
  23. <code>
  24. // instantiate a loader
  25. const loader = new PCDLoader();
  26. // load a resource
  27. loader.load(
  28. // resource URL
  29. 'pointcloud.pcd',
  30. // called when the resource is loaded
  31. function ( points ) {
  32. scene.add( points );
  33. },
  34. // called when loading is in progresses
  35. function ( xhr ) {
  36. console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
  37. },
  38. // called when loading has errors
  39. function ( error ) {
  40. console.log( 'An error happened' );
  41. }
  42. );
  43. </code>
  44. <h2>Examples</h2>
  45. <p>
  46. [example:webgl_loader_pcd]
  47. </p>
  48. <h2>Constructor</h2>
  49. <h3>[name]( [param:LoadingManager manager] )</h3>
  50. <p>
  51. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  52. </p>
  53. <p>
  54. Creates a new [name].
  55. </p>
  56. <h2>Properties</h2>
  57. <p>See the base [page:Loader] class for common properties.</p>
  58. <h3>[page:Boolean littleEndian]</h3>
  59. <p>
  60. Default value is true.
  61. </p>
  62. <h2>Methods</h2>
  63. <p>See the base [page:Loader] class for common methods.</p>
  64. <h3>[method:undefined load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  65. <p>
  66. [page:String url] — A string containing the path/URL of the `.pcd` file.<br />
  67. [page:Function onLoad] — (optional) A function to be called after loading is successfully completed. The function receives loaded [page:Object3D] as an argument.<br />
  68. [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. If the server does not set the Content-Length header; .[page:Integer total] will be 0.<br />
  69. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br />
  70. </p>
  71. <p>
  72. Begin loading from url and call onLoad with the parsed response content.
  73. </p>
  74. <h3>[method:Object3D parse]( [param:Arraybuffer data],[param:String url] )</h3>
  75. <p>
  76. [page:Arraybuffer data] — The binary structure to parse.
  77. </p>
  78. <p>
  79. [page:String url] — The file name or file url.
  80. </p>
  81. <p>
  82. Parse an `pcd` binary structure and return an [page:Object3D].<br />
  83. The object is converted to [page:Points] with a [page:BufferGeometry] and a [page:PointsMaterial].
  84. </p>
  85. <h2>Source</h2>
  86. <p>
  87. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js examples/jsm/loaders/PCDLoader.js]
  88. </p>
  89. </body>
  90. </html>