PDBLoader.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. <h1>[name]</h1>
  12. <div class="desc">
  13. A loader for loading a <em>.pdb</em> resource.
  14. <br /><br />
  15. 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.
  16. </div>
  17. <h2>Constructor</h2>
  18. <h3>[name]( [page:LoadingManager manager] )</h3>
  19. <div>
  20. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  21. </div>
  22. <div>
  23. Creates a new [name].
  24. </div>
  25. <h2>Properties</h2>
  26. <h2>Methods</h2>
  27. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  28. <div>
  29. [page:String url] — required. URL to the <em>.pdb</em> file<br />
  30. [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 />
  31. [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 />
  32. [page:Function onError] — Will be called when load errors.<br />
  33. </div>
  34. <div>
  35. Begin loading from url and call onLoad with the parsed response content.
  36. </div>
  37. <h3>[method:Object parsePDB]( [page:String text] )</h3>
  38. <div>
  39. [page:String text] — The textual <em>pdb</em> structure to parse.
  40. </div>
  41. <div>
  42. Parse a <em>pdb</em> text and return a <em>JSON</em> structure.<br />
  43. </div>
  44. <h3>[method:null createModel]( [page:Object json], [page:Function callback] )</h3>
  45. <div>
  46. [page:Object json] — The <em>(JSON) pdb</em> structure to parse.<br />
  47. [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 />
  48. </div>
  49. <div>
  50. Parse a <em>(JSON) pdb</em> structure and return two [page:Geometry]: one for atoms, one for bonds.<br />
  51. </div>
  52. <h2>Example</h2>
  53. <code>
  54. // instantiate a loader
  55. var loader = new THREE.PDBLoader();
  56. // load a PDB resource
  57. loader.load(
  58. // resource URL
  59. 'models/molecules/caffeine.pdb',
  60. // Function when resource is loaded
  61. function ( geometryAtoms, geometryBonds, json ) {
  62. console.log( 'This molecule has ' + json.atoms.length + ' atoms' );
  63. },
  64. // Function called when download progresses
  65. function ( xhr ) {
  66. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  67. },
  68. // Function called when download errors
  69. function ( xhr ) {
  70. console.log( 'An error happened' );
  71. }
  72. );
  73. </code>
  74. [example:webgl_loader_pdb]
  75. <h2>Source</h2>
  76. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PDBLoader.js examples/js/loaders/PDBLoader.js]
  77. </body>
  78. </html>