[name]
A loader for loading a
.pdb resource.
The
Protein Data Bank file format is a textual file format describing the three-dimensional structures of molecules.
Example
// instantiate a loader
var loader = new v3d.PDBLoader();
// load a PDB resource
loader.load(
// resource URL
'models/molecules/caffeine.pdb',
// Function when resource is loaded
function(pdb) {
var geometryAtoms = pdb.geometryAtoms;
var geometryBonds = pdb.geometryBonds;
var json = pdb.json;
console.log('This molecule has ' + json.atoms.length + ' atoms');
},
// Function called when download progresses
function(xhr) {
console.log((xhr.loaded / xhr.total * 100) + '% loaded');
},
// Function called when download errors
function(xhr) {
console.log('An error happened');
}
);
[example:webgl_loader_pdb]
Constructor
[name]([page:LoadingManager manager])
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager v3d.DefaultLoadingManager].
Creates a new [name].
Properties
Methods
[method:null load]([page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError])
[page:String url] — required. URL to the .pdb file
[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.
[page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
[page:Function onError] — Will be called when load errors.
Begin loading from url and call onLoad with the parsed response content.
[method:Object parse]([page:String text])
[page:String text] — The textual pdb structure to parse.
Parse a pdb text and return a JSON structure.
[sourceHint]