浏览代码

Editor: Fixed camera aspect breakage.

Mr.doob 9 年之前
父节点
当前提交
4abbce4110
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 3 0
      editor/js/Editor.js
  2. 5 0
      editor/js/Viewport.js

+ 3 - 0
editor/js/Editor.js

@@ -458,6 +458,9 @@ Editor.prototype = {
 		var camera = loader.parse( json.camera );
 
 		this.camera.copy( camera );
+		this.camera.aspect = this.DEFAULT_CAMERA.aspect;
+		this.camera.updateProjectionMatrix();
+
 		this.history.fromJSON( json.history );
 		this.scripts = json.scripts;
 

+ 5 - 0
editor/js/Viewport.js

@@ -507,6 +507,11 @@ var Viewport = function ( editor ) {
 
 	signals.windowResize.add( function () {
 
+		// TODO: Move this out?
+
+		editor.DEFAULT_CAMERA.aspect = container.dom.offsetWidth / container.dom.offsetHeight;
+		editor.DEFAULT_CAMERA.updateProjectionMatrix();
+
 		camera.aspect = container.dom.offsetWidth / container.dom.offsetHeight;
 		camera.updateProjectionMatrix();