Permalink
Browse files

Merge remote-tracking branch 'alteredq/dev' into dev

  • Loading branch information...
2 parents 425063d + cbaaca3 commit fbfaf9cb9f0cab6b60267d9733ba4b13dfb0df82 @mrdoob mrdoob committed Apr 22, 2012
Showing with 16 additions and 5 deletions.
  1. +16 −5 examples/js/effects/CrosseyedEffect.js
View
21 examples/js/effects/CrosseyedEffect.js
@@ -4,6 +4,12 @@
THREE.CrosseyedEffect = function ( renderer ) {
+ // API
+
+ this.separation = 10;
+
+ // internals
+
var _width, _height;
var _cameraL = new THREE.PerspectiveCamera();
@@ -12,11 +18,7 @@ THREE.CrosseyedEffect = function ( renderer ) {
var _cameraR = new THREE.PerspectiveCamera();
_cameraR.target = new THREE.Vector3();
- var SCREEN_WIDTH = window.innerWidth;
- var SCREEN_HEIGHT = window.innerHeight;
- var HALF_WIDTH = SCREEN_WIDTH / 2;
-
- this.separation = 10;
+ // initialization
renderer.autoClear = false;
@@ -31,6 +33,8 @@ THREE.CrosseyedEffect = function ( renderer ) {
this.render = function ( scene, camera ) {
+ // left
+
_cameraL.fov = camera.fov;
_cameraL.aspect = 0.5 * camera.aspect;
_cameraL.near = camera.near;
@@ -42,13 +46,20 @@ THREE.CrosseyedEffect = function ( renderer ) {
_cameraL.translateX( this.separation );
_cameraL.lookAt( _cameraL.target );
+ // right
+
+ _cameraR.near = camera.near;
+ _cameraR.far = camera.far;
+
_cameraR.projectionMatrix = _cameraL.projectionMatrix;
_cameraR.position.copy( camera.position );
_cameraR.target.copy( camera.target );
_cameraR.translateX( - this.separation );
_cameraR.lookAt( _cameraR.target );
+ //
+
renderer.clear();
renderer.setViewport( 0, 0, _width, _height );

0 comments on commit fbfaf9c

Please sign in to comment.