浏览代码

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";