Răsfoiți Sursa

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

Mr.doob 13 ani în urmă
părinte
comite
fbcdbfd703

+ 2 - 2
build/Three.js

@@ -815,8 +815,8 @@ m.customDepthMaterial:m.geometry.morphTargets.length?d:c,k instanceof THREE.Buff
 j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
 1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:m},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(q);this.setSize=function(a,d){c.call(b,a,d);m.width=a;m.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||p!==c.fov){i=c.aspect;j=c.near;k=c.far;p=c.fov;var u=c.projectionMatrix.clone(),v=0.5*(125/30),t=v*j/125,w=j*Math.tan(p*Math.PI/360),z;g.n14=v;h.n14=-v;v=-w*i+t;z=w*i+t;u.n11=2*j/(z-v);u.n13=(z+v)/(z-v);e.projectionMatrix.copy(u);v=-w*i-t;z=w*i-t;u.n11=
-2*j/(z-v);u.n13=(z+v)/(z-v);f.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,m,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);n.updateMatrixWorld();d.call(b,n,q)}};
+n=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;n.add(a);n.add(q);this.setSize=function(a,d){c.call(b,a,d);m.width=a;m.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||p!==c.fov){i=c.aspect;j=c.near;k=c.far;p=c.fov;var u=c.projectionMatrix.clone(),v=0.5*(125/30),t=v*j/125,w=j*Math.tan(p*Math.PI/360),z;g.n14=v;h.n14=-v;v=-w*i+t;z=w*i+t;u.n11=2*j/(z-v);u.n13=(z+v)/(z-v);e.projectionMatrix.copy(u);
+v=-w*i-t;z=w*i-t;u.n11=2*j/(z-v);u.n13=(z+v)/(z-v);f.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,m,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);n.updateMatrixWorld();d.call(b,n,q)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,f,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
 c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 2 - 2
build/custom/ThreeExtras.js

@@ -442,8 +442,8 @@ l.customDepthMaterial:l.geometry.morphTargets.length?d:c,i instanceof THREE.Buff
 k=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,k);a.enable(a.BLEND)}};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,j,k,i,o;f.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.PerspectiveCamera(53,
 1,1,1E4);p.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(p);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(j!==c.aspect||k!==c.near||i!==c.far||o!==c.fov){j=c.aspect;k=c.near;i=c.far;o=c.fov;var t=c.projectionMatrix.clone(),s=0.5*(125/30),u=s*k/125,v=k*Math.tan(o*Math.PI/360),w;g.n14=s;h.n14=-s;s=-v*j+u;w=v*j+u;t.n11=2*k/(w-s);t.n13=(w+s)/(w-s);f.projectionMatrix.copy(t);s=-v*j-u;w=v*j-u;t.n11=
-2*k/(w-s);t.n13=(w+s)/(w-s);e.projectionMatrix.copy(t)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,!0);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,!0);m.updateMatrixWorld();d.call(b,m,p)}};
+m=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(p);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(j!==c.aspect||k!==c.near||i!==c.far||o!==c.fov){j=c.aspect;k=c.near;i=c.far;o=c.fov;var t=c.projectionMatrix.clone(),s=0.5*(125/30),u=s*k/125,v=k*Math.tan(o*Math.PI/360),w;g.n14=s;h.n14=-s;s=-v*j+u;w=v*j+u;t.n11=2*k/(w-s);t.n13=(w+s)/(w-s);f.projectionMatrix.copy(t);
+s=-v*j-u;w=v*j-u;t.n11=2*k/(w-s);t.n13=(w+s)/(w-s);e.projectionMatrix.copy(t)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,!0);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,!0);m.updateMatrixWorld();d.call(b,m,p)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,f,e,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);f=a/2;e=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
 c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,f,e);d.call(b,a,g);this.setViewport(f,0,f,e);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 2 - 2
examples/misc_camera_path.html

@@ -61,7 +61,7 @@
 			function init() {
 
 				scene = new THREE.Scene();
-				scene.fog = new THREE.FogExp2( 0xffffff, 0.002 );
+				scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 );
 
 				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 );
 
@@ -117,7 +117,7 @@
 				// renderer
 
 				renderer = new THREE.WebGLRenderer( { antialias: false } );
-				renderer.setClearColorHex( 0xffffff, 1 );
+				renderer.setClearColor( scene.fog.color, 1 );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container = document.getElementById( 'container' );

+ 3 - 3
examples/misc_camera_roll.html

@@ -62,7 +62,7 @@
 				// scene and camera
 
 				scene = new THREE.Scene();
-				scene.fog = new THREE.FogExp2( 0xffffff, 0.002 );
+				scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 );
 
 				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
 
@@ -102,14 +102,14 @@
 				light.position.set( -1, -1, -1 );
 				scene.add( light );
 
-				light = new THREE.AmbientLight( 0x222222 );
+				light = new THREE.AmbientLight( 0x555555 );
 				scene.add( light );
 
 
 				// renderer
 
 				renderer = new THREE.WebGLRenderer( { antialias: false } );
-				renderer.setClearColorHex( 0xffffff, 1 );
+				renderer.setClearColor( scene.fog.color, 1 );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container = document.getElementById( 'container' );

+ 2 - 2
examples/misc_camera_trackball.html

@@ -60,7 +60,7 @@
 				// scene and camera
 
 				scene = new THREE.Scene();
-				scene.fog = new THREE.FogExp2( 0xffffff, 0.002 );
+				scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 );
 
 				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.z = 500;
@@ -118,7 +118,7 @@
 				// renderer
 
 				renderer = new THREE.WebGLRenderer( { antialias: false } );
-				renderer.setClearColorHex( 0xffffff, 1 );
+				renderer.setClearColor( scene.fog.color, 1 );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container = document.getElementById( 'container' );

+ 0 - 340
examples/misc_materials_multimaterials.html

@@ -1,340 +0,0 @@
-<!doctype html>
-<html lang="en">
-	<head>
-		<title>three.js misc - materials - multi-materials</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<style>
-			body {
-				background:#fff;
-				padding:0;
-				margin:0;
-				overflow:hidden;
-				font-family:georgia;
-				text-align:center;
-			}
-			h1 { }
-			a { color:skyblue }
-			canvas { pointer-events:none; z-index:10; }
-
-			#d { text-align:center; margin:1em 0 -15.7em 0; z-index:0; position:relative; display:block }
-			.button { background:#000; color:#fff; padding:0.2em 0.5em; cursor:pointer }
-			.inactive { background:#999; color:#eee }
-		</style>
-	</head>
-
-	<body>
-		<div id="d">
-			<h1>Multi-materials test</h1>
-
-			<span id="rcanvas" class="button inactive">2d canvas renderer</span>
-			<span id="rwebgl" class="button">WebGL renderer</span>
-			<br/>
-
-			<p>Model by <a href="http://sketchup.google.com/3dwarehouse/details?mid=2c6fd128fca34052adc5f5b98d513da1">Reallusion iClone</a>
-
-			<br/>
-			<p>Best viewed in Chrome 9 or Firefox 4 using WebGL renderer.
-			<p>Canvas renderer is very slow on anything other than Chrome.
-
-		</div>
-
-		<script src="../build/Three.js"></script>
-
-		<script src="js/Stats.js"></script>
-
-		<script>
-
-			var SCREEN_WIDTH = window.innerWidth;
-			var SCREEN_HEIGHT = window.innerHeight;
-			var FLOOR = - 250;
-
-			var container;
-			var stats;
-
-			var camera;
-			var scene;
-			var canvasRenderer, webglRenderer;
-
-			var mesh, zmesh, geometry;
-
-			var directionalLight;
-
-			var mouseX = 0;
-			var mouseY = 0;
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-
-			var render_canvas = 1, render_gl = 1;
-			var has_gl = 0;
-
-			var bcanvas = document.getElementById( 'rcanvas' );
-			var bwebgl = document.getElementById( 'rwebgl' );
-
-			document.addEventListener('mousemove', onDocumentMouseMove, false);
-
-			init();
-			animate();
-
-			render_canvas = !has_gl;
-			bwebgl.style.display = has_gl ? "inline" : "none";
-			bcanvas.className = render_canvas ? "button" : "button inactive";
-
-			function init() {
-
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				scene = new THREE.Scene();
-
-				camera = new THREE.PerspectiveCamera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
-				camera.position.z = 500;
-
-				scene.add( camera );
-
-				// SPHERES
-
-				var m1 = new THREE.MeshLambertMaterial( { color: 0xffffff } );
-				var m2 = new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframeLinewidth: 1.5, transparent: true } );
-
-				sphere = new THREE.SphereGeometry( 100, 16, 8 );
-
-				for ( var i = 0; i < 10; i ++ ) {
-
-					var group = new THREE.Object3D();
-
-					group.position.x = 500 * ( Math.random() - 0.5 );
-					group.position.y = 500 * ( Math.random() - 0.5 );
-					group.position.z = 500 * ( Math.random() - 0.5 );
-
-					group.scale.x = group.scale.y = group.scale.z = 0.25 * ( Math.random() + 0.5 );
-
-					scene.add( group );
-
-					var mesh1 = new THREE.Mesh( sphere, m1 );
-					var mesh2 = new THREE.Mesh( sphere, m2 );
-
-					group.add( mesh1 );
-					group.add( mesh2 );
-
-				}
-
-
-				// LIGHTS
-
-				var ambient = new THREE.AmbientLight( 0x101010 );
-				scene.add( ambient );
-
-				directionalLight = new THREE.DirectionalLight( 0xffffff );
-				directionalLight.position.set( 0, -70, 100 ).normalize();
-				scene.add( directionalLight );
-
-				mesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xff0000 } ) );
-				mesh.scale.set( 0.1, 0.1, 0.1 );
-				mesh.position.set( 0, 0, 120 );
-				scene.add( mesh );
-
-				if ( render_gl ) {
-
-					try {
-
-						webglRenderer = new THREE.WebGLRenderer();
-						webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
-						webglRenderer.domElement.style.position = "relative";
-						container.appendChild( webglRenderer.domElement );
-						has_gl = 1;
-
-					}
-					catch (e) {
-					}
-
-				}
-
-				if ( render_canvas ) {
-
-					canvasRenderer = new THREE.CanvasRenderer();
-					canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
-					container.appendChild( canvasRenderer.domElement );
-
-				}
-
-
-				stats = new Stats();
-				stats.domElement.style.position = 'absolute';
-				stats.domElement.style.top = '0px';
-				stats.domElement.style.zIndex = 100;
-				container.appendChild( stats.domElement );
-
-				bcanvas.addEventListener("click", toggleCanvas, false);
-				bwebgl.addEventListener("click", toggleWebGL, false);
-
-				//var loader = new THREE.BinaryLoader(),
-				var loader = new THREE.JSONLoader(),
-					callback = function( geometry ) { createScene( geometry ) };
-
-				loader.load( "obj/female02/Female02_slim.js", callback );
-				//loader.load( "obj/female02/Female02_bin.js", callback );
-
-			}
-
-			function createScene( geometry ) {
-
-				// PROCEDURAL TEXTURES (decals)
-
-				var x1 = document.createElement( "canvas" );
-				var xc1 = x1.getContext("2d");
-				x1.width = x1.height = 256;
-
-				xc1.shadowBlur = 3;
-				xc1.shadowColor = "#000";
-				xc1.font = "7pt arial";
-				xc1.fillStyle = "hsla("+0+",90%,50%,1);"
-				xc1.fillText("Three", 57, 29);
-
-				xc1.fillStyle = "hsla("+0+",90%,50%,0.15);"
-				xc1.fillRect(40, 70, 60, 50);
-
-				for( var i = 0; i < 500; i ++ ) {
-
-					xc1.fillStyle = "hsla("+60*Math.random()+",90%,50%,0.5);"
-					xc1.fillRect( 40+60*Math.random(), 118+10*Math.random(), 2, 10 );
-
-				}
-
-				var x2 = document.createElement( "canvas" );
-				var xc2 = x2.getContext("2d");
-				x2.width = x2.height = 128;
-				xc2.fillStyle = "rgba(0,0,0,0.5)";
-
-				for( var i = 0; i < 14; i ++ ) {
-
-					xc2.fillRect( 0, 5+i*4, 54, 2 );
-					xc2.fillRect( i*4, 5, 2, 54 );
-
-				}
-
-				var xm1 = new THREE.MeshLambertMaterial( { map: new THREE.Texture( x1 ), transparent: true } );
-				var xm2 = new THREE.MeshLambertMaterial( { map: new THREE.Texture( x2 ), transparent: true  } );
-				xm1.map.needsUpdate = true;
-				xm2.map.needsUpdate = true;
-
-				geometry.materials[ 0 ] = xm1; // goes to faces with material 0
-				geometry.materials[ 1 ] = xm2; // goes to faces with material 1
-
-				geometry.materials[ 4 ] = new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } );
-
-				zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
-				zmesh.position.set( -80, FLOOR, 50 );
-				zmesh.scale.set( 3, 3, 3 );
-				scene.add( zmesh );
-
-				// PLANES with all materials from the model
-
-				createMaterialsPalette( geometry.materials, 100, 0 );
-
-			}
-
-			function createMaterialsPalette( materials, size, bottom ) {
-
-				for ( var i = 0; i < materials.length; i ++ ) {
-
-					// material
-					mesh = new THREE.Mesh( new THREE.PlaneGeometry( size, size ), materials[i] );
-					mesh.position.x = i * ( size + 5 ) - ( ( materials.length - 1 ) * ( size + 5 ) / 2 );
-					mesh.position.y = FLOOR + size / 2 + bottom;
-					mesh.position.z = -100;
-					mesh.rotation.x = Math.PI / 2;
-					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
-					mesh.doubleSided = true;
-					scene.add( mesh );
-
-					// number
-					var x = document.createElement( "canvas" );
-					var xc = x.getContext("2d");
-					x.width = x.height = 128;
-					xc.shadowColor = "#000";
-					xc.shadowBlur = 7;
-					xc.fillStyle = "orange";
-					xc.font = "50pt arial bold";
-					xc.fillText( i, 10, 64 );
-
-					var xm = new THREE.MeshBasicMaterial( { map: new THREE.Texture( x ), transparent: true  } );
-					xm.map.needsUpdate = true;
-
-					mesh = new THREE.Mesh( new THREE.PlaneGeometry( size, size ), xm );
-					mesh.position.x = i * ( size + 5 ) - ( ( materials.length - 1 ) * ( size + 5 ) / 2 );
-					mesh.position.y = FLOOR + size / 2 + bottom;
-					mesh.position.z = - 99;
-					mesh.rotation.x = Math.PI / 2;
-					mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
-					mesh.doubleSided = true;
-					scene.add( mesh );
-				}
-
-			}
-
-			function onDocumentMouseMove( event ) {
-
-				mouseX = ( event.clientX - windowHalfX );
-				mouseY = ( event.clientY - windowHalfY );
-
-			}
-
-			//
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				render();
-				stats.update();
-
-			}
-
-			function render() {
-
-				camera.position.x += ( mouseX - camera.position.x ) * .05;
-				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-
-				camera.lookAt( scene.position );
-
-				if ( render_canvas ) canvasRenderer.render( scene, camera );
-				if ( render_gl && has_gl ) webglRenderer.render( scene, camera );
-
-			}
-
-
-			function toggleCanvas() {
-
-				render_canvas = !render_canvas;
-				bcanvas.className = render_canvas ? "button" : "button inactive";
-
-				render_gl = !render_canvas;
-				bwebgl.className = render_gl ? "button" : "button inactive";
-
-				if( has_gl )
-					webglRenderer.domElement.style.display = render_gl ? "block" : "none";
-
-				canvasRenderer.domElement.style.display = render_canvas ? "block" : "none";
-
-			}
-
-			function toggleWebGL() {
-
-				render_gl = !render_gl;
-				bwebgl.className = render_gl ? "button" : "button inactive";
-
-				render_canvas = !render_gl;
-				bcanvas.className = render_canvas ? "button" : "button inactive";
-
-				if( has_gl )
-					webglRenderer.domElement.style.display = render_gl ? "block" : "none";
-
-				canvasRenderer.domElement.style.display = render_canvas ? "block" : "none";
-
-			}
-		</script>
-
-	</body>
-</html>

+ 2 - 2
examples/scenes/test_scene.js

@@ -123,7 +123,7 @@
 		"geometry" : "quad",
 		"materials": [ "textured_bg" ],
 		"position" : [ 0, 15, -90 ],
-		"rotation" : [ 0, 0, 0 ],
+		"rotation" : [ 1.57, 0, 0 ],
 		"scale"	   : [ 20, 20, 20 ],
 		"visible"  : true
 	},
@@ -132,7 +132,7 @@
 		"geometry" : "plane",
 		"materials": [ "basic_gray" ],
 		"position" : [ 0, -10, 0 ],
-		"rotation" : [ 1.57, 0, 0 ],
+		"rotation" : [ 0, 0, 0 ],
 		"scale"	   : [ 100, 100, 100 ],
 		"visible"  : true
 	}

+ 2 - 2
src/core/Spline.js

@@ -34,8 +34,8 @@ THREE.Spline = function ( points ) {
 
 		c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;
 		c[ 1 ] = intPoint;
-		c[ 2 ] = intPoint  > points.length - 2 ? points.length -1 : intPoint + 1;
-		c[ 3 ] = intPoint  > points.length - 3 ? points.length -1 : intPoint + 2;
+		c[ 2 ] = intPoint  > this.points.length - 2 ? this.points.length - 1 : intPoint + 1;
+		c[ 3 ] = intPoint  > this.points.length - 3 ? this.points.length - 1 : intPoint + 2;
 
 		pa = this.points[ c[ 0 ] ];
 		pb = this.points[ c[ 1 ] ];

+ 5 - 1
src/extras/renderers/AnaglyphWebGLRenderer.js

@@ -79,7 +79,11 @@ if ( THREE.WebGLRenderer ) {
 		} );
 
 		var _scene = new THREE.Scene();
-		_scene.add( new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), _material ) );
+
+		var mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), _material );
+		mesh.rotation.x = Math.PI / 2;
+
+		_scene.add( mesh );
 
 		_scene.add( _camera );
 

+ 5 - 1
src/extras/renderers/ParallaxBarrierWebGLRenderer.js

@@ -81,7 +81,11 @@ if ( THREE.WebGLRenderer ) {
 		} );
 
 		var _scene = new THREE.Scene();
-		_scene.add( new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), _material ) );
+
+		var mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), _material );
+		mesh.rotation.x = Math.PI / 2;
+
+		_scene.add( mesh );
 
 		_scene.add( _camera );