Browse Source

Merge branch 'dev' of github.com:mrdoob/three.js into pvrloader

Pierre Lepers 11 years ago
parent
commit
df49473271

+ 55 - 50
build/three.js

@@ -23,7 +23,7 @@ if ( Math.sign === undefined ) {
 		return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : 0;
 		return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : 0;
 
 
 	};
 	};
-	
+
 }
 }
 
 
 // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button
 // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button
@@ -17419,12 +17419,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	_clearColor = new THREE.Color( 0x000000 ),
 	_clearColor = new THREE.Color( 0x000000 ),
 	_clearAlpha = 0;
 	_clearAlpha = 0;
-	
+
 	var lights = [];
 	var lights = [];
-	
+
 	var _webglObjects = {};
 	var _webglObjects = {};
 	var _webglObjectsImmediate = [];
 	var _webglObjectsImmediate = [];
-	
+
 	var opaqueObjects = [];
 	var opaqueObjects = [];
 	var transparentObjects = [];
 	var transparentObjects = [];
 
 
@@ -17912,7 +17912,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	};
 	};
 
 
 	// Events
 	// Events
-	
+
 	var onObjectRemoved = function ( event ) {
 	var onObjectRemoved = function ( event ) {
 
 
 		var object = event.target;
 		var object = event.target;
@@ -20523,7 +20523,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	function painterSortStable ( a, b ) {
 	function painterSortStable ( a, b ) {
 
 
 		if ( a.material.id !== b.material.id ) {
 		if ( a.material.id !== b.material.id ) {
-		
+
 			return b.material.id - a.material.id;
 			return b.material.id - a.material.id;
 
 
 		} else if ( a.z !== b.z ) {
 		} else if ( a.z !== b.z ) {
@@ -20610,7 +20610,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		lights.length = 0;
 		lights.length = 0;
 		opaqueObjects.length = 0;
 		opaqueObjects.length = 0;
 		transparentObjects.length = 0;
 		transparentObjects.length = 0;
-		
+
 		projectObject( scene, scene, camera );
 		projectObject( scene, scene, camera );
 
 
 		if ( _this.sortObjects === true ) {
 		if ( _this.sortObjects === true ) {
@@ -20621,7 +20621,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		}
 		}
 
 
 		// custom render plugins (pre pass)
 		// custom render plugins (pre pass)
-		
+
 		renderPlugins( this.renderPluginsPre, scene, camera );
 		renderPlugins( this.renderPluginsPre, scene, camera );
 
 
 		//
 		//
@@ -20708,35 +20708,35 @@ THREE.WebGLRenderer = function ( parameters ) {
 		// _gl.finish();
 		// _gl.finish();
 
 
 	};
 	};
-	
+
 	function projectObject(scene, object,camera){
 	function projectObject(scene, object,camera){
-		
+
 		if ( object.visible === false ) return;
 		if ( object.visible === false ) return;
-		
+
 		if ( object instanceof THREE.Light ) {
 		if ( object instanceof THREE.Light ) {
 
 
 			lights.push( object );
 			lights.push( object );
 
 
 		}
 		}
-		
+
 		if ( object instanceof THREE.Scene ) {
 		if ( object instanceof THREE.Scene ) {
-		
+
 			//
 			//
-		
+
 		} else {
 		} else {
-		
+
 			initObject( object, scene );
 			initObject( object, scene );
-		
+
 			var webglObjects = _webglObjects[ object.id ];
 			var webglObjects = _webglObjects[ object.id ];
-		
+
 			if ( webglObjects && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) {
 			if ( webglObjects && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) {
-			
+
 				updateObject( object, scene );
 				updateObject( object, scene );
-			
+
 				for ( var i = 0, l = webglObjects.length; i < l; i ++ ) {
 				for ( var i = 0, l = webglObjects.length; i < l; i ++ ) {
-				
+
 					var webglObject = webglObjects[i];
 					var webglObject = webglObjects[i];
-				
+
 					unrollBufferMaterial( webglObject );
 					unrollBufferMaterial( webglObject );
 
 
 					webglObject.render = true;
 					webglObject.render = true;
@@ -20763,7 +20763,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			}
 			}
 
 
 		}
 		}
-		
+
 		for ( var i = 0, l = object.children.length; i < l; i ++ ) {
 		for ( var i = 0, l = object.children.length; i < l; i ++ ) {
 
 
 			projectObject( scene, object.children[ i ], camera );
 			projectObject( scene, object.children[ i ], camera );
@@ -20962,9 +20962,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 			object.addEventListener( 'removed', onObjectRemoved );
 			object.addEventListener( 'removed', onObjectRemoved );
 
 
 		}
 		}
-		
+
 		var geometry = object.geometry;
 		var geometry = object.geometry;
-		
+
 		if ( geometry === undefined ) {
 		if ( geometry === undefined ) {
 
 
 			// ImmediateRenderObject
 			// ImmediateRenderObject
@@ -20979,7 +20979,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				//
 				//
 
 
 			} else if ( object instanceof THREE.Mesh ) {
 			} else if ( object instanceof THREE.Mesh ) {
-				
+
 				initGeometryGroups(scene, object, geometry);
 				initGeometryGroups(scene, object, geometry);
 
 
 			} else if ( object instanceof THREE.Line ) {
 			} else if ( object instanceof THREE.Line ) {
@@ -21022,10 +21022,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 				} else if ( geometry instanceof THREE.Geometry ) {
 				} else if ( geometry instanceof THREE.Geometry ) {
 
 
 					for ( var i = 0,l = geometry.geometryGroupsList.length; i<l;i++ ) {
 					for ( var i = 0,l = geometry.geometryGroupsList.length; i<l;i++ ) {
-	
+
 						var geometryGroup = geometry.geometryGroupsList[ i ];
 						var geometryGroup = geometry.geometryGroupsList[ i ];
 						addBuffer( _webglObjects, geometryGroup, object );
 						addBuffer( _webglObjects, geometryGroup, object );
-						
+
 					}
 					}
 				}
 				}
 
 
@@ -21045,14 +21045,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 		}
 		}
 
 
 	};
 	};
-	
+
 	function initGeometryGroups( scene, object, geometry ) {
 	function initGeometryGroups( scene, object, geometry ) {
-		
+
 		var g, geometryGroup, material,addBuffers = false;
 		var g, geometryGroup, material,addBuffers = false;
 		material = object.material;
 		material = object.material;
 
 
 		if ( geometry.geometryGroups === undefined || geometry.groupsNeedUpdate ) {
 		if ( geometry.geometryGroups === undefined || geometry.groupsNeedUpdate ) {
-			
+
 			delete _webglObjects[object.id];
 			delete _webglObjects[object.id];
 			geometry.makeGroups( material instanceof THREE.MeshFaceMaterial, _glExtensionElementIndexUint ? 4294967296 : 65535  );
 			geometry.makeGroups( material instanceof THREE.MeshFaceMaterial, _glExtensionElementIndexUint ? 4294967296 : 65535  );
 			geometry.groupsNeedUpdate = false;
 			geometry.groupsNeedUpdate = false;
@@ -21079,15 +21079,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 				geometry.normalsNeedUpdate = true;
 				geometry.normalsNeedUpdate = true;
 				geometry.tangentsNeedUpdate = true;
 				geometry.tangentsNeedUpdate = true;
 				geometry.colorsNeedUpdate = true;
 				geometry.colorsNeedUpdate = true;
-				
+
 				addBuffers = true;
 				addBuffers = true;
-				
+
 			} else {
 			} else {
-				
+
 				addBuffers = false;
 				addBuffers = false;
-				
+
 			}
 			}
-			
+
 			if ( addBuffers || object.__webglActive === undefined ) {
 			if ( addBuffers || object.__webglActive === undefined ) {
 				addBuffer( _webglObjects, geometryGroup, object );
 				addBuffer( _webglObjects, geometryGroup, object );
 			}
 			}
@@ -21097,7 +21097,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		object.__webglActive = true;
 		object.__webglActive = true;
 
 
 	}
 	}
-	
+
 	function addBuffer( objlist, buffer, object ) {
 	function addBuffer( objlist, buffer, object ) {
 
 
 		var id = object.id;
 		var id = object.id;
@@ -21143,9 +21143,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			// check all geometry groups
 			// check all geometry groups
 			if ( geometry.buffersNeedUpdate || geometry.groupsNeedUpdate ) {
 			if ( geometry.buffersNeedUpdate || geometry.groupsNeedUpdate ) {
-				
+
 				initGeometryGroups(scene, object,geometry);
 				initGeometryGroups(scene, object,geometry);
-				
+
 			}
 			}
 
 
 			for ( var i = 0, il = geometry.geometryGroupsList.length; i < il; i ++ ) {
 			for ( var i = 0, il = geometry.geometryGroupsList.length; i < il; i ++ ) {
@@ -21289,9 +21289,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 	// Materials
 	// Materials
 
 
 	this.initMaterial = function () {
 	this.initMaterial = function () {
-	
+
 		console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
 		console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
-	
+
 	};
 	};
 
 
 	function initMaterial( material, lights, fog, object ) {
 	function initMaterial( material, lights, fog, object ) {
@@ -22146,7 +22146,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				//
 				//
 
 
-				case 'i': 
+				case 'i':
 
 
 					// single integer
 					// single integer
 					_gl.uniform1i( location, value );
 					_gl.uniform1i( location, value );
@@ -22174,7 +22174,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 					break;
 					break;
 
 
-				case 'v4': 
+				case 'v4':
 
 
 					// single THREE.Vector4
 					// single THREE.Vector4
 					_gl.uniform4f( location, value.x, value.y, value.z, value.w );
 					_gl.uniform4f( location, value.x, value.y, value.z, value.w );
@@ -23573,7 +23573,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_glExtensionTextureFilterAnisotropic = _gl.getExtension( 'EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );
 		_glExtensionTextureFilterAnisotropic = _gl.getExtension( 'EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );
 
 
 		_glExtensionCompressedTextureS3TC = _gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );
 		_glExtensionCompressedTextureS3TC = _gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );
-		_glExtensionCompressedTexturePVRTC = _gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_pvrtc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );
+		_glExtensionCompressedTexturePVRTC = _gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );
 
 
 		_glExtensionElementIndexUint = _gl.getExtension( 'OES_element_index_uint' );
 		_glExtensionElementIndexUint = _gl.getExtension( 'OES_element_index_uint' );
 
 
@@ -25033,7 +25033,7 @@ THREE.Audio.prototype.load = function ( file ) {
 
 
 			scope.source.buffer = buffer;
 			scope.source.buffer = buffer;
 			scope.source.connect( scope.panner );
 			scope.source.connect( scope.panner );
-			scope.source.start();
+			scope.source.start( 0 );
 
 
 		} );
 		} );
 
 
@@ -25044,6 +25044,12 @@ THREE.Audio.prototype.load = function ( file ) {
 
 
 };
 };
 
 
+THREE.Audio.prototype.setLoop = function ( value ) {
+
+	this.source.loop = value;
+
+};
+
 THREE.Audio.prototype.setRefDistance = function ( value ) {
 THREE.Audio.prototype.setRefDistance = function ( value ) {
 
 
 	this.panner.refDistance = value;
 	this.panner.refDistance = value;
@@ -25057,7 +25063,7 @@ THREE.Audio.prototype.setRolloffFactor = function ( value ) {
 };
 };
 
 
 THREE.Audio.prototype.updateMatrixWorld = ( function () {
 THREE.Audio.prototype.updateMatrixWorld = ( function () {
-	
+
 	var position = new THREE.Vector3();
 	var position = new THREE.Vector3();
 
 
 	return function ( force ) {
 	return function ( force ) {
@@ -25084,7 +25090,7 @@ THREE.AudioListener = function () {
 
 
 	this.type = 'AudioListener';
 	this.type = 'AudioListener';
 
 
-	this.context = new AudioContext();
+	this.context = new ( window.AudioContext || window.webkitAudioContext )();
 
 
 };
 };
 
 
@@ -25102,7 +25108,7 @@ THREE.AudioListener.prototype.updateMatrixWorld = ( function () {
 	var positionPrev = new THREE.Vector3();
 	var positionPrev = new THREE.Vector3();
 
 
 	return function ( force ) {
 	return function ( force ) {
-	
+
 		THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
 		THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
 
 
 		var listener = this.context.listener;
 		var listener = this.context.listener;
@@ -31676,7 +31682,7 @@ THREE.DirectionalLightHelper = function ( light, size ) {
 THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype );
 THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype );
 
 
 THREE.DirectionalLightHelper.prototype.dispose = function () {
 THREE.DirectionalLightHelper.prototype.dispose = function () {
-	
+
 	this.lightPlane.geometry.dispose();
 	this.lightPlane.geometry.dispose();
 	this.lightPlane.material.dispose();
 	this.lightPlane.material.dispose();
 	this.targetLine.geometry.dispose();
 	this.targetLine.geometry.dispose();
@@ -31702,11 +31708,10 @@ THREE.DirectionalLightHelper.prototype.update = function () {
 		this.targetLine.geometry.verticesNeedUpdate = true;
 		this.targetLine.geometry.verticesNeedUpdate = true;
 		this.targetLine.material.color.copy( this.lightPlane.material.color );
 		this.targetLine.material.color.copy( this.lightPlane.material.color );
 
 
-	}
+	};
 
 
 }();
 }();
 
 
-
 // File:src/extras/helpers/EdgesHelper.js
 // File:src/extras/helpers/EdgesHelper.js
 
 
 /**
 /**

+ 5 - 5
build/three.min.js

@@ -512,9 +512,9 @@ Ja=0,Ga=[],Ta={},Ca=[],fb=[],Ra=[];this.domElement=L;this.context=null;this.devi
 !1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var I=this,Na=[],tb=null,ub=null,qb=-1,Xa=null,Tb=null,ec=0,Vb=-1,Kb=-1,ib=-1,Wb=-1,Xb=-1,kc=-1,jb=-1,Db=-1,Kc=null,Lc=null,Mc=null,Jc=null,lc=0,mc=0,kb=L.width,lb=L.height,tc=0,yc=0,rb=new Uint8Array(16),Gb=new Uint8Array(16),Ac=new THREE.Frustum,wc=new THREE.Matrix4,Dc=new THREE.Matrix4,
 !1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var I=this,Na=[],tb=null,ub=null,qb=-1,Xa=null,Tb=null,ec=0,Vb=-1,Kb=-1,ib=-1,Wb=-1,Xb=-1,kc=-1,jb=-1,Db=-1,Kc=null,Lc=null,Mc=null,Jc=null,lc=0,mc=0,kb=L.width,lb=L.height,tc=0,yc=0,rb=new Uint8Array(16),Gb=new Uint8Array(16),Ac=new THREE.Frustum,wc=new THREE.Matrix4,Dc=new THREE.Matrix4,
 Qa=new THREE.Vector3,va=new THREE.Vector3,Ub=!0,Hc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},l,Eb,Lb,hb,Ea,Fa,Fb;(function(){try{var a={alpha:xa,depth:la,stencil:sa,antialias:K,premultipliedAlpha:ha,preserveDrawingBuffer:ra};l=wa||L.getContext("webgl",a)||L.getContext("experimental-webgl",
 Qa=new THREE.Vector3,va=new THREE.Vector3,Ub=!0,Hc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},l,Eb,Lb,hb,Ea,Fa,Fb;(function(){try{var a={alpha:xa,depth:la,stencil:sa,antialias:K,premultipliedAlpha:ha,preserveDrawingBuffer:ra};l=wa||L.getContext("webgl",a)||L.getContext("experimental-webgl",
 a);if(null===l)throw"Error creating WebGL context.";}catch(b){console.error(b)}Eb=l.getExtension("OES_texture_float");l.getExtension("OES_texture_float_linear");Lb=l.getExtension("OES_standard_derivatives");hb=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ea=l.getExtension("WEBGL_compressed_texture_s3tc")||l.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
 a);if(null===l)throw"Error creating WebGL context.";}catch(b){console.error(b)}Eb=l.getExtension("OES_texture_float");l.getExtension("OES_texture_float_linear");Lb=l.getExtension("OES_standard_derivatives");hb=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ea=l.getExtension("WEBGL_compressed_texture_s3tc")||l.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
-Fa=l.getExtension("WEBGL_compressed_texture_pvrtc")||l.getExtension("MOZ_WEBGL_compressed_texture_pvrtc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");Fb=l.getExtension("OES_element_index_uint");null===Eb&&console.log("THREE.WebGLRenderer: Float textures not supported.");null===Lb&&console.log("THREE.WebGLRenderer: Standard derivatives not supported.");null===hb&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");null===Ea&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");
-null===Fa&&console.log("THREE.WebGLRenderer: PVRTC compressed textures not supported.");null===Fb&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});Ia&&l.getExtension("EXT_frag_depth")})();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);
-l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.viewport(lc,mc,kb,lb);l.clearColor(ta.r,ta.g,ta.b,Ja);this.context=l;var Ic=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Tc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Uc=l.getParameter(l.MAX_TEXTURE_SIZE),Sc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Nc=hb?l.getParameter(hb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,gc=0<Tc,fc=gc&&Eb;(Fa||Ea)&&l.getParameter(l.COMPRESSED_TEXTURE_FORMATS);var Vc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,
+Fa=l.getExtension("WEBGL_compressed_texture_pvrtc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");Fb=l.getExtension("OES_element_index_uint");null===Eb&&console.log("THREE.WebGLRenderer: Float textures not supported.");null===Lb&&console.log("THREE.WebGLRenderer: Standard derivatives not supported.");null===hb&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");null===Ea&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");null===Fa&&
+console.log("THREE.WebGLRenderer: PVRTC compressed textures not supported.");null===Fb&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});Ia&&l.getExtension("EXT_frag_depth")})();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);
+l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.viewport(lc,mc,kb,lb);l.clearColor(ta.r,ta.g,ta.b,Ja);this.context=l;var Ic=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Tc=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Uc=l.getParameter(l.MAX_TEXTURE_SIZE),Sc=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Nc=hb?l.getParameter(hb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,gc=0<Tc,fc=gc&&Eb;(Fa||Ea)&&l.getParameter(l.COMPRESSED_TEXTURE_FORMATS);var Vc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,
 l.HIGH_FLOAT),Wc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var Xc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),Yc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var Zc=0<Vc.precision&&0<Xc.precision,Oc=0<Wc.precision&&0<Yc.precision;"highp"!==P||Zc||(Oc?(P="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(P=
 l.HIGH_FLOAT),Wc=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);var Xc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT),Yc=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);var Zc=0<Vc.precision&&0<Xc.precision,Oc=0<Wc.precision&&0<Yc.precision;"highp"!==P||Zc||(Oc?(P="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(P=
 "lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==P||Oc||(P="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));this.getContext=function(){return l};this.supportsVertexTextures=function(){return gc};this.supportsFloatTextures=function(){return Eb};this.supportsStandardDerivatives=function(){return Lb};this.supportsCompressedTextureS3TC=function(){return Ea};this.supportsCompressedTexturePVRTC=function(){return Fa};this.getMaxAnisotropy=
 "lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")));"mediump"!==P||Oc||(P="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));this.getContext=function(){return l};this.supportsVertexTextures=function(){return gc};this.supportsFloatTextures=function(){return Eb};this.supportsStandardDerivatives=function(){return Lb};this.supportsCompressedTextureS3TC=function(){return Ea};this.supportsCompressedTexturePVRTC=function(){return Fa};this.getMaxAnisotropy=
 function(){return Nc};this.getPrecision=function(){return P};this.setSize=function(a,b,c){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;!1!==c&&(L.style.width=a+"px",L.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){lc=a*this.devicePixelRatio;mc=b*this.devicePixelRatio;kb=c*this.devicePixelRatio;lb=d*this.devicePixelRatio;l.viewport(lc,mc,kb,lb)};this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,
 function(){return Nc};this.getPrecision=function(){return P};this.setSize=function(a,b,c){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;!1!==c&&(L.style.width=a+"px",L.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){lc=a*this.devicePixelRatio;mc=b*this.devicePixelRatio;kb=c*this.devicePixelRatio;lb=d*this.devicePixelRatio;l.viewport(lc,mc,kb,lb)};this.setScissor=function(a,b,c,d){l.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,
@@ -587,8 +587,8 @@ THREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegme
 void 0,t=a[f[k]].x,s=a[f[k]].y,p=a[f[m]].x,v=a[f[m]].y,w=a[f[n]].x,u=a[f[n]].y;if(1E-10>(p-t)*(u-s)-(v-s)*(w-t))r=!1;else{var G=void 0,C=void 0,B=void 0,y=void 0,D=void 0,J=void 0,N=void 0,Q=void 0,E=void 0,da=void 0,E=Q=N=x=A=void 0,G=w-p,C=u-v,B=t-w,y=s-u,D=p-t,J=v-s;for(r=0;r<e;r++)if(A=a[f[r]].x,x=a[f[r]].y,!(A===t&&x===s||A===p&&x===v||A===w&&x===u)&&(N=A-t,Q=x-s,E=A-p,da=x-v,A-=w,x-=u,E=G*da-C*E,N=D*Q-J*N,Q=B*x-y*A,-1E-10<=E&&-1E-10<=Q&&-1E-10<=N)){r=!1;break a}r=!0}}if(r){g.push([a[f[k]],a[f[m]],
 void 0,t=a[f[k]].x,s=a[f[k]].y,p=a[f[m]].x,v=a[f[m]].y,w=a[f[n]].x,u=a[f[n]].y;if(1E-10>(p-t)*(u-s)-(v-s)*(w-t))r=!1;else{var G=void 0,C=void 0,B=void 0,y=void 0,D=void 0,J=void 0,N=void 0,Q=void 0,E=void 0,da=void 0,E=Q=N=x=A=void 0,G=w-p,C=u-v,B=t-w,y=s-u,D=p-t,J=v-s;for(r=0;r<e;r++)if(A=a[f[r]].x,x=a[f[r]].y,!(A===t&&x===s||A===p&&x===v||A===w&&x===u)&&(N=A-t,Q=x-s,E=A-p,da=x-v,A-=w,x-=u,E=G*da-C*E,N=D*Q-J*N,Q=B*x-y*A,-1E-10<=E&&-1E-10<=Q&&-1E-10<=N)){r=!1;break a}r=!0}}if(r){g.push([a[f[k]],a[f[m]],
 a[f[n]]]);h.push([f[k],f[m],f[n]]);k=m;for(n=m+1;n<e;k++,n++)f[k]=f[n];e--;q=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;
 a[f[n]]]);h.push([f[k],f[m],f[n]]);k=m;for(n=m+1;n<e;k++,n++)f[k]=f[n];e--;q=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;
 THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain)};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);
 THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain)};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);
-THREE.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a;b.source.connect(b.panner);b.source.start()})};c.send();return this};THREE.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};
-THREE.Audio.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3;return function(b){THREE.Object3D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}}();THREE.AudioListener=function(){THREE.Object3D.call(this);this.type="AudioListener";this.context=new AudioContext};THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype);
+THREE.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a;b.source.connect(b.panner);b.source.start(0)})};c.send();return this};THREE.Audio.prototype.setLoop=function(a){this.source.loop=a};THREE.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};
+THREE.Audio.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3;return function(b){THREE.Object3D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}}();THREE.AudioListener=function(){THREE.Object3D.call(this);this.type="AudioListener";this.context=new (window.AudioContext||window.webkitAudioContext)};THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype);
 THREE.AudioListener.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3;return function(f){THREE.Object3D.prototype.updateMatrixWorld.call(this,f);f=this.context.listener;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.subVectors(a,g);f.setPosition(a.x,a.y,a.z);f.setOrientation(d.x,d.y,d.z,this.up.x,this.up.y,this.up.z);f.setVelocity(e.x,e.y,e.z);g.copy(a)}}();
 THREE.AudioListener.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3;return function(f){THREE.Object3D.prototype.updateMatrixWorld.call(this,f);f=this.context.listener;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.subVectors(a,g);f.setPosition(a.x,a.y,a.z);f.setOrientation(d.x,d.y,d.z,this.up.x,this.up.y,this.up.z);f.setVelocity(e.x,e.y,e.z);g.copy(a)}}();
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(a){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(a){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
 THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,g=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),g+=c.distanceTo(d),b.push(g),d=c;return this.cacheArcLengths=b};
 THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,g=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),g+=c.distanceTo(d),b.push(g),d=c;return this.cacheArcLengths=b};

+ 1 - 1
docs/api/extras/helpers/GridHelper.html

@@ -29,7 +29,7 @@
 		<h3>[name]([page:number size], [page:Number step])</h3>
 		<h3>[name]([page:number size], [page:Number step])</h3>
 		<div>
 		<div>
 		size -- The size of the grid <br />
 		size -- The size of the grid <br />
-		step -- The size of the step btween 2 lines 
+		step -- The size of the step between 2 lines 
 		</div>
 		</div>
 		<div>
 		<div>
 		Creates a new [name] of size 'size' and with steps of size 'step'.
 		Creates a new [name] of size 'size' and with steps of size 'step'.

+ 1 - 6
editor/index.html

@@ -5,7 +5,7 @@
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 	</head>
 	</head>
-	<body>
+	<body ontouchstart="">
 		<link href="css/main.css" rel="stylesheet" />
 		<link href="css/main.css" rel="stylesheet" />
 		<link id="theme" href="css/light.css" rel="stylesheet" />
 		<link id="theme" href="css/light.css" rel="stylesheet" />
 
 
@@ -36,11 +36,6 @@
 		<script src="../examples/js/renderers/SoftwareRenderer.js"></script>
 		<script src="../examples/js/renderers/SoftwareRenderer.js"></script>
 		<script src="../examples/js/renderers/SVGRenderer.js"></script>
 		<script src="../examples/js/renderers/SVGRenderer.js"></script>
 
 
-		<link href="js/libs/codemirror/codemirror.css" rel="stylesheet" />
-		<script src="js/libs/codemirror/codemirror.js"></script>
-		<script src="js/libs/codemirror/modes/javascript.js"></script>
-
-
 		<script src="js/libs/signals.min.js"></script>
 		<script src="js/libs/signals.min.js"></script>
 		<script src="js/libs/ui.js"></script>
 		<script src="js/libs/ui.js"></script>
 		<script src="js/libs/ui.editor.js"></script>
 		<script src="js/libs/ui.editor.js"></script>

+ 1 - 1
editor/js/Menubar.js

@@ -11,4 +11,4 @@ var Menubar = function ( editor ) {
 
 
 	return container;
 	return container;
 
 
-}
+};

+ 1 - 1
editor/js/Sidebar.js

@@ -12,4 +12,4 @@ var Sidebar = function ( editor ) {
 
 
 	return container;
 	return container;
 
 
-}
+};

+ 8 - 3
editor/js/Storage.js

@@ -2,6 +2,11 @@ var Storage = function () {
 
 
 	var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
 	var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
 
 
+	if ( indexedDB === undefined  ) {
+		console.warn( 'Storage: IndexedDB not available.' );
+		return { init: function (){}, get: function (){}, set: function (){}, clear: function (){} };
+	}
+
 	var name = 'threejs-editor';
 	var name = 'threejs-editor';
 	var version = 1;
 	var version = 1;
 
 
@@ -35,7 +40,7 @@ var Storage = function () {
 				console.error( 'IndexedDB', event );
 				console.error( 'IndexedDB', event );
 
 
 			};
 			};
-			
+
 
 
 		},
 		},
 
 
@@ -75,11 +80,11 @@ var Storage = function () {
 			request.onsuccess = function ( event ) {
 			request.onsuccess = function ( event ) {
 
 
 				callback();
 				callback();
-			
+
 			};
 			};
 
 
 		}
 		}
 
 
 	}
 	}
 
 
-};
+};

+ 74 - 31
editor/js/Viewport.js

@@ -34,12 +34,19 @@ var Viewport = function ( editor ) {
 	var transformControls = new THREE.TransformControls( camera, container.dom );
 	var transformControls = new THREE.TransformControls( camera, container.dom );
 	transformControls.addEventListener( 'change', function () {
 	transformControls.addEventListener( 'change', function () {
 
 
-		render();
+		var object = transformControls.object;
 
 
-	} );
-	transformControls.addEventListener( 'objectChange', function () {
+		if ( object !== undefined ) {
 
 
-		signals.objectChanged.dispatch( transformControls.object );
+			if ( editor.helpers[ object.id ] !== undefined ) {
+
+				editor.helpers[ object.id ].update();
+
+			}
+
+		}
+
+		render();
 
 
 	} );
 	} );
 	transformControls.addEventListener( 'mouseDown', function () {
 	transformControls.addEventListener( 'mouseDown', function () {
@@ -49,6 +56,7 @@ var Viewport = function ( editor ) {
 	} );
 	} );
 	transformControls.addEventListener( 'mouseUp', function () {
 	transformControls.addEventListener( 'mouseUp', function () {
 
 
+		signals.objectChanged.dispatch( transformControls.object );
 		controls.enabled = true;
 		controls.enabled = true;
 
 
 	} );
 	} );
@@ -70,12 +78,9 @@ var Viewport = function ( editor ) {
 
 
 	// events
 	// events
 
 
-	var getIntersects = function ( event, object ) {
+	var getIntersects = function ( point, object ) {
 
 
-		var rect = container.dom.getBoundingClientRect();
-		x = ( event.clientX - rect.left ) / rect.width;
-		y = ( event.clientY - rect.top ) / rect.height;
-		var vector = new THREE.Vector3( ( x ) * 2 - 1, - ( y ) * 2 + 1, 0.5 );
+		var vector = new THREE.Vector3( ( point.x * 2 ) - 1, - ( point.y * 2 ) + 1, 0.5 );
 
 
 		projector.unprojectVector( vector, camera );
 		projector.unprojectVector( vector, camera );
 
 
@@ -91,32 +96,22 @@ var Viewport = function ( editor ) {
 
 
 	};
 	};
 
 
-	var onMouseDownPosition = new THREE.Vector2();
-	var onMouseUpPosition = new THREE.Vector2();
+	var onDownPosition = new THREE.Vector2();
+	var onUpPosition = new THREE.Vector2();
+	var onDoubleClickPosition = new THREE.Vector2();
 
 
-	var onMouseDown = function ( event ) {
-
-		event.preventDefault();
+	var getMousePosition = function ( dom, x, y ) {
 
 
-		var rect = container.dom.getBoundingClientRect();
-		x = (event.clientX - rect.left) / rect.width;
-		y = (event.clientY - rect.top) / rect.height;
-		onMouseDownPosition.set( x, y );
-
-		document.addEventListener( 'mouseup', onMouseUp, false );
+		var rect = dom.getBoundingClientRect();
+		return [ ( x - rect.left ) / rect.width, ( y - rect.top ) / rect.height ];
 
 
 	};
 	};
 
 
-	var onMouseUp = function ( event ) {
-
-		var rect = container.dom.getBoundingClientRect();
-		x = (event.clientX - rect.left) / rect.width;
-		y = (event.clientY - rect.top) / rect.height;
-		onMouseUpPosition.set( x, y );
+	var handleClick = function () {
 
 
-		if ( onMouseDownPosition.distanceTo( onMouseUpPosition ) == 0 ) {
+		if ( onDownPosition.distanceTo( onUpPosition ) == 0 ) {
 
 
-			var intersects = getIntersects( event, objects );
+			var intersects = getIntersects( onUpPosition, objects );
 
 
 			if ( intersects.length > 0 ) {
 			if ( intersects.length > 0 ) {
 
 
@@ -144,13 +139,60 @@ var Viewport = function ( editor ) {
 
 
 		}
 		}
 
 
-		document.removeEventListener( 'mouseup', onMouseUp );
+	};
+
+	var onMouseDown = function ( event ) {
+
+		event.preventDefault();
+
+		var array = getMousePosition( container.dom, event.clientX, event.clientY );
+		onDownPosition.fromArray( array );
+
+		document.addEventListener( 'mouseup', onMouseUp, false );
+
+	};
+
+	var onMouseUp = function ( event ) {
+
+		var array = getMousePosition( container.dom, event.clientX, event.clientY );
+		onUpPosition.fromArray( array );
+
+		handleClick();
+
+		document.removeEventListener( 'mouseup', onMouseUp, false );
+
+	};
+
+	var onTouchStart = function ( event ) {
+
+		var touch = event.changedTouches[ 0 ];
+
+		var array = getMousePosition( container.dom, touch.clientX, touch.clientY );
+		onDownPosition.fromArray( array );
+
+		document.addEventListener( 'touchend', onTouchEnd, false );
+
+	};
+
+	var onTouchEnd = function ( event ) {
+
+		var touch = event.changedTouches[ 0 ];
+
+		var array = getMousePosition( container.dom, touch.clientX, touch.clientY );
+		onUpPosition.fromArray( array );
+
+		handleClick();
+
+		document.removeEventListener( 'touchend', onTouchEnd, false );
 
 
 	};
 	};
 
 
 	var onDoubleClick = function ( event ) {
 	var onDoubleClick = function ( event ) {
 
 
-		var intersects = getIntersects( event, objects );
+		var array = getMousePosition( container.dom, event.clientX, event.clientY );
+		onDoubleClickPosition.fromArray( array );
+
+		var intersects = getIntersects( onDoubleClickPosition, objects );
 
 
 		if ( intersects.length > 0 ) {
 		if ( intersects.length > 0 ) {
 
 
@@ -163,6 +205,7 @@ var Viewport = function ( editor ) {
 	};
 	};
 
 
 	container.dom.addEventListener( 'mousedown', onMouseDown, false );
 	container.dom.addEventListener( 'mousedown', onMouseDown, false );
+	container.dom.addEventListener( 'touchstart', onTouchStart, false );
 	container.dom.addEventListener( 'dblclick', onDoubleClick, false );
 	container.dom.addEventListener( 'dblclick', onDoubleClick, false );
 
 
 	// controls need to be added *after* main logic,
 	// controls need to be added *after* main logic,
@@ -193,7 +236,7 @@ var Viewport = function ( editor ) {
 				break;
 				break;
 
 
 		}
 		}
-		
+
 		renderer.setClearColor( clearColor );
 		renderer.setClearColor( clearColor );
 
 
 		render();
 		render();

+ 0 - 1
examples/css3d_panorama_deviceorientation.html

@@ -49,7 +49,6 @@
 				camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 1000 );
 
 
 				controls = new THREE.DeviceOrientationControls( camera );
 				controls = new THREE.DeviceOrientationControls( camera );
-				controls.connect();
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
 
 

+ 1 - 0
examples/index.html

@@ -178,6 +178,7 @@
 				"webgl_loader_collada",
 				"webgl_loader_collada",
 				"webgl_loader_collada_keyframe",
 				"webgl_loader_collada_keyframe",
 				"webgl_loader_collada_skinning",
 				"webgl_loader_collada_skinning",
+				"webgl_loader_collada_kinematics",
 				"webgl_loader_ctm",
 				"webgl_loader_ctm",
 				"webgl_loader_ctm_materials",
 				"webgl_loader_ctm_materials",
 				"webgl_loader_gltf",
 				"webgl_loader_gltf",

+ 2 - 0
examples/js/controls/DeviceOrientationControls.js

@@ -90,4 +90,6 @@ THREE.DeviceOrientationControls = function ( object ) {
 
 
 	};
 	};
 
 
+	this.connect();
+
 };
 };

+ 11 - 12
examples/js/controls/TransformControls.js

@@ -125,7 +125,7 @@
 				for ( var name in gizmoMap ) {
 				for ( var name in gizmoMap ) {
 
 
 					for ( i = gizmoMap[name].length; i--;) {
 					for ( i = gizmoMap[name].length; i--;) {
-						
+
 						var object = gizmoMap[name][i][0];
 						var object = gizmoMap[name][i][0];
 						var position = gizmoMap[name][i][1];
 						var position = gizmoMap[name][i][1];
 						var rotation = gizmoMap[name][i][2];
 						var rotation = gizmoMap[name][i][2];
@@ -134,7 +134,7 @@
 
 
 						if ( position ) object.position.set( position[0], position[1], position[2] );
 						if ( position ) object.position.set( position[0], position[1], position[2] );
 						if ( rotation ) object.rotation.set( rotation[0], rotation[1], rotation[2] );
 						if ( rotation ) object.rotation.set( rotation[0], rotation[1], rotation[2] );
-						
+
 						parent.add( object );
 						parent.add( object );
 
 
 					}
 					}
@@ -221,7 +221,7 @@
 		mesh.updateMatrix();
 		mesh.updateMatrix();
 
 
 		arrowGeometry.merge( mesh.geometry, mesh.matrix );
 		arrowGeometry.merge( mesh.geometry, mesh.matrix );
-		
+
 		var lineXGeometry = new THREE.Geometry();
 		var lineXGeometry = new THREE.Geometry();
 		lineXGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ) );
 		lineXGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0 ) );
 
 
@@ -562,7 +562,7 @@
 		this.axis = null;
 		this.axis = null;
 
 
 		var scope = this;
 		var scope = this;
-		
+
 		var _dragging = false;
 		var _dragging = false;
 		var _mode = "translate";
 		var _mode = "translate";
 		var _plane = "XY";
 		var _plane = "XY";
@@ -570,7 +570,6 @@
 		var changeEvent = { type: "change" };
 		var changeEvent = { type: "change" };
 		var mouseDownEvent = { type: "mouseDown" };
 		var mouseDownEvent = { type: "mouseDown" };
 		var mouseUpEvent = { type: "mouseUp", mode: _mode };
 		var mouseUpEvent = { type: "mouseUp", mode: _mode };
-		var objectChangeEvent = { type: "objectChange" };
 
 
 		var ray = new THREE.Raycaster();
 		var ray = new THREE.Raycaster();
 		var projector = new THREE.Projector();
 		var projector = new THREE.Projector();
@@ -643,7 +642,7 @@
 		this.detach = function ( object ) {
 		this.detach = function ( object ) {
 
 
 			scope.object = undefined;
 			scope.object = undefined;
-			this.axis = undefined;
+			this.axis = null;
 
 
 			this.gizmo["translate"].hide();
 			this.gizmo["translate"].hide();
 			this.gizmo["rotate"].hide();
 			this.gizmo["rotate"].hide();
@@ -659,7 +658,7 @@
 
 
 			this.gizmo["translate"].hide();
 			this.gizmo["translate"].hide();
 			this.gizmo["rotate"].hide();
 			this.gizmo["rotate"].hide();
-			this.gizmo["scale"].hide();	
+			this.gizmo["scale"].hide();
 			this.gizmo[_mode].show();
 			this.gizmo[_mode].show();
 
 
 			this.update();
 			this.update();
@@ -678,7 +677,7 @@
 			scope.size = size;
 			scope.size = size;
 			this.update();
 			this.update();
 			scope.dispatchEvent( changeEvent );
 			scope.dispatchEvent( changeEvent );
-			
+
 		};
 		};
 
 
 		this.setSpace = function ( space ) {
 		this.setSpace = function ( space ) {
@@ -836,13 +835,13 @@
 					scope.object.position.add( point );
 					scope.object.position.add( point );
 
 
 				}
 				}
-				
+
 				if ( scope.snap !== null ) {
 				if ( scope.snap !== null ) {
-				
+
 					if ( scope.axis.search("X") != -1 ) scope.object.position.x = Math.round( scope.object.position.x / scope.snap ) * scope.snap;
 					if ( scope.axis.search("X") != -1 ) scope.object.position.x = Math.round( scope.object.position.x / scope.snap ) * scope.snap;
 					if ( scope.axis.search("Y") != -1 ) scope.object.position.y = Math.round( scope.object.position.y / scope.snap ) * scope.snap;
 					if ( scope.axis.search("Y") != -1 ) scope.object.position.y = Math.round( scope.object.position.y / scope.snap ) * scope.snap;
 					if ( scope.axis.search("Z") != -1 ) scope.object.position.z = Math.round( scope.object.position.z / scope.snap ) * scope.snap;
 					if ( scope.axis.search("Z") != -1 ) scope.object.position.z = Math.round( scope.object.position.z / scope.snap ) * scope.snap;
-				
+
 				}
 				}
 
 
 			} else if ( _mode == "scale" ) {
 			} else if ( _mode == "scale" ) {
@@ -955,7 +954,7 @@
 			}
 			}
 
 
 			scope.update();
 			scope.update();
-			scope.dispatchEvent( objectChangeEvent );
+			scope.dispatchEvent( changeEvent );
 
 
 		}
 		}
 
 

+ 7 - 3
examples/js/effects/VREffect.js

@@ -95,8 +95,8 @@ THREE.VREffect = function ( renderer, done ) {
 			camera.updateMatrixWorld();
 			camera.updateMatrixWorld();
 		}
 		}
 
 
-		cameraLeft.projectionMatrix = this.FovToProjection( this.leftEyeFOV );
-		cameraRight.projectionMatrix = this.FovToProjection( this.rightEyeFOV );
+		cameraLeft.projectionMatrix = this.FovToProjection( this.leftEyeFOV, true, camera.near, camera.far );
+		cameraRight.projectionMatrix = this.FovToProjection( this.rightEyeFOV, true, camera.near, camera.far );
 
 
 		camera.matrixWorld.decompose( cameraLeft.position, cameraLeft.quaternion, cameraLeft.scale );
 		camera.matrixWorld.decompose( cameraLeft.position, cameraLeft.quaternion, cameraLeft.scale );
 		camera.matrixWorld.decompose( cameraRight.position, cameraRight.quaternion, cameraRight.scale );
 		camera.matrixWorld.decompose( cameraRight.position, cameraRight.quaternion, cameraRight.scale );
@@ -116,6 +116,10 @@ THREE.VREffect = function ( renderer, done ) {
 
 
 	};
 	};
 
 
+	this.setSize = function( width, height ) {
+		renderer.setSize( width, height );
+	};
+
 	this.setFullScreen = function( enable ) {
 	this.setFullScreen = function( enable ) {
 		var renderer = this._renderer;
 		var renderer = this._renderer;
 		var vrHMD = this._vrHMD;
 		var vrHMD = this._vrHMD;
@@ -231,4 +235,4 @@ THREE.VREffect = function ( renderer, done ) {
 		return this.FovPortToProjection(fovPort, rightHanded, zNear, zFar);
 		return this.FovPortToProjection(fovPort, rightHanded, zNear, zFar);
 	};
 	};
 
 
-};
+};

+ 470 - 12
examples/js/loaders/ColladaLoader.js

@@ -7,7 +7,8 @@ THREE.ColladaLoader = function () {
 
 
 	var COLLADA = null;
 	var COLLADA = null;
 	var scene = null;
 	var scene = null;
-	var daeScene;
+	var visualScene;
+	var kinematicsModel;
 
 
 	var readyCallbackFunc = null;
 	var readyCallbackFunc = null;
 
 
@@ -22,7 +23,9 @@ THREE.ColladaLoader = function () {
 	var lights = {};
 	var lights = {};
 
 
 	var animData;
 	var animData;
+	var kinematics;
 	var visualScenes;
 	var visualScenes;
+	var kinematicsModel;
 	var baseUrl;
 	var baseUrl;
 	var morphs;
 	var morphs;
 	var skins;
 	var skins;
@@ -141,16 +144,17 @@ THREE.ColladaLoader = function () {
 		controllers = parseLib( "library_controllers controller", Controller, "controller" );
 		controllers = parseLib( "library_controllers controller", Controller, "controller" );
 		animations = parseLib( "library_animations animation", Animation, "animation" );
 		animations = parseLib( "library_animations animation", Animation, "animation" );
 		visualScenes = parseLib( "library_visual_scenes visual_scene", VisualScene, "visual_scene" );
 		visualScenes = parseLib( "library_visual_scenes visual_scene", VisualScene, "visual_scene" );
+		kinematicsModels = parseLib( "library_kinematics_models kinematics_model", KinematicsModel, "kinematics_model" );
 
 
 		morphs = [];
 		morphs = [];
 		skins = [];
 		skins = [];
 
 
-		daeScene = parseScene();
+		visualScene = parseScene();
 		scene = new THREE.Scene();
 		scene = new THREE.Scene();
 
 
-		for ( var i = 0; i < daeScene.nodes.length; i ++ ) {
+		for ( var i = 0; i < visualScene.nodes.length; i ++ ) {
 
 
-			scene.add( createSceneGraph( daeScene.nodes[ i ] ) );
+			scene.add( createSceneGraph( visualScene.nodes[ i ] ) );
 
 
 		}
 		}
 
 
@@ -159,12 +163,16 @@ THREE.ColladaLoader = function () {
 
 
 		createAnimations();
 		createAnimations();
 
 
+		kinematicsModel = parseKinematicsModel();
+		createKinematics();
+
 		var result = {
 		var result = {
 
 
 			scene: scene,
 			scene: scene,
 			morphs: morphs,
 			morphs: morphs,
 			skins: skins,
 			skins: skins,
 			animations: animData,
 			animations: animData,
+			kinematics: kinematics,
 			dae: {
 			dae: {
 				images: images,
 				images: images,
 				materials: materials,
 				materials: materials,
@@ -175,7 +183,10 @@ THREE.ColladaLoader = function () {
 				controllers: controllers,
 				controllers: controllers,
 				animations: animations,
 				animations: animations,
 				visualScenes: visualScenes,
 				visualScenes: visualScenes,
-				scene: daeScene
+				visualScene: visualScene,
+				scene: visualScene,
+				kinematicsModels: kinematicsModels,
+				kinematicsModel: kinematicsModel
 			}
 			}
 
 
 		};
 		};
@@ -276,6 +287,23 @@ THREE.ColladaLoader = function () {
 
 
 	}
 	}
 
 
+	function parseKinematicsModel() {
+
+		var kinematicsModelElement = COLLADA.querySelectorAll('instance_kinematics_model')[0];
+
+		if ( kinematicsModelElement ) {
+
+			var url = kinematicsModelElement.getAttribute( 'url' ).replace(/^#/, '');
+			return kinematicsModels[ url.length > 0 ? url : 'kinematics_model0' ];
+
+		} else {
+
+			return null;
+
+		}
+
+	}
+
 	function createAnimations() {
 	function createAnimations() {
 
 
 		animData = [];
 		animData = [];
@@ -287,7 +315,7 @@ THREE.ColladaLoader = function () {
 
 
 	function recurseHierarchy( node ) {
 	function recurseHierarchy( node ) {
 
 
-		var n = daeScene.getChildById( node.id, true ),
+		var n = visualScene.getChildById( node.id, true ),
 			newData = null;
 			newData = null;
 
 
 		if ( n && n.keys ) {
 		if ( n && n.keys ) {
@@ -312,7 +340,7 @@ THREE.ColladaLoader = function () {
 
 
 			}
 			}
 
 
-		} else  {
+		} else {
 
 
 			newData = {
 			newData = {
 				hierarchy: [ {
 				hierarchy: [ {
@@ -427,7 +455,7 @@ THREE.ColladaLoader = function () {
 		}
 		}
 
 
 		var skin = skinCtrl.skin;
 		var skin = skinCtrl.skin;
-		var skeleton = daeScene.getChildById( ctrl.skeleton[ 0 ] );
+		var skeleton = visualScene.getChildById( ctrl.skeleton[ 0 ] );
 		var hierarchy = [];
 		var hierarchy = [];
 
 
 		applyBindShape = applyBindShape !== undefined ? applyBindShape : true;
 		applyBindShape = applyBindShape !== undefined ? applyBindShape : true;
@@ -663,8 +691,8 @@ THREE.ColladaLoader = function () {
 		}
 		}
 
 
 		var animationBounds = calcAnimationBounds();
 		var animationBounds = calcAnimationBounds();
-		var skeleton = daeScene.getChildById( instanceCtrl.skeleton[0], true ) ||
-					   daeScene.getChildBySid( instanceCtrl.skeleton[0], true );
+		var skeleton = visualScene.getChildById( instanceCtrl.skeleton[0], true ) ||
+					   visualScene.getChildBySid( instanceCtrl.skeleton[0], true );
 
 
 		//flatten the skeleton into a list of bones
 		//flatten the skeleton into a list of bones
 		var bonelist = flattenSkeleton(skeleton);
 		var bonelist = flattenSkeleton(skeleton);
@@ -793,6 +821,211 @@ THREE.ColladaLoader = function () {
 
 
 	};
 	};
 
 
+	function createKinematics() {
+
+		if ( kinematicsModel && kinematicsModel.joints.length === 0 ) {
+			kinematics = undefined;
+			return;
+		}
+
+		var jointMap = {};
+
+		var _addToMap = function( jointIndex, parentVisualElement ) {
+
+			var parentVisualElementId = parentVisualElement.getAttribute( 'id' );
+			var colladaNode = visualScene.getChildById( parentVisualElementId, true );
+			var joint = kinematicsModel.joints[ jointIndex ];
+
+			scene.traverse(function( node ) {
+
+				if ( node.id == parentVisualElementId ) {
+
+					jointMap[ jointIndex ] = {
+						node: node,
+						transforms: colladaNode.transforms,
+						joint: joint,
+						position: joint.zeroPosition
+					};
+
+				}
+
+			});
+
+		};
+
+		kinematics = {
+
+			joints: kinematicsModel && kinematicsModel.joints,
+
+			getJointValue: function( jointIndex ) {
+
+				var jointData = jointMap[ jointIndex ];
+
+				if ( jointData ) {
+
+					return jointData.position;
+
+				} else {
+
+					console.log( 'getJointValue: joint ' + jointIndex + ' doesn\'t exist' );
+
+				}
+
+			},
+
+			setJointValue: function( jointIndex, value ) {
+
+				var jointData = jointMap[ jointIndex ];
+
+				if ( jointData ) {
+
+					var joint = jointData.joint;
+
+					if ( value > joint.limits.max || value < joint.limits.min ) {
+
+						console.log( 'setJointValue: joint ' + jointIndex + ' value ' + value + ' outside of limits (min: ' + joint.limits.min + ', max: ' + joint.limits.max + ')' );
+
+					} else if ( joint.static ) {
+
+						console.log( 'setJointValue: joint ' + jointIndex + ' is static' );
+
+					} else {
+
+						var threejsNode = jointData.node;
+						var axis = joint.axis;
+						var transforms = jointData.transforms;
+
+						var matrix = new THREE.Matrix4();
+
+						for (i = 0; i < transforms.length; i++ ) {
+
+							var transform = transforms[ i ];
+
+							// kinda ghetto joint detection
+							if ( transform.sid && transform.sid.indexOf( 'joint' + jointIndex ) !== -1 ) {
+
+								// apply actual joint value here
+								switch ( joint.type ) {
+
+									case 'revolute':
+
+										matrix.multiply( m1.makeRotationAxis( axis, THREE.Math.degToRad(value) ) );
+										break;
+
+									case 'prismatic':
+
+										matrix.multiply( m1.makeTranslation(axis.x * value, axis.y * value, axis.z * value ) );
+										break;
+
+									default:
+
+										console.warn( 'setJointValue: unknown joint type: ' + joint.type );
+										break;
+
+								}
+
+							} else {
+
+								var m1 = new THREE.Matrix4();
+
+								switch ( transform.type ) {
+
+									case 'matrix':
+
+										matrix.multiply( transform.obj );
+
+										break;
+
+									case 'translate':
+
+										matrix.multiply( m1.makeTranslation( transform.obj.x, transform.obj.y, transform.obj.z ) );
+
+										break;
+
+									case 'rotate':
+
+										matrix.multiply( m1.makeRotationAxis( transform.obj, transform.angle ) );
+
+										break;
+
+								}
+							}
+						}
+
+						// apply the matrix to the threejs node
+						var elementsFloat32Arr = matrix.elements;
+						var elements = Array.prototype.slice.call( elementsFloat32Arr );
+
+						var elementsRowMajor = [
+							elements[ 0 ],
+							elements[ 4 ],
+							elements[ 8 ],
+							elements[ 12 ],
+							elements[ 1 ],
+							elements[ 5 ],
+							elements[ 9 ],
+							elements[ 13 ],
+							elements[ 2 ],
+							elements[ 6 ],
+							elements[ 10 ],
+							elements[ 14 ],
+							elements[ 3 ],
+							elements[ 7 ],
+							elements[ 11 ],
+							elements[ 15 ]
+						];
+
+						threejsNode.matrix.set.apply( threejsNode.matrix, elementsRowMajor );
+						threejsNode.matrix.decompose( threejsNode.position, threejsNode.quaternion, threejsNode.scale );
+					}
+
+				} else {
+
+					console.log( 'setJointValue: joint ' + jointIndex + ' doesn\'t exist' );
+
+				}
+
+			}
+
+		};
+
+		var element = COLLADA.querySelector('scene instance_kinematics_scene');
+
+		if ( element ) {
+
+			for ( var i = 0; i < element.childNodes.length; i ++ ) {
+
+				var child = element.childNodes[ i ];
+
+				if ( child.nodeType != 1 ) continue;
+
+				switch ( child.nodeName ) {
+
+					case 'bind_joint_axis':
+
+						var visualTarget = child.getAttribute( 'target' ).split( '/' ).pop();
+						var axis = child.querySelector('axis param').textContent;
+						var jointIndex = parseInt( axis.split( 'joint' ).pop().split( '.' )[0] );
+						var visualTargetElement = COLLADA.querySelector( '[sid="' + visualTarget + '"]' );
+
+						if ( visualTargetElement ) {
+							var parentVisualElement = visualTargetElement.parentElement;
+							_addToMap(jointIndex, parentVisualElement);
+						}
+
+						break;
+
+					default:
+
+						break;
+
+				}
+
+			}
+		}
+
+	};
+
 	function createSceneGraph ( node, parent ) {
 	function createSceneGraph ( node, parent ) {
 
 
 		var obj = new THREE.Object3D();
 		var obj = new THREE.Object3D();
@@ -953,7 +1186,7 @@ THREE.ColladaLoader = function () {
 
 
 					applySkin( geom, skinController );
 					applySkin( geom, skinController );
 
 
-					if(geom.morphTargets.length > 0) {
+					if ( geom.morphTargets.length > 0 ) {
 
 
 						material.morphTargets = true;
 						material.morphTargets = true;
 						material.skinning = false;
 						material.skinning = false;
@@ -3452,7 +3685,7 @@ THREE.ColladaLoader = function () {
 										} );
 										} );
 
 
 									}
 									}
-									
+
 									texture.wrapS = cot.texOpts.wrapU ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
 									texture.wrapS = cot.texOpts.wrapU ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
 									texture.wrapT = cot.texOpts.wrapV ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
 									texture.wrapT = cot.texOpts.wrapV ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
 									texture.offset.x = cot.texOpts.offsetU;
 									texture.offset.x = cot.texOpts.offsetU;
@@ -4539,6 +4772,231 @@ THREE.ColladaLoader = function () {
 
 
 	};
 	};
 
 
+	function KinematicsModel( ) {
+
+		this.id = '';
+		this.name = '';
+		this.joints = [];
+		this.links = [];
+
+	}
+
+	KinematicsModel.prototype.parse = function( element ) {
+
+		this.id = element.getAttribute('id');
+		this.name = element.getAttribute('name');
+		this.joints = [];
+		this.links = [];
+
+		for (var i = 0; i < element.childNodes.length; i++ ) {
+
+			var child = element.childNodes[ i ];
+			if ( child.nodeType != 1 ) continue;
+
+			switch ( child.nodeName ) {
+
+				case 'technique_common':
+
+					this.parseCommon(child);
+					break;
+
+				default:
+					break;
+
+			}
+
+		}
+
+		return this;
+
+	};
+
+	KinematicsModel.prototype.parseCommon = function( element ) {
+
+		for (var i = 0; i < element.childNodes.length; i++ ) {
+
+			var child = element.childNodes[ i ];
+			if ( child.nodeType != 1 ) continue;
+
+			switch ( element.childNodes[ i ].nodeName ) {
+
+				case 'joint':
+					this.joints.push( (new Joint()).parse(child) );
+					break;
+
+				case 'link':
+					this.links.push( (new Link()).parse(child) );
+					break;
+
+				default:
+					break;
+
+			}
+
+		}
+
+		return this;
+
+	};
+
+	function Joint( ) {
+
+		this.sid = '';
+		this.name = '';
+		this.axis = new THREE.Vector3();
+		this.limits = {
+			min: 0,
+			max: 0
+		};
+		this.type = '';
+		this.static = false;
+		this.zeroPosition = 0.0;
+		this.middlePosition = 0.0;
+
+	}
+
+	Joint.prototype.parse = function( element ) {
+
+		this.sid = element.getAttribute('sid');
+		this.name = element.getAttribute('name');
+		this.axis = new THREE.Vector3();
+		this.limits = {
+			min: 0,
+			max: 0
+		};
+		this.type = '';
+		this.static = false;
+		this.zeroPosition = 0.0;
+		this.middlePosition = 0.0;
+
+		var axisElement = element.querySelector('axis');
+		var _axis = _floats(axisElement.textContent);
+		this.axis = getConvertedVec3(_axis, 0);
+
+		var min = element.querySelector('limits min') ? parseFloat(element.querySelector('limits min').textContent) : -360;
+		var max = element.querySelector('limits max') ? parseFloat(element.querySelector('limits max').textContent) : 360;
+
+		this.limits = {
+			min: min,
+			max: max
+		};
+
+		var jointTypes = ['prismatic', 'revolute'];
+		for (var i = 0; i < jointTypes.length; i++ ) {
+
+			var type = jointTypes[ i ];
+
+			var jointElement = element.querySelector(type);
+
+			if ( jointElement ) {
+
+				this.type = type;
+
+			}
+
+		}
+
+		// if the min is equal to or somehow greater than the max, consider the joint static
+		if ( this.limits.min >= this.limits.max ) {
+
+			this.static = true;
+
+		}
+
+		this.middlePosition = (this.limits.min + this.limits.max) / 2.0;
+		return this;
+
+	};
+
+	function Link( ) {
+
+		this.sid = '';
+		this.name = '';
+		this.transforms = [];
+		this.attachments = [];
+
+	}
+
+	Link.prototype.parse = function( element ) {
+
+		this.sid = element.getAttribute('sid');
+		this.name = element.getAttribute('name');
+		this.transforms = [];
+		this.attachments = [];
+
+		for (var i = 0; i < element.childNodes.length; i++ ) {
+
+			var child = element.childNodes[ i ];
+			if ( child.nodeType != 1 ) continue;
+
+			switch ( child.nodeName ) {
+
+				case 'attachment_full':
+					this.attachments.push( (new Attachment()).parse(child) );
+					break;
+
+				case 'rotate':
+				case 'translate':
+				case 'matrix':
+
+					this.transforms.push( (new Transform()).parse(child) );
+					break;
+
+				default:
+
+					break;
+
+			}
+
+		}
+
+		return this;
+
+	};
+
+	function Attachment( ) {
+
+		this.joint = '';
+		this.transforms = [];
+		this.links = [];
+
+	}
+
+	Attachment.prototype.parse = function( element ) {
+
+		this.joint = element.getAttribute('joint').split('/').pop();
+		this.links = [];
+
+		for (var i = 0; i < element.childNodes.length; i++ ) {
+
+			var child = element.childNodes[ i ];
+			if ( child.nodeType != 1 ) continue;
+
+			switch ( child.nodeName ) {
+
+				case 'link':
+					this.links.push( (new Link()).parse(child) );
+					break;
+
+				case 'rotate':
+				case 'translate':
+				case 'matrix':
+
+					this.transforms.push( (new Transform()).parse(child) );
+					break;
+
+				default:
+
+					break;
+
+			}
+
+		}
+
+		return this;
+
+	};
+
 	function _source( element ) {
 	function _source( element ) {
 
 
 		var id = element.getAttribute( 'id' );
 		var id = element.getAttribute( 'id' );

+ 1 - 3
examples/misc_controls_deviceorientation.html

@@ -93,8 +93,6 @@
 
 
 						}, false);
 						}, false);
 
 
-						controls.connect();
-
 						animate();
 						animate();
 
 
 				  }, false);
 				  }, false);
@@ -103,4 +101,4 @@
 		</script>
 		</script>
 
 
 	</body>
 	</body>
-</html>
+</html>

+ 1 - 2
examples/misc_controls_transform.html

@@ -68,7 +68,6 @@
 
 
 				control = new THREE.TransformControls( camera, renderer.domElement );
 				control = new THREE.TransformControls( camera, renderer.domElement );
 				control.addEventListener( 'change', render );
 				control.addEventListener( 'change', render );
-				control.addEventListener( 'objectChange', render );
 
 
 				var mesh = new THREE.Mesh( geometry, material );
 				var mesh = new THREE.Mesh( geometry, material );
 				scene.add( mesh );
 				scene.add( mesh );
@@ -101,7 +100,7 @@
 					case 10: // -,_,num-
 					case 10: // -,_,num-
 						control.setSize( Math.max(control.size - 0.1, 0.1 ) );
 						control.setSize( Math.max(control.size - 0.1, 0.1 ) );
 						break;
 						break;
-		            }            
+		            }
         		});
         		});
 
 
 			}
 			}

File diff suppressed because it is too large
+ 24 - 0
examples/models/collada/kawada-hironx.dae


+ 1 - 1
examples/webgl_effects_vr.html

@@ -144,7 +144,7 @@
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
 				camera.updateProjectionMatrix();
 
 
-				renderer.setSize( window.innerWidth, window.innerHeight );
+				vrEffect.setSize( window.innerWidth, window.innerHeight );
 
 
 			}
 			}
 
 

+ 217 - 0
examples/webgl_loader_collada_kinematics.html

@@ -0,0 +1,217 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>three.js webgl - collada</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 {
+				font-family: Monospace;
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+			}
+
+			#info {
+				color: #fff;
+				position: absolute;
+				top: 10px;
+				width: 100%;
+				text-align: center;
+				z-index: 100;
+				display:block;
+
+			}
+
+			a { color: skyblue }
+		</style>
+	</head>
+	<body>
+		<div id="info">
+			<a href="http://threejs.org" target="_blank">three.js</a> -
+			robot from <a href="https://github.com/rdiankov/collada_robots" target="_blank">collada robots</a>
+		</div>
+
+		<script src="../build/three.min.js"></script>
+
+		<script src="js/loaders/ColladaLoader.js"></script>
+
+		<script src="js/Detector.js"></script>
+		<script src="js/libs/stats.min.js"></script>
+
+		<script>
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var container, stats;
+
+			var camera, scene, renderer, objects;
+			var particleLight;
+			var dae;
+
+			var kinematics;
+			var jointIndex;
+			var joint;
+			var jointValue;
+			var jointStep;
+
+			var loader = new THREE.ColladaLoader();
+			loader.options.convertUpAxis = true;
+			loader.load( './models/collada/kawada-hironx.dae', function ( collada ) {
+
+				dae = collada.scene;
+
+				dae.scale.x = dae.scale.y = dae.scale.z = 10.0;
+				dae.updateMatrix();
+
+				kinematics = collada.kinematics;
+				jointIndex = 0;
+				joint = kinematics.joints[jointIndex];
+				jointValue = joint.limits.min;
+				jointStep = ( joint.limits.max - joint.limits.min ) / 100.0;
+
+				init();
+				animate();
+
+			} );
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
+				camera.position.set( 2, 2, 3 );
+
+				scene = new THREE.Scene();
+
+				// Grid
+
+				var size = 14, step = 1;
+
+				var geometry = new THREE.Geometry();
+				var material = new THREE.LineBasicMaterial( { color: 0x303030 } );
+
+				for ( var i = - size; i <= size; i += step ) {
+
+					geometry.vertices.push( new THREE.Vector3( - size, - 0.04, i ) );
+					geometry.vertices.push( new THREE.Vector3(   size, - 0.04, i ) );
+
+					geometry.vertices.push( new THREE.Vector3( i, - 0.04, - size ) );
+					geometry.vertices.push( new THREE.Vector3( i, - 0.04,   size ) );
+
+				}
+
+				var line = new THREE.Line( geometry, material, THREE.LinePieces );
+				scene.add( line );
+
+				// Add the COLLADA
+
+				scene.add( dae );
+
+				particleLight = new THREE.Mesh( new THREE.SphereGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) );
+				scene.add( particleLight );
+
+				// Lights
+
+				scene.add( new THREE.AmbientLight( 0xcccccc ) );
+
+				var directionalLight = new THREE.DirectionalLight(/*Math.random() * 0xffffff*/0xeeeeee );
+				directionalLight.position.x = Math.random() - 0.5;
+				directionalLight.position.y = Math.random() - 0.5;
+				directionalLight.position.z = Math.random() - 0.5;
+				directionalLight.position.normalize();
+				scene.add( directionalLight );
+
+				var pointLight = new THREE.PointLight( 0xffffff, 1 );
+				particleLight.add( pointLight );
+
+				renderer = new THREE.WebGLRenderer();
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+				container.appendChild( renderer.domElement );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild( stats.domElement );
+
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function moveJoints() {
+
+				if ( jointValue >= joint.limits.max || joint.static ) {
+
+					if ( !joint.static ) {
+						kinematics.setJointValue( jointIndex, joint.zeroPosition );
+					}
+
+					jointIndex++;
+
+					// go back to the beginning if we're past the number of joints
+					if ( jointIndex >= kinematics.joints.length ) {
+
+						jointIndex = 0;
+
+					} else {
+
+						joint = kinematics.joints[ jointIndex ];
+						jointValue = joint.limits.min;
+						jointStep = ( joint.limits.max - joint.limits.min ) / 100.0;
+
+					}
+
+				}
+
+				jointValue += jointStep;
+				kinematics.setJointValue( jointIndex, jointValue );
+
+			};
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+			}
+
+			//
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+				stats.update();
+
+			}
+
+			function render() {
+
+				var timer = Date.now() * 0.0001;
+
+				camera.position.x = Math.cos( timer ) * 17;
+				camera.position.y = 10;
+				camera.position.z = Math.sin( timer ) * 17;
+
+				camera.lookAt( scene.position );
+
+				particleLight.position.x = Math.sin( timer * 4 ) * 3009;
+				particleLight.position.y = Math.cos( timer * 5 ) * 4000;
+				particleLight.position.z = Math.cos( timer * 4 ) * 3009;
+
+				moveJoints();
+
+				renderer.render( scene, camera );
+
+			}
+
+		</script>
+	</body>
+</html>

+ 1 - 1
src/Three.js

@@ -21,7 +21,7 @@ if ( Math.sign === undefined ) {
 		return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : 0;
 		return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : 0;
 
 
 	};
 	};
-	
+
 }
 }
 
 
 // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button
 // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button

+ 8 - 2
src/extras/audio/Audio.js

@@ -34,7 +34,7 @@ THREE.Audio.prototype.load = function ( file ) {
 
 
 			scope.source.buffer = buffer;
 			scope.source.buffer = buffer;
 			scope.source.connect( scope.panner );
 			scope.source.connect( scope.panner );
-			scope.source.start();
+			scope.source.start( 0 );
 
 
 		} );
 		} );
 
 
@@ -45,6 +45,12 @@ THREE.Audio.prototype.load = function ( file ) {
 
 
 };
 };
 
 
+THREE.Audio.prototype.setLoop = function ( value ) {
+
+	this.source.loop = value;
+
+};
+
 THREE.Audio.prototype.setRefDistance = function ( value ) {
 THREE.Audio.prototype.setRefDistance = function ( value ) {
 
 
 	this.panner.refDistance = value;
 	this.panner.refDistance = value;
@@ -58,7 +64,7 @@ THREE.Audio.prototype.setRolloffFactor = function ( value ) {
 };
 };
 
 
 THREE.Audio.prototype.updateMatrixWorld = ( function () {
 THREE.Audio.prototype.updateMatrixWorld = ( function () {
-	
+
 	var position = new THREE.Vector3();
 	var position = new THREE.Vector3();
 
 
 	return function ( force ) {
 	return function ( force ) {

+ 2 - 2
src/extras/audio/AudioListener.js

@@ -8,7 +8,7 @@ THREE.AudioListener = function () {
 
 
 	this.type = 'AudioListener';
 	this.type = 'AudioListener';
 
 
-	this.context = new AudioContext();
+	this.context = new ( window.AudioContext || window.webkitAudioContext )();
 
 
 };
 };
 
 
@@ -26,7 +26,7 @@ THREE.AudioListener.prototype.updateMatrixWorld = ( function () {
 	var positionPrev = new THREE.Vector3();
 	var positionPrev = new THREE.Vector3();
 
 
 	return function ( force ) {
 	return function ( force ) {
-	
+
 		THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
 		THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
 
 
 		var listener = this.context.listener;
 		var listener = this.context.listener;

+ 2 - 3
src/extras/helpers/DirectionalLightHelper.js

@@ -50,7 +50,7 @@ THREE.DirectionalLightHelper = function ( light, size ) {
 THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype );
 THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype );
 
 
 THREE.DirectionalLightHelper.prototype.dispose = function () {
 THREE.DirectionalLightHelper.prototype.dispose = function () {
-	
+
 	this.lightPlane.geometry.dispose();
 	this.lightPlane.geometry.dispose();
 	this.lightPlane.material.dispose();
 	this.lightPlane.material.dispose();
 	this.targetLine.geometry.dispose();
 	this.targetLine.geometry.dispose();
@@ -76,7 +76,6 @@ THREE.DirectionalLightHelper.prototype.update = function () {
 		this.targetLine.geometry.verticesNeedUpdate = true;
 		this.targetLine.geometry.verticesNeedUpdate = true;
 		this.targetLine.material.color.copy( this.lightPlane.material.color );
 		this.targetLine.material.color.copy( this.lightPlane.material.color );
 
 
-	}
+	};
 
 
 }();
 }();
-

+ 42 - 42
src/renderers/WebGLRenderer.js

@@ -26,12 +26,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	_clearColor = new THREE.Color( 0x000000 ),
 	_clearColor = new THREE.Color( 0x000000 ),
 	_clearAlpha = 0;
 	_clearAlpha = 0;
-	
+
 	var lights = [];
 	var lights = [];
-	
+
 	var _webglObjects = {};
 	var _webglObjects = {};
 	var _webglObjectsImmediate = [];
 	var _webglObjectsImmediate = [];
-	
+
 	var opaqueObjects = [];
 	var opaqueObjects = [];
 	var transparentObjects = [];
 	var transparentObjects = [];
 
 
@@ -519,7 +519,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	};
 	};
 
 
 	// Events
 	// Events
-	
+
 	var onObjectRemoved = function ( event ) {
 	var onObjectRemoved = function ( event ) {
 
 
 		var object = event.target;
 		var object = event.target;
@@ -3130,7 +3130,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	function painterSortStable ( a, b ) {
 	function painterSortStable ( a, b ) {
 
 
 		if ( a.material.id !== b.material.id ) {
 		if ( a.material.id !== b.material.id ) {
-		
+
 			return b.material.id - a.material.id;
 			return b.material.id - a.material.id;
 
 
 		} else if ( a.z !== b.z ) {
 		} else if ( a.z !== b.z ) {
@@ -3217,7 +3217,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		lights.length = 0;
 		lights.length = 0;
 		opaqueObjects.length = 0;
 		opaqueObjects.length = 0;
 		transparentObjects.length = 0;
 		transparentObjects.length = 0;
-		
+
 		projectObject( scene, scene, camera );
 		projectObject( scene, scene, camera );
 
 
 		if ( _this.sortObjects === true ) {
 		if ( _this.sortObjects === true ) {
@@ -3228,7 +3228,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		}
 		}
 
 
 		// custom render plugins (pre pass)
 		// custom render plugins (pre pass)
-		
+
 		renderPlugins( this.renderPluginsPre, scene, camera );
 		renderPlugins( this.renderPluginsPre, scene, camera );
 
 
 		//
 		//
@@ -3315,35 +3315,35 @@ THREE.WebGLRenderer = function ( parameters ) {
 		// _gl.finish();
 		// _gl.finish();
 
 
 	};
 	};
-	
+
 	function projectObject(scene, object,camera){
 	function projectObject(scene, object,camera){
-		
+
 		if ( object.visible === false ) return;
 		if ( object.visible === false ) return;
-		
+
 		if ( object instanceof THREE.Light ) {
 		if ( object instanceof THREE.Light ) {
 
 
 			lights.push( object );
 			lights.push( object );
 
 
 		}
 		}
-		
+
 		if ( object instanceof THREE.Scene ) {
 		if ( object instanceof THREE.Scene ) {
-		
+
 			//
 			//
-		
+
 		} else {
 		} else {
-		
+
 			initObject( object, scene );
 			initObject( object, scene );
-		
+
 			var webglObjects = _webglObjects[ object.id ];
 			var webglObjects = _webglObjects[ object.id ];
-		
+
 			if ( webglObjects && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) {
 			if ( webglObjects && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) {
-			
+
 				updateObject( object, scene );
 				updateObject( object, scene );
-			
+
 				for ( var i = 0, l = webglObjects.length; i < l; i ++ ) {
 				for ( var i = 0, l = webglObjects.length; i < l; i ++ ) {
-				
+
 					var webglObject = webglObjects[i];
 					var webglObject = webglObjects[i];
-				
+
 					unrollBufferMaterial( webglObject );
 					unrollBufferMaterial( webglObject );
 
 
 					webglObject.render = true;
 					webglObject.render = true;
@@ -3370,7 +3370,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			}
 			}
 
 
 		}
 		}
-		
+
 		for ( var i = 0, l = object.children.length; i < l; i ++ ) {
 		for ( var i = 0, l = object.children.length; i < l; i ++ ) {
 
 
 			projectObject( scene, object.children[ i ], camera );
 			projectObject( scene, object.children[ i ], camera );
@@ -3569,9 +3569,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 			object.addEventListener( 'removed', onObjectRemoved );
 			object.addEventListener( 'removed', onObjectRemoved );
 
 
 		}
 		}
-		
+
 		var geometry = object.geometry;
 		var geometry = object.geometry;
-		
+
 		if ( geometry === undefined ) {
 		if ( geometry === undefined ) {
 
 
 			// ImmediateRenderObject
 			// ImmediateRenderObject
@@ -3586,7 +3586,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				//
 				//
 
 
 			} else if ( object instanceof THREE.Mesh ) {
 			} else if ( object instanceof THREE.Mesh ) {
-				
+
 				initGeometryGroups(scene, object, geometry);
 				initGeometryGroups(scene, object, geometry);
 
 
 			} else if ( object instanceof THREE.Line ) {
 			} else if ( object instanceof THREE.Line ) {
@@ -3629,10 +3629,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 				} else if ( geometry instanceof THREE.Geometry ) {
 				} else if ( geometry instanceof THREE.Geometry ) {
 
 
 					for ( var i = 0,l = geometry.geometryGroupsList.length; i<l;i++ ) {
 					for ( var i = 0,l = geometry.geometryGroupsList.length; i<l;i++ ) {
-	
+
 						var geometryGroup = geometry.geometryGroupsList[ i ];
 						var geometryGroup = geometry.geometryGroupsList[ i ];
 						addBuffer( _webglObjects, geometryGroup, object );
 						addBuffer( _webglObjects, geometryGroup, object );
-						
+
 					}
 					}
 				}
 				}
 
 
@@ -3652,14 +3652,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 		}
 		}
 
 
 	};
 	};
-	
+
 	function initGeometryGroups( scene, object, geometry ) {
 	function initGeometryGroups( scene, object, geometry ) {
-		
+
 		var g, geometryGroup, material,addBuffers = false;
 		var g, geometryGroup, material,addBuffers = false;
 		material = object.material;
 		material = object.material;
 
 
 		if ( geometry.geometryGroups === undefined || geometry.groupsNeedUpdate ) {
 		if ( geometry.geometryGroups === undefined || geometry.groupsNeedUpdate ) {
-			
+
 			delete _webglObjects[object.id];
 			delete _webglObjects[object.id];
 			geometry.makeGroups( material instanceof THREE.MeshFaceMaterial, _glExtensionElementIndexUint ? 4294967296 : 65535  );
 			geometry.makeGroups( material instanceof THREE.MeshFaceMaterial, _glExtensionElementIndexUint ? 4294967296 : 65535  );
 			geometry.groupsNeedUpdate = false;
 			geometry.groupsNeedUpdate = false;
@@ -3686,15 +3686,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 				geometry.normalsNeedUpdate = true;
 				geometry.normalsNeedUpdate = true;
 				geometry.tangentsNeedUpdate = true;
 				geometry.tangentsNeedUpdate = true;
 				geometry.colorsNeedUpdate = true;
 				geometry.colorsNeedUpdate = true;
-				
+
 				addBuffers = true;
 				addBuffers = true;
-				
+
 			} else {
 			} else {
-				
+
 				addBuffers = false;
 				addBuffers = false;
-				
+
 			}
 			}
-			
+
 			if ( addBuffers || object.__webglActive === undefined ) {
 			if ( addBuffers || object.__webglActive === undefined ) {
 				addBuffer( _webglObjects, geometryGroup, object );
 				addBuffer( _webglObjects, geometryGroup, object );
 			}
 			}
@@ -3704,7 +3704,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		object.__webglActive = true;
 		object.__webglActive = true;
 
 
 	}
 	}
-	
+
 	function addBuffer( objlist, buffer, object ) {
 	function addBuffer( objlist, buffer, object ) {
 
 
 		var id = object.id;
 		var id = object.id;
@@ -3750,9 +3750,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			// check all geometry groups
 			// check all geometry groups
 			if ( geometry.buffersNeedUpdate || geometry.groupsNeedUpdate ) {
 			if ( geometry.buffersNeedUpdate || geometry.groupsNeedUpdate ) {
-				
+
 				initGeometryGroups(scene, object,geometry);
 				initGeometryGroups(scene, object,geometry);
-				
+
 			}
 			}
 
 
 			for ( var i = 0, il = geometry.geometryGroupsList.length; i < il; i ++ ) {
 			for ( var i = 0, il = geometry.geometryGroupsList.length; i < il; i ++ ) {
@@ -3896,9 +3896,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 	// Materials
 	// Materials
 
 
 	this.initMaterial = function () {
 	this.initMaterial = function () {
-	
+
 		console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
 		console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
-	
+
 	};
 	};
 
 
 	function initMaterial( material, lights, fog, object ) {
 	function initMaterial( material, lights, fog, object ) {
@@ -4753,7 +4753,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				//
 				//
 
 
-				case 'i': 
+				case 'i':
 
 
 					// single integer
 					// single integer
 					_gl.uniform1i( location, value );
 					_gl.uniform1i( location, value );
@@ -4781,7 +4781,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 					break;
 					break;
 
 
-				case 'v4': 
+				case 'v4':
 
 
 					// single THREE.Vector4
 					// single THREE.Vector4
 					_gl.uniform4f( location, value.x, value.y, value.z, value.w );
 					_gl.uniform4f( location, value.x, value.y, value.z, value.w );
@@ -6180,7 +6180,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_glExtensionTextureFilterAnisotropic = _gl.getExtension( 'EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );
 		_glExtensionTextureFilterAnisotropic = _gl.getExtension( 'EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || _gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );
 
 
 		_glExtensionCompressedTextureS3TC = _gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );
 		_glExtensionCompressedTextureS3TC = _gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );
-		_glExtensionCompressedTexturePVRTC = _gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || _gl.getExtension( 'MOZ_WEBGL_compressed_texture_pvrtc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );
+		_glExtensionCompressedTexturePVRTC = _gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || _gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );
 
 
 		_glExtensionElementIndexUint = _gl.getExtension( 'OES_element_index_uint' );
 		_glExtensionElementIndexUint = _gl.getExtension( 'OES_element_index_uint' );
 
 

Some files were not shown because too many files changed in this diff