1
0

PCDLoader.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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>Import</h2>
  23. <p>
  24. [name] is an add-on, and must be imported explicitly.
  25. See [link:#manual/introduction/Installation Installation / Addons].
  26. </p>
  27. <code>
  28. import { PCDLoader } from 'three/addons/loaders/PCDLoader.js';
  29. </code>
  30. <h2>Code Example</h2>
  31. <code>
  32. // instantiate a loader
  33. const loader = new PCDLoader();
  34. // load a resource
  35. loader.load(
  36. // resource URL
  37. 'pointcloud.pcd',
  38. // called when the resource is loaded
  39. function ( points ) {
  40. scene.add( points );
  41. },
  42. // called when loading is in progresses
  43. function ( xhr ) {
  44. console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
  45. },
  46. // called when loading has errors
  47. function ( error ) {
  48. console.log( 'An error happened' );
  49. }
  50. );
  51. </code>
  52. <h2>Examples</h2>
  53. <p>
  54. [example:webgl_loader_pcd]
  55. </p>
  56. <h2>Constructor</h2>
  57. <h3>[name]( [param:LoadingManager manager] )</h3>
  58. <p>
  59. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  60. </p>
  61. <p>
  62. Creates a new [name].
  63. </p>
  64. <h2>Properties</h2>
  65. <p>See the base [page:Loader] class for common properties.</p>
  66. <h3>[page:Boolean littleEndian]</h3>
  67. <p>
  68. Default value is true.
  69. </p>
  70. <h2>Methods</h2>
  71. <p>See the base [page:Loader] class for common methods.</p>
  72. <h3>[method:undefined load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  73. <p>
  74. [page:String url] — A string containing the path/URL of the `.pcd` file.<br />
  75. [page:Function onLoad] — (optional) A function to be called after loading is successfully completed. The function receives loaded [page:Object3D] as an argument.<br />
  76. [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 />
  77. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br />
  78. </p>
  79. <p>
  80. Begin loading from url and call onLoad with the parsed response content.
  81. </p>
  82. <h3>[method:Object3D parse]( [param:Arraybuffer data],[param:String url] )</h3>
  83. <p>
  84. [page:Arraybuffer data] — The binary structure to parse.
  85. </p>
  86. <p>
  87. [page:String url] — The file name or file url.
  88. </p>
  89. <p>
  90. Parse an `pcd` binary structure and return an [page:Object3D].<br />
  91. The object is converted to [page:Points] with a [page:BufferGeometry] and a [page:PointsMaterial].
  92. </p>
  93. <h2>Source</h2>
  94. <p>
  95. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js examples/jsm/loaders/PCDLoader.js]
  96. </p>
  97. </body>
  98. </html>