PDBLoader.html 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <script src="../../list.js"></script>
  6. <script src="../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <div class="desc">
  12. A loader for loading a <em>.pdb</em> resource.
  13. <br /><br />
  14. The <a href="http://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)">Protein Data Bank file format</a> is a textual file format describing the three-dimensional structures of molecules.
  15. </div>
  16. <h2>Constructor</h2>
  17. <h3>[name]( [page:LoadingManager manager] )</h3>
  18. <div>
  19. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  20. </div>
  21. <div>
  22. Creates a new [name].
  23. </div>
  24. <h2>Properties</h2>
  25. <h2>Methods</h2>
  26. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  27. <div>
  28. [page:String url] — required. URL to the <em>.pdb</em> file<br />
  29. [page:Function onLoad] — Will be called when load completes. The arguments will be an [page:Geometry geometryAtoms], [page:Geometry geometryBonds] and the [page:Object JSON] structure.<br />
  30. [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  31. [page:Function onError] — Will be called when load errors.<br />
  32. </div>
  33. <div>
  34. Begin loading from url and call onLoad with the parsed response content.
  35. </div>
  36. <h3>[method:Object parsePDB]( [page:String text] )</h3>
  37. <div>
  38. [page:String text] — The textual <em>pdb</em> structure to parse.
  39. </div>
  40. <div>
  41. Parse a <em>pdb</em> text and return a <em>JSON</em> structure.<br />
  42. </div>
  43. <h3>[method:null createModel]( [page:Object json], [page:Function callback] )</h3>
  44. <div>
  45. [page:Object json] — The <em>(JSON) pdb</em> structure to parse.<br />
  46. [page:Function callback] — Will be called when parse completes, with three arguments: [page:Geometry geometryAtoms], [page:Geometry geometryBonds] and the original [page:Object json].<br />
  47. </div>
  48. <div>
  49. Parse a <em>(JSON) pdb</em> structure and return two [page:Geometry]: one for atoms, one for bonds.<br />
  50. </div>
  51. <h2>Example</h2>
  52. <code>
  53. // instantiate a loader
  54. var loader = new THREE.PDBLoader();
  55. // load a PDB resource
  56. loader.load(
  57. // resource URL
  58. 'models/molecules/caffeine.pdb',
  59. // Function when resource is loaded
  60. function ( geometryAtoms, geometryBonds, json ) {
  61. console.log( 'This molecule has ' + json.atoms.length + ' atoms' );
  62. },
  63. // Function called when download progresses
  64. function ( xhr ) {
  65. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  66. },
  67. // Function called when download errors
  68. function ( xhr ) {
  69. console.log( 'An error happened' );
  70. }
  71. );
  72. </code>
  73. [example:webgl_loader_pdb]
  74. <h2>Source</h2>
  75. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PDBLoader.js examples/js/loaders/PDBLoader.js]
  76. </body>
  77. </html>