PDBLoader.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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>.pdb</em> resource.<br>
  14. The <a href="http://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)">Protein Data Bank</a> file format is a textual file describing the three-dimensional structures of molecules.
  15. </p>
  16. <h2>代码示例</h2>
  17. <code>
  18. // instantiate a loader
  19. var loader = new PDBLoader();
  20. // load a PDB resource
  21. loader.load(
  22. // resource URL
  23. 'models/pdb/caffeine.pdb',
  24. // called when the resource is loaded
  25. function ( pdb ) {
  26. var geometryAtoms = pdb.geometryAtoms;
  27. var geometryBonds = pdb.geometryBonds;
  28. var json = pdb.json;
  29. console.log( 'This molecule has ' + json.atoms.length + ' atoms' );
  30. },
  31. // called when loading is in progresses
  32. function ( xhr ) {
  33. console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
  34. },
  35. // called when loading has errors
  36. function ( error ) {
  37. console.log( 'An error happened' );
  38. }
  39. );
  40. </code>
  41. <h2>例子</h2>
  42. <p>
  43. [example:webgl_loader_pdb]
  44. </p>
  45. <h2>Constructor</h2>
  46. <h3>[name]( [param:LoadingManager manager] )</h3>
  47. <p>
  48. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  49. </p>
  50. <p>
  51. Creates a new [name].
  52. </p>
  53. <h2>Properties</h2>
  54. <p>See the base [page:Loader] class for common properties.</p>
  55. <h2>Methods</h2>
  56. <p>See the base [page:Loader] class for common methods.</p>
  57. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  58. <p>
  59. [page:String url] — A string containing the path/URL of the <em>.pdb</em> file.<br />
  60. [page:Function onLoad] — (optional) A function to be called after loading is successfully completed. The function receives the object having the following properties. [page:BufferGeometry geometryAtoms], [page:BufferGeometry geometryBonds] and the [page:Object JSON] structure.<br />
  61. [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 />
  62. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br />
  63. </p>
  64. <p>
  65. Begin loading from url and call onLoad with the parsed response content.
  66. </p>
  67. <h3>[method:Object parse]( [param:String text] )</h3>
  68. <p>
  69. [page:String text] — The textual <em>pdb</em> structure to parse.
  70. </p>
  71. <p>
  72. Parse a <em>pdb</em> text and return a <em>JSON</em> structure.<br />
  73. </p>
  74. <h2>Source</h2>
  75. <p>
  76. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PDBLoader.js examples/jsm/loaders/PDBLoader.js]
  77. </p>
  78. </body>
  79. </html>