Skip to content

Commit

Permalink
Changed AnaglyphWebGLRenderer & co to AnaglyphEffect & co. Fixes mrdo…
Browse files Browse the repository at this point in the history
…ob#1760.

Anaglyph and ParallaxBarrier could also be merged somehow, as the only change is the fragment shader.
  • Loading branch information
mrdoob committed Apr 21, 2012
1 parent b8412d0 commit ee94657
Show file tree
Hide file tree
Showing 16 changed files with 995 additions and 1,000 deletions.
761 changes: 383 additions & 378 deletions build/Three.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/custom/ThreeDOM.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

178 changes: 91 additions & 87 deletions build/custom/ThreeExtras.js

Large diffs are not rendered by default.

159 changes: 80 additions & 79 deletions build/custom/ThreeWebGL.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions examples/webgl_materials_cars_anaglyph.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@

var container, stats;

var camera, scene, renderer;
var camera, scene, renderer, effect;

var m, mi;

Expand Down Expand Up @@ -200,10 +200,12 @@

//

renderer = new THREE.AnaglyphWebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer = new THREE.WebGLRenderer();
renderer.setFaceCulling( 0 );

effect = new THREE.AnaglyphEffect( renderer );
effect.setSize( window.innerWidth, window.innerHeight );

container.appendChild( renderer.domElement );

if ( STATS_ENABLED ) {
Expand Down Expand Up @@ -602,7 +604,7 @@

camera.lookAt( scene.position );

renderer.render( scene, camera );
effect.render( scene, camera );

if ( STATS_ENABLED ) stats.update();

Expand Down
18 changes: 10 additions & 8 deletions examples/webgl_materials_cars_camaro_crosseyed.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

var container, stats;

var camera, scene, renderer;
var camera, scene, renderer, effect;

var lightMesh;

Expand Down Expand Up @@ -97,12 +97,14 @@
scene.add( lightMesh );


renderer = new THREE.CrosseyedWebGLRenderer( { separation: 20, antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setFaceCulling( 0 );

container.appendChild( renderer.domElement );

effect = new THREE.CrosseyedEffect( renderer );
effect.setSize( window.innerWidth, window.innerHeight );
effect.separation = 20;


stats = new Stats();
stats.domElement.style.position = 'absolute';
Expand Down Expand Up @@ -207,14 +209,14 @@
switch( event.keyCode ) {

/* O */
case 79: renderer.separation -= 0.5; break;
case 79: effect.separation -= 0.5; break;

/* P */
case 80: renderer.separation += 0.5; break;
case 80: effect.separation += 0.5; break;

}

console.log( renderer.separation );
console.log( effect.separation );

};

Expand All @@ -241,7 +243,7 @@
lightMesh.position.x = 1500 * Math.cos( timer );
lightMesh.position.z = 1500 * Math.sin( timer );

renderer.render( scene, camera );
effect.render( scene, camera );

}

Expand Down
13 changes: 6 additions & 7 deletions examples/webgl_materials_cars_parallaxbarrier.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@

<script src="../build/Three.js"></script>

<script src="../src/extras/renderers/ParallaxBarrierWebGLRenderer.js"></script>

<script src="js/Detector.js"></script>
<script src="js/Stats.js"></script>

Expand Down Expand Up @@ -139,7 +137,7 @@

var container, stats;

var camera, scene, renderer;
var camera, scene, renderer, effect;

var m, mi;

Expand Down Expand Up @@ -203,12 +201,13 @@

//

renderer = new THREE.ParallaxBarrierWebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer = new THREE.WebGLRenderer();
renderer.setFaceCulling( 0 );

container.appendChild( renderer.domElement );

effect = new THREE.ParallaxBarrierEffect( renderer );
effect.setSize( window.innerWidth, window.innerHeight );

if ( STATS_ENABLED ) {

stats = new Stats();
Expand Down Expand Up @@ -603,7 +602,7 @@

camera.lookAt( scene.position );

renderer.render( scene, camera );
effect.render( scene, camera );

if ( STATS_ENABLED ) stats.update();

Expand Down
10 changes: 6 additions & 4 deletions examples/webgl_materials_cubemap_balls_reflection_anaglyph.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

var container;

var camera, scene, renderer;
var camera, scene, renderer, effect;

var mesh, lightMesh, geometry;
var spheres = [];
Expand Down Expand Up @@ -122,10 +122,12 @@

//

renderer = new THREE.AnaglyphWebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer = new THREE.WebGLRenderer();
container.appendChild( renderer.domElement );

effect = new THREE.AnaglyphEffect( renderer );
effect.setSize( window.innerWidth, window.innerHeight );

}

function onDocumentMouseMove(event) {
Expand Down Expand Up @@ -163,7 +165,7 @@

}

renderer.render( scene, camera );
effect.render( scene, camera );

}

Expand Down
17 changes: 10 additions & 7 deletions examples/webgl_materials_cubemap_balls_refraction_crosseyed.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

var container;

var camera, scene, renderer;
var camera, scene, renderer, effect;

var mesh, lightMesh, geometry;
var spheres = [];
Expand Down Expand Up @@ -122,10 +122,13 @@

//

renderer = new THREE.CrosseyedWebGLRenderer( { separation: 90 } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer = new THREE.WebGLRenderer();
container.appendChild( renderer.domElement );

effect = new THREE.CrosseyedEffect( renderer );
effect.setSize( window.innerWidth, window.innerHeight );
effect.separation = 90;

document.addEventListener( 'keydown', onKeyDown, false );

}
Expand All @@ -142,14 +145,14 @@
switch( event.keyCode ) {

/* O */
case 79: renderer.separation -= 0.5; break;
case 79: effect.separation -= 0.5; break;

/* P */
case 80: renderer.separation += 0.5; break;
case 80: effect.separation += 0.5; break;

}

console.log( renderer.separation );
console.log( effect.separation );

};

Expand Down Expand Up @@ -179,7 +182,7 @@

}

renderer.render( scene, camera );
effect.render( scene, camera );

}

Expand Down
Loading

0 comments on commit ee94657

Please sign in to comment.