浏览代码

add copy function

godlzr 8 年之前
父节点
当前提交
cf70dd04a7
共有 1 个文件被更改,包括 25 次插入0 次删除
  1. 25 0
      examples/js/cameras/CombinedCamera.js

+ 25 - 0
examples/js/cameras/CombinedCamera.js

@@ -97,7 +97,32 @@ THREE.CombinedCamera.prototype.toOrthographic = function () {
 
 
 };
 };
 
 
+THREE.CombinedCamera.prototype.copy = function ( source ) {
 
 
+	THREE.Camera.prototype.copy.call( this, source );
+
+	this.fov = source.fov;
+	this.far = source.far;
+	this.near = source.near;
+
+	this.left = source.left;
+	this.right = source.right;
+	this.top = source.top;
+	this.bottom = source.bottom;
+
+	this.zoom = source.zoom;
+	this.view = source.view === null ? null : Object.assign( {}, source.view );
+	this.aspect = source.aspect;
+
+	this.cameraO = source.cameraO.copy();
+	this.cameraP = source.cameraP.copy();
+
+	this.inOrthographicMode = source.inOrthographicMode;
+	this.inPerspectiveMode = source.inPerspectiveMode;
+
+	return this;
+
+};
 THREE.CombinedCamera.prototype.setSize = function( width, height ) {
 THREE.CombinedCamera.prototype.setSize = function( width, height ) {
 
 
 	this.cameraP.aspect = width / height;
 	this.cameraP.aspect = width / height;