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