Просмотр исходного кода

High Quality Anaglyph Effect.

We can pass the resolution for Anaglyph Effect, Need not to tweak JS again and again.
Variable rSz is used to pass resolution numbers, As previous version 512 will be the default resolution if no value passed to function.
Aditya Sawant 13 лет назад
Родитель
Сommit
2ba2e1ad57
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      examples/js/effects/AnaglyphEffect.js

+ 5 - 3
examples/js/effects/AnaglyphEffect.js

@@ -4,12 +4,14 @@
  * @author alteredq / http://alteredqualia.com/
  */
 
-THREE.AnaglyphEffect = function ( renderer ) {
+THREE.AnaglyphEffect = function ( renderer, rSz  ) {
 
 	var eyeRight = new THREE.Matrix4();
 	var eyeLeft = new THREE.Matrix4();
 	var focalLength = 125;
 	var _aspect, _near, _far, _fov;
+	
+	if (!rSz) { var rSz = 512;}
 
 	var _cameraL = new THREE.PerspectiveCamera();
 	_cameraL.matrixAutoUpdate = false;
@@ -25,8 +27,8 @@ THREE.AnaglyphEffect = function ( renderer ) {
 
 	var _params = { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };
 
-	var _renderTargetL = new THREE.WebGLRenderTarget( 512, 512, _params );
-	var _renderTargetR = new THREE.WebGLRenderTarget( 512, 512, _params );
+	var _renderTargetL = new THREE.WebGLRenderTarget( rSz, rSz, _params );
+	var _renderTargetR = new THREE.WebGLRenderTarget( rSz, rSz, _params );
 
 	var _material = new THREE.ShaderMaterial( {