소스 검색

Small optimization in CSS3D molecules example.

Don't need to update scene graph matrices (molecules don't change).

This has very little impact on performance though, bottleneck is not on JS side, profiler shows ~65% of time spent in "(program)".
alteredq 12 년 전
부모
커밋
6947c96776
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      examples/css3d_molecules.html

+ 13 - 0
examples/css3d_molecules.html

@@ -392,6 +392,10 @@
 						object.position.copy( position );
 						object.position.multiplyScalar( 75 );
 						object.billboard = true;
+
+						object.matrixAutoUpdate = false;
+						object.updateMatrix();
+
 						root.add( object );
 
 						objects.push( object );
@@ -432,6 +436,9 @@
 						object.matrix = objMatrix;
 						object.rotation.setEulerFromRotationMatrix( object.matrix, object.eulerOrder );
 
+						object.matrixAutoUpdate = false;
+						object.updateMatrix();
+
 						root.add( object );
 
 						objects.push( object );
@@ -449,9 +456,15 @@
 						joint.matrix.copy( objMatrix );
 						joint.rotation.setEulerFromRotationMatrix( joint.matrix, joint.eulerOrder );
 
+						joint.matrixAutoUpdate = false;
+						joint.updateMatrix();
+
 						var object = new THREE.CSS3DObject( bond );
 						object.rotation.y = Math.PI/2;
 
+						object.matrixAutoUpdate = false;
+						object.updateMatrix();
+
 						object.properties.bondLengthShort = bondLength + "px";
 						object.properties.bondLengthFull = ( bondLength + 55 ) + "px";