PDBLoader.html 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!DOCTYPE html>
  2. <html lang="en">
  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>Example</h2>
  17. <code>
  18. // instantiate a loader
  19. var loader = new THREE.PDBLoader();
  20. // load a PDB resource
  21. loader.load(
  22. // resource URL
  23. 'models/molecules/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. [example:webgl_loader_pdb]
  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. <h2>Methods</h2>
  53. <p>See the base [page:Loader] class for common methods.</p>
  54. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  55. <p>
  56. [page:String url] — A string containing the path/URL of the <em>.pdb</em> file.<br />
  57. [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 />
  58. [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 />
  59. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br />
  60. </p>
  61. <p>
  62. Begin loading from url and call onLoad with the parsed response content.
  63. </p>
  64. <h3>[method:Object parse]( [param:String text] )</h3>
  65. <p>
  66. [page:String text] — The textual <em>pdb</em> structure to parse.
  67. </p>
  68. <p>
  69. Parse a <em>pdb</em> text and return a <em>JSON</em> structure.<br />
  70. </p>
  71. <h2>Source</h2>
  72. <p>
  73. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PDBLoader.js examples/js/loaders/PDBLoader.js]
  74. </p>
  75. </body>
  76. </html>