浏览代码

fixed to read "serial" field in PDB files.

Kikuchi Ken 7 年之前
父节点
当前提交
57fe310fc7
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      examples/js/loaders/PDBLoader.js

+ 3 - 2
examples/js/loaders/PDBLoader.js

@@ -152,7 +152,7 @@ THREE.PDBLoader.prototype = {
 
 		var bhash = {};
 
-		var x, y, z, e;
+		var x, y, z, index, e;
 
 		// parse
 
@@ -165,6 +165,7 @@ THREE.PDBLoader.prototype = {
 				x = parseFloat( lines[ i ].substr( 30, 7 ) );
 				y = parseFloat( lines[ i ].substr( 38, 7 ) );
 				z = parseFloat( lines[ i ].substr( 46, 7 ) );
+				index = parseInt( lines[ i ].substr( 6, 5 ) ) - 1;
 
 				e = trim( lines[ i ].substr( 76, 2 ) ).toLowerCase();
 
@@ -174,7 +175,7 @@ THREE.PDBLoader.prototype = {
 
 				}
 
-				atoms.push( [ x, y, z, CPK[ e ], capitalize( e ) ] );
+				atoms[index] = [ x, y, z, CPK[ e ], capitalize( e ) ];
 
 				if ( histogram[ e ] === undefined ) {