PCDLoader.html 3.1 KB

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