2
0
Эх сурвалжийг харах

add apsect and view properties

godlzr 8 жил өмнө
parent
commit
362e5f854a

+ 8 - 12
examples/js/cameras/CombinedCamera.js

@@ -15,18 +15,22 @@ THREE.CombinedCamera = function ( width, height, fov, near, far, orthoNear, orth
 
 	this.fov = fov;
 
+	this.far = far;
+	this.near = near;
+
 	this.left = - width / 2;
 	this.right = width / 2;
 	this.top = height / 2;
 	this.bottom = - height / 2;
 
+	this.aspect =  width / height;
+	this.zoom = 1;
+	this.view = null;
 	// We could also handle the projectionMatrix internally, but just wanted to test nested camera objects
 
 	this.cameraO = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 	orthoNear, orthoFar );
 	this.cameraP = new THREE.PerspectiveCamera( fov, width / height, near, far );
 
-	this.zoom = 1;
-
 	this.toPerspective();
 
 };
@@ -42,6 +46,7 @@ THREE.CombinedCamera.prototype.toPerspective = function () {
 	this.far = this.cameraP.far;
 
 	this.cameraP.fov =  this.fov / this.zoom ;
+	this.cameraP.view = this.view;
 
 	this.cameraP.updateProjectionMatrix();
 
@@ -75,16 +80,7 @@ THREE.CombinedCamera.prototype.toOrthographic = function () {
 	this.cameraO.right = halfWidth;
 	this.cameraO.top = halfHeight;
 	this.cameraO.bottom = - halfHeight;
-
-	// this.cameraO.left = -farHalfWidth;
-	// this.cameraO.right = farHalfWidth;
-	// this.cameraO.top = farHalfHeight;
-	// this.cameraO.bottom = -farHalfHeight;
-
-	// this.cameraO.left = this.left / this.zoom;
-	// this.cameraO.right = this.right / this.zoom;
-	// this.cameraO.top = this.top / this.zoom;
-	// this.cameraO.bottom = this.bottom / this.zoom;
+	this.cameraO.view = this.view;
 
 	this.cameraO.updateProjectionMatrix();