PDBLoader.html 2.9 KB

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