Explorar o código

PDBLoader: Fix css3d_molecules

Mugen87 %!s(int64=8) %!d(string=hai) anos
pai
achega
33cad36c85
Modificáronse 1 ficheiros con 10 adicións e 5 borrados
  1. 10 5
      examples/css3d_molecules.html

+ 10 - 5
examples/css3d_molecules.html

@@ -344,13 +344,17 @@
 
 				objects = [];
 
-				loader.load( url, function ( geometry, geometryBonds ) {
+				loader.load( url, function ( pdb ) {
 
-					var offset = geometry.center();
+					var geometryAtoms = pdb.geometryAtoms;
+					var geometryBonds = pdb.geometryBonds;
+					var json = pdb.json;
+
+					var offset = geometryAtoms.center();
 					geometryBonds.translate( offset.x, offset.y, offset.z );
 
-					var positions = geometry.getAttribute( 'position' );
-					var colors = geometry.getAttribute( 'color' );
+					var positions = geometryAtoms.getAttribute( 'position' );
+					var colors = geometryAtoms.getAttribute( 'color' );
 
 					var position = new THREE.Vector3();
 					var color = new THREE.Color();
@@ -365,7 +369,8 @@
 						color.g = colors.getY( i );
 						color.b = colors.getZ( i );
 
-						var element = geometry.elements[ i ];
+						var atom = json.atoms[ i ];
+						var element = atom[ 4 ];
 
 						if ( ! colorSpriteMap[ element ] ) {