Browse Source

simplify formula suggested by WestLangley

yomotsu 7 years ago
parent
commit
2ab6388f42
1 changed files with 3 additions and 8 deletions
  1. 3 8
      examples/js/renderers/CSS3DRenderer.js

+ 3 - 8
examples/js/renderers/CSS3DRenderer.js

@@ -277,14 +277,9 @@ THREE.CSS3DRenderer = function () {
 
 
 		if ( camera.parent === null ) camera.updateMatrixWorld();
 		if ( camera.parent === null ) camera.updateMatrixWorld();
 
 
-		var cameraCSSMatrix = 'translateZ(' + fov + 'px)' +
-			getCameraCSSMatrix( camera.matrixWorldInverse );
-
-		if ( camera.type === 'OrthographicCamera' ) {
-
-			cameraCSSMatrix = 'scale(' + fov + ')' + cameraCSSMatrix;
-
-		}
+		var cameraCSSMatrix = camera.type === 'OrthographicCamera' ?
+			'scale(' + fov + ')' + getCameraCSSMatrix( camera.matrixWorldInverse ) :
+			'translateZ(' + fov + 'px)' + getCameraCSSMatrix( camera.matrixWorldInverse );
 
 
 		var style = cameraCSSMatrix +
 		var style = cameraCSSMatrix +
 			'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)';
 			'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)';