浏览代码

Updated builds.

Mr.doob 11 年之前
父节点
当前提交
2401418c5e
共有 2 个文件被更改,包括 119 次插入130 次删除
  1. 66 77
      build/three.js
  2. 53 53
      build/three.min.js

+ 66 - 77
build/three.js

@@ -2979,15 +2979,9 @@ THREE.Euler.prototype = {
 
 	setFromRotationMatrix: function ( m, order ) {
 
-		// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-
-		// clamp, to handle numerical problems
+		var clamp = THREE.Math.clamp;
 
-		function clamp( x ) {
-
-			return Math.min( Math.max( x, -1 ), 1 );
-
-		}
+		// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
 
 		var te = m.elements;
 		var m11 = te[0], m12 = te[4], m13 = te[8];
@@ -2998,7 +2992,7 @@ THREE.Euler.prototype = {
 
 		if ( order === 'XYZ' ) {
 
-			this._y = Math.asin( clamp( m13 ) );
+			this._y = Math.asin( clamp( m13, -1, 1 ) );
 
 			if ( Math.abs( m13 ) < 0.99999 ) {
 
@@ -3014,7 +3008,7 @@ THREE.Euler.prototype = {
 
 		} else if ( order === 'YXZ' ) {
 
-			this._x = Math.asin( - clamp( m23 ) );
+			this._x = Math.asin( - clamp( m23, -1, 1 ) );
 
 			if ( Math.abs( m23 ) < 0.99999 ) {
 
@@ -3030,7 +3024,7 @@ THREE.Euler.prototype = {
 
 		} else if ( order === 'ZXY' ) {
 
-			this._x = Math.asin( clamp( m32 ) );
+			this._x = Math.asin( clamp( m32, -1, 1 ) );
 
 			if ( Math.abs( m32 ) < 0.99999 ) {
 
@@ -3046,7 +3040,7 @@ THREE.Euler.prototype = {
 
 		} else if ( order === 'ZYX' ) {
 
-			this._y = Math.asin( - clamp( m31 ) );
+			this._y = Math.asin( - clamp( m31, -1, 1 ) );
 
 			if ( Math.abs( m31 ) < 0.99999 ) {
 
@@ -3062,7 +3056,7 @@ THREE.Euler.prototype = {
 
 		} else if ( order === 'YZX' ) {
 
-			this._z = Math.asin( clamp( m21 ) );
+			this._z = Math.asin( clamp( m21, -1, 1 ) );
 
 			if ( Math.abs( m21 ) < 0.99999 ) {
 
@@ -3078,7 +3072,7 @@ THREE.Euler.prototype = {
 
 		} else if ( order === 'XZY' ) {
 
-			this._z = Math.asin( - clamp( m12 ) );
+			this._z = Math.asin( - clamp( m12, -1, 1 ) );
 
 			if ( Math.abs( m12 ) < 0.99999 ) {
 
@@ -3108,15 +3102,9 @@ THREE.Euler.prototype = {
 
 	setFromQuaternion: function ( q, order, update ) {
 
-		// q is assumed to be normalized
-
-		// clamp, to handle numerical problems
-
-		function clamp( x ) {
+		var clamp = THREE.Math.clamp;
 
-			return Math.min( Math.max( x, -1 ), 1 );
-
-		}
+		// q is assumed to be normalized
 
 		// http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m
 
@@ -3130,38 +3118,38 @@ THREE.Euler.prototype = {
 		if ( order === 'XYZ' ) {
 
 			this._x = Math.atan2( 2 * ( q.x * q.w - q.y * q.z ), ( sqw - sqx - sqy + sqz ) );
-			this._y = Math.asin(  clamp( 2 * ( q.x * q.z + q.y * q.w ) ) );
+			this._y = Math.asin(  clamp( 2 * ( q.x * q.z + q.y * q.w ), -1, 1 ) );
 			this._z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw + sqx - sqy - sqz ) );
 
 		} else if ( order ===  'YXZ' ) {
 
-			this._x = Math.asin(  clamp( 2 * ( q.x * q.w - q.y * q.z ) ) );
+			this._x = Math.asin(  clamp( 2 * ( q.x * q.w - q.y * q.z ), -1, 1 ) );
 			this._y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw - sqx - sqy + sqz ) );
 			this._z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw - sqx + sqy - sqz ) );
 
 		} else if ( order === 'ZXY' ) {
 
-			this._x = Math.asin(  clamp( 2 * ( q.x * q.w + q.y * q.z ) ) );
+			this._x = Math.asin(  clamp( 2 * ( q.x * q.w + q.y * q.z ), -1, 1 ) );
 			this._y = Math.atan2( 2 * ( q.y * q.w - q.z * q.x ), ( sqw - sqx - sqy + sqz ) );
 			this._z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw - sqx + sqy - sqz ) );
 
 		} else if ( order === 'ZYX' ) {
 
 			this._x = Math.atan2( 2 * ( q.x * q.w + q.z * q.y ), ( sqw - sqx - sqy + sqz ) );
-			this._y = Math.asin(  clamp( 2 * ( q.y * q.w - q.x * q.z ) ) );
+			this._y = Math.asin(  clamp( 2 * ( q.y * q.w - q.x * q.z ), -1, 1 ) );
 			this._z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw + sqx - sqy - sqz ) );
 
 		} else if ( order === 'YZX' ) {
 
 			this._x = Math.atan2( 2 * ( q.x * q.w - q.z * q.y ), ( sqw - sqx + sqy - sqz ) );
 			this._y = Math.atan2( 2 * ( q.y * q.w - q.x * q.z ), ( sqw + sqx - sqy - sqz ) );
-			this._z = Math.asin(  clamp( 2 * ( q.x * q.y + q.z * q.w ) ) );
+			this._z = Math.asin(  clamp( 2 * ( q.x * q.y + q.z * q.w ), -1, 1 ) );
 
 		} else if ( order === 'XZY' ) {
 
 			this._x = Math.atan2( 2 * ( q.x * q.w + q.y * q.z ), ( sqw - sqx + sqy - sqz ) );
 			this._y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw + sqx - sqy - sqz ) );
-			this._z = Math.asin(  clamp( 2 * ( q.z * q.w - q.x * q.y ) ) );
+			this._z = Math.asin(  clamp( 2 * ( q.z * q.w - q.x * q.y ), -1, 1 ) );
 
 		} else {
 
@@ -6415,7 +6403,9 @@ THREE.Math = {
 	}(),
 
 	isPowerOfTwo: function ( value ) {
+
 		return ( value & ( value - 1 ) ) === 0 && value !== 0;
+
 	}
 
 };
@@ -23418,11 +23408,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function painterSortStable ( a, b ) {
 
-		if ( a.materialId !== b.materialId ) {
-
-			return b.materialId - a.materialId;
-
-		} else if ( a.z !== b.z ) {
+		if ( a.z !== b.z ) {
 
 			return b.z - a.z;
 
@@ -23511,7 +23497,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 			object = webglObject.object;
 
 			webglObject.id = i;
-			webglObject.materialId = object.material.id;
 			webglObject.render = false;
 
 			if ( object.visible ) {
@@ -23918,80 +23903,85 @@ THREE.WebGLRenderer = function ( parameters ) {
 			object._modelViewMatrix = new THREE.Matrix4();
 			object._normalMatrix = new THREE.Matrix3();
 
-			if ( object.geometry !== undefined && object.geometry.__webglInit === undefined ) {
+			geometry = object.geometry;
+
+			if ( geometry === undefined ) {
+
+				// TODO: Hacky...
 
-				object.geometry.__webglInit = true;
-				object.geometry.addEventListener( 'dispose', onGeometryDispose );
+				object.__webglActive = true;
+				return;
 
 			}
 
-			geometry = object.geometry;
+			if ( geometry.__webglInit === undefined ) {
 
-			if ( geometry === undefined ) {
+				geometry.__webglInit = true;
+				geometry.addEventListener( 'dispose', onGeometryDispose );
 
-				// fail silently for now
+				if ( geometry instanceof THREE.BufferGeometry ) {
 
-			} else if ( geometry instanceof THREE.BufferGeometry ) {
+					initDirectBuffers( geometry );
 
-				initDirectBuffers( geometry );
+				} else if ( object instanceof THREE.Mesh ) {
 
-			} else if ( object instanceof THREE.Mesh ) {
+					material = object.material;
 
-				material = object.material;
+					if ( geometry.geometryGroups === undefined ) {
 
-				if ( geometry.geometryGroups === undefined ) {
+						geometry.makeGroups( material instanceof THREE.MeshFaceMaterial, _glExtensionElementIndexUint ? 4294967296 : 65535  );
 
-					geometry.makeGroups( material instanceof THREE.MeshFaceMaterial, _glExtensionElementIndexUint ? 4294967296 : 65535  );
+					}
 
-				}
+					// create separate VBOs per geometry chunk
 
-				// create separate VBOs per geometry chunk
+					for ( g in geometry.geometryGroups ) {
 
-				for ( g in geometry.geometryGroups ) {
+						geometryGroup = geometry.geometryGroups[ g ];
 
-					geometryGroup = geometry.geometryGroups[ g ];
+						// initialise VBO on the first access
 
-					// initialise VBO on the first access
+						if ( ! geometryGroup.__webglVertexBuffer ) {
 
-					if ( ! geometryGroup.__webglVertexBuffer ) {
+							createMeshBuffers( geometryGroup );
+							initMeshBuffers( geometryGroup, object );
 
-						createMeshBuffers( geometryGroup );
-						initMeshBuffers( geometryGroup, object );
+							geometry.verticesNeedUpdate = true;
+							geometry.morphTargetsNeedUpdate = true;
+							geometry.elementsNeedUpdate = true;
+							geometry.uvsNeedUpdate = true;
+							geometry.normalsNeedUpdate = true;
+							geometry.tangentsNeedUpdate = true;
+							geometry.colorsNeedUpdate = true;
 
-						geometry.verticesNeedUpdate = true;
-						geometry.morphTargetsNeedUpdate = true;
-						geometry.elementsNeedUpdate = true;
-						geometry.uvsNeedUpdate = true;
-						geometry.normalsNeedUpdate = true;
-						geometry.tangentsNeedUpdate = true;
-						geometry.colorsNeedUpdate = true;
+						}
 
 					}
 
-				}
+				} else if ( object instanceof THREE.Line ) {
 
-			} else if ( object instanceof THREE.Line ) {
+					if ( ! geometry.__webglVertexBuffer ) {
 
-				if ( ! geometry.__webglVertexBuffer ) {
+						createLineBuffers( geometry );
+						initLineBuffers( geometry, object );
 
-					createLineBuffers( geometry );
-					initLineBuffers( geometry, object );
+						geometry.verticesNeedUpdate = true;
+						geometry.colorsNeedUpdate = true;
+						geometry.lineDistancesNeedUpdate = true;
 
-					geometry.verticesNeedUpdate = true;
-					geometry.colorsNeedUpdate = true;
-					geometry.lineDistancesNeedUpdate = true;
+					}
 
-				}
+				} else if ( object instanceof THREE.ParticleSystem ) {
 
-			} else if ( object instanceof THREE.ParticleSystem ) {
+					if ( ! geometry.__webglVertexBuffer ) {
 
-				if ( ! geometry.__webglVertexBuffer ) {
+						createParticleBuffers( geometry );
+						initParticleBuffers( geometry, object );
 
-					createParticleBuffers( geometry );
-					initParticleBuffers( geometry, object );
+						geometry.verticesNeedUpdate = true;
+						geometry.colorsNeedUpdate = true;
 
-					geometry.verticesNeedUpdate = true;
-					geometry.colorsNeedUpdate = true;
+					}
 
 				}
 
@@ -24054,7 +24044,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 				id: null,
 				buffer: buffer,
 				object: object,
-				materialId: null,
 				opaque: null,
 				transparent: null,
 				z: 0

+ 53 - 53
build/three.min.js

@@ -61,11 +61,11 @@ Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return t
 setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,
 this.w)}};THREE.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ";
 THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,_quaternion:void 0,_updateQuaternion:function(){void 0!==this._quaternion&&this._quaternion.setFromEuler(this,!1)},get x(){return this._x},set x(a){this._x=a;this._updateQuaternion()},get y(){return this._y},set y(a){this._y=a;this._updateQuaternion()},get z(){return this._z},set z(a){this._z=a;this._updateQuaternion()},get order(){return this._order},set order(a){this._order=a;this._updateQuaternion()},
-set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._updateQuaternion();return this},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._updateQuaternion();return this},setFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],k=d[5],l=d[9],p=d[2],n=d[6],d=d[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(c(g)),0.99999>Math.abs(g)?(this._x=Math.atan2(-l,d),this._z=
-Math.atan2(-f,e)):(this._x=Math.atan2(n,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-c(l)),0.99999>Math.abs(l)?(this._y=Math.atan2(g,d),this._z=Math.atan2(h,k)):(this._y=Math.atan2(-p,e),this._z=0)):"ZXY"===b?(this._x=Math.asin(c(n)),0.99999>Math.abs(n)?(this._y=Math.atan2(-p,d),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,e))):"ZYX"===b?(this._y=Math.asin(-c(p)),0.99999>Math.abs(p)?(this._x=Math.atan2(n,d),this._z=Math.atan2(h,e)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=
-Math.asin(c(h)),0.99999>Math.abs(h)?(this._x=Math.atan2(-l,k),this._y=Math.atan2(-p,e)):(this._x=0,this._y=Math.atan2(g,d))):"XZY"===b?(this._z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this._x=Math.atan2(n,k),this._y=Math.atan2(g,e)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("WARNING: Euler.setFromRotationMatrix() given unsupported order: "+b);this._order=b;this._updateQuaternion();return this},setFromQuaternion:function(a,b,c){function d(a){return Math.min(Math.max(a,-1),1)}var e=a.x*a.x,f=
-a.y*a.y,g=a.z*a.z,h=a.w*a.w;b=b||this._order;"XYZ"===b?(this._x=Math.atan2(2*(a.x*a.w-a.y*a.z),h-e-f+g),this._y=Math.asin(d(2*(a.x*a.z+a.y*a.w))),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),h+e-f-g)):"YXZ"===b?(this._x=Math.asin(d(2*(a.x*a.w-a.y*a.z))),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),h-e-f+g),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-e+f-g)):"ZXY"===b?(this._x=Math.asin(d(2*(a.x*a.w+a.y*a.z))),this._y=Math.atan2(2*(a.y*a.w-a.z*a.x),h-e-f+g),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-e+f-g)):"ZYX"===
-b?(this._x=Math.atan2(2*(a.x*a.w+a.z*a.y),h-e-f+g),this._y=Math.asin(d(2*(a.y*a.w-a.x*a.z))),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),h+e-f-g)):"YZX"===b?(this._x=Math.atan2(2*(a.x*a.w-a.z*a.y),h-e+f-g),this._y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+e-f-g),this._z=Math.asin(d(2*(a.x*a.y+a.z*a.w)))):"XZY"===b?(this._x=Math.atan2(2*(a.x*a.w+a.y*a.z),h-e+f-g),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+e-f-g),this._z=Math.asin(d(2*(a.z*a.w-a.x*a.y)))):console.warn("WARNING: Euler.setFromQuaternion() given unsupported order: "+
+set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._updateQuaternion();return this},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._updateQuaternion();return this},setFromRotationMatrix:function(a,b){var c=THREE.Math.clamp,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],k=d[5],l=d[9],p=d[2],n=d[6],d=d[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(c(g,-1,1)),0.99999>Math.abs(g)?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-f,e)):(this._x=
+Math.atan2(n,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-c(l,-1,1)),0.99999>Math.abs(l)?(this._y=Math.atan2(g,d),this._z=Math.atan2(h,k)):(this._y=Math.atan2(-p,e),this._z=0)):"ZXY"===b?(this._x=Math.asin(c(n,-1,1)),0.99999>Math.abs(n)?(this._y=Math.atan2(-p,d),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,e))):"ZYX"===b?(this._y=Math.asin(-c(p,-1,1)),0.99999>Math.abs(p)?(this._x=Math.atan2(n,d),this._z=Math.atan2(h,e)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(c(h,
+-1,1)),0.99999>Math.abs(h)?(this._x=Math.atan2(-l,k),this._y=Math.atan2(-p,e)):(this._x=0,this._y=Math.atan2(g,d))):"XZY"===b?(this._z=Math.asin(-c(f,-1,1)),0.99999>Math.abs(f)?(this._x=Math.atan2(n,k),this._y=Math.atan2(g,e)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("WARNING: Euler.setFromRotationMatrix() given unsupported order: "+b);this._order=b;this._updateQuaternion();return this},setFromQuaternion:function(a,b,c){var d=THREE.Math.clamp,e=a.x*a.x,f=a.y*a.y,g=a.z*a.z,h=a.w*a.w;b=b||
+this._order;"XYZ"===b?(this._x=Math.atan2(2*(a.x*a.w-a.y*a.z),h-e-f+g),this._y=Math.asin(d(2*(a.x*a.z+a.y*a.w),-1,1)),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),h+e-f-g)):"YXZ"===b?(this._x=Math.asin(d(2*(a.x*a.w-a.y*a.z),-1,1)),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),h-e-f+g),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-e+f-g)):"ZXY"===b?(this._x=Math.asin(d(2*(a.x*a.w+a.y*a.z),-1,1)),this._y=Math.atan2(2*(a.y*a.w-a.z*a.x),h-e-f+g),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-e+f-g)):"ZYX"===b?(this._x=Math.atan2(2*
+(a.x*a.w+a.z*a.y),h-e-f+g),this._y=Math.asin(d(2*(a.y*a.w-a.x*a.z),-1,1)),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),h+e-f-g)):"YZX"===b?(this._x=Math.atan2(2*(a.x*a.w-a.z*a.y),h-e+f-g),this._y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+e-f-g),this._z=Math.asin(d(2*(a.x*a.y+a.z*a.w),-1,1))):"XZY"===b?(this._x=Math.atan2(2*(a.x*a.w+a.y*a.z),h-e+f-g),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+e-f-g),this._z=Math.asin(d(2*(a.z*a.w-a.x*a.y),-1,1))):console.warn("WARNING: Euler.setFromQuaternion() given unsupported order: "+
 b);this._order=b;!1!==c&&this._updateQuaternion();return this},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this);this.setFromQuaternion(a,b)}}(),fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._updateQuaternion();return this},toArray:function(){return[this._x,this._y,this._z,this._order]},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},clone:function(){return new THREE.Euler(this._x,
 this._y,this._z,this._order)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3};
 THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(0.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,
@@ -388,51 +388,51 @@ function c(a,b){var c=b.geometry,g=a.faces3,h=3*g.length,k=1*g.length,l=3*g.leng
 (a.__skinIndexArray=new Float32Array(4*h),a.__skinWeightArray=new Float32Array(4*h));c=null!==sb&&21845<k?Uint32Array:Uint16Array;a.__typeArray=c;a.__faceArray=new c(3*k);a.__lineArray=new c(2*l);if(a.numMorphTargets)for(a.__morphTargetsArrays=[],c=0,p=a.numMorphTargets;c<p;c++)a.__morphTargetsArrays.push(new Float32Array(3*h));if(a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0,p=a.numMorphNormals;c<p;c++)a.__morphNormalsArrays.push(new Float32Array(3*h));a.__webglFaceCount=3*k;a.__webglLineCount=
 2*l;if(g.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var q in g.attributes){var k=g.attributes[q],l={},s;for(s in k)l[s]=k[s];if(!l.__webglInitialized||l.createUniqueBuffers)l.__webglInitialized=!0,c=1,"v2"===l.type?c=2:"v3"===l.type?c=3:"v4"===l.type?c=4:"c"===l.type&&(c=3),l.size=c,l.array=new Float32Array(h*c),l.buffer=m.createBuffer(),l.buffer.belongsToAttribute=q,k.needsUpdate=!0,l.__original=k;a.__webglCustomAttributesList.push(l)}}a.__inittedArrays=
 !0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c,d){for(var e in b){var f=b[e],g=c[e];if(0<=
-f)if(g){var k=g.itemSize;m.bindBuffer(m.ARRAY_BUFFER,g.buffer);h(f);m.vertexAttribPointer(f,k,m.FLOAT,!1,0,d*k*4)}else a.defaultAttributeValues&&(2===a.defaultAttributeValues[e].length?m.vertexAttrib2fv(f,a.defaultAttributeValues[e]):3===a.defaultAttributeValues[e].length&&m.vertexAttrib3fv(f,a.defaultAttributeValues[e]))}}function h(a){0===lb[a]&&(m.enableVertexAttribArray(a),lb[a]=1)}function k(){for(var a=0,b=lb.length;a<b;a++)1===lb[a]&&(m.disableVertexAttribArray(a),lb[a]=0)}function l(a,b){return a.materialId!==
-b.materialId?b.materialId-a.materialId:a.z!==b.z?b.z-a.z:a.id-b.id}function p(a,b){return b[0]-a[0]}function n(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)Ca=Ba=null,Fa=ia=xa=Ga=Da=ka=ya=-1,Xa=!0,a[d].render(b,c,sa,La),Ca=Ba=null,Fa=ia=xa=Ga=Da=ka=ya=-1,Xa=!0}function r(a,b,c,d,e,f,g,h){var k,m,l,p;b?(m=a.length-1,p=b=-1):(m=0,b=a.length,p=1);for(var n=m;n!==b;n+=p)if(k=a[n],k.render){m=k.object;l=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&Q.setBlending(k.blending,k.blendEquation,k.blendSrc,
-k.blendDst);Q.setDepthTest(k.depthTest);Q.setDepthWrite(k.depthWrite);y(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}Q.setMaterialFaces(k);l instanceof THREE.BufferGeometry?Q.renderBufferDirect(d,e,f,k,l,m):Q.renderBuffer(d,e,f,k,l,m)}}function s(a,b,c,d,e,f,g){for(var h,k,m=0,l=a.length;m<l;m++)if(h=a[m],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&Q.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);Q.setDepthTest(h.depthTest);Q.setDepthWrite(h.depthWrite);
-y(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}Q.renderImmediateObject(c,d,e,h,k)}}function t(a,d){var e,f,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Cb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry)for(g in f.attributes){var h="index"===g?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER,
-k=f.attributes[g];k.buffer=m.createBuffer();m.bindBuffer(h,k.buffer);m.bufferData(h,k.array,m.STATIC_DRAW)}else if(a instanceof THREE.Mesh)for(e in g=a.material,void 0===f.geometryGroups&&f.makeGroups(g instanceof THREE.MeshFaceMaterial,sb?4294967296:65535),f.geometryGroups){if(g=f.geometryGroups[e],!g.__webglVertexBuffer){h=g;h.__webglVertexBuffer=m.createBuffer();h.__webglNormalBuffer=m.createBuffer();h.__webglTangentBuffer=m.createBuffer();h.__webglColorBuffer=m.createBuffer();h.__webglUVBuffer=
-m.createBuffer();h.__webglUV2Buffer=m.createBuffer();h.__webglSkinIndicesBuffer=m.createBuffer();h.__webglSkinWeightsBuffer=m.createBuffer();h.__webglFaceBuffer=m.createBuffer();h.__webglLineBuffer=m.createBuffer();var l=k=void 0;if(h.numMorphTargets)for(h.__webglMorphTargetsBuffers=[],k=0,l=h.numMorphTargets;k<l;k++)h.__webglMorphTargetsBuffers.push(m.createBuffer());if(h.numMorphNormals)for(h.__webglMorphNormalsBuffers=[],k=0,l=h.numMorphNormals;k<l;k++)h.__webglMorphNormalsBuffers.push(m.createBuffer());
-Q.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),g.__webglLineDistanceBuffer=m.createBuffer(),Q.info.memory.geometries++,g=f,h=g.vertices.length,g.__vertexArray=new Float32Array(3*h),g.__colorArray=new Float32Array(3*
-h),g.__lineDistanceArray=new Float32Array(1*h),g.__webglLineCount=h,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),Q.info.memory.geometries++,g=f,h=g.vertices.length,g.__vertexArray=new Float32Array(3*h),g.__colorArray=new Float32Array(3*h),g.__sortArray=[],g.__webglParticleCount=h,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=
-!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)q(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],q(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,q(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof
-THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function q(a,b,c){a.push({id:null,buffer:b,object:c,materialId:null,opaque:null,transparent:null,z:0})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?x(b.__webglObjects,a):a instanceof
-THREE.Sprite?G(b.__webglSprites,a):a instanceof THREE.LensFlare?G(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&x(b.__webglObjectsImmediate,a);delete a.__webglActive}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function G(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function A(a,b,c,d,e){Ja=0;d.needsUpdate&&(d.program&&Db(d),Q.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&
-(e.__webglMorphTargetInfluences=new Float32Array(Q.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,k=d.uniforms;g!==Ba&&(m.useProgram(g),Ba=g,f=!0);d.id!==Fa&&(Fa=d.id,f=!0);if(f||a!==Ca)m.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==Ca&&(Ca=a);if(d.skinning)if(Eb&&e.useVertexTexture){if(null!==h.boneTexture){var l=M();m.uniform1i(h.boneTexture,l);Q.setTexture(e.boneTexture,l)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&
-m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Xa){var p,n=l=0,r=0,q,s,u,t=Pb,v=t.directional.colors,w=t.directional.positions,x=t.point.colors,
-y=t.point.positions,z=t.point.distances,G=t.spot.colors,C=t.spot.positions,A=t.spot.distances,J=t.spot.directions,B=t.spot.anglesCos,I=t.spot.exponents,O=t.hemi.skyColors,N=t.hemi.groundColors,X=t.hemi.positions,S=0,ba=0,ha=0,W=0,cc=0,Y=0,Z=0,R=0,ia=p=0;c=u=ia=0;for(f=b.length;c<f;c++)if(p=b[c],!p.onlyShadow)if(q=p.color,s=p.intensity,u=p.distance,p instanceof THREE.AmbientLight)p.visible&&(Q.gammaInput?(l+=q.r*q.r,n+=q.g*q.g,r+=q.b*q.b):(l+=q.r,n+=q.g,r+=q.b));else if(p instanceof THREE.DirectionalLight){if(cc+=
-1,p.visible&&(qa.setFromMatrixPosition(p.matrixWorld),va.setFromMatrixPosition(p.target.matrixWorld),qa.sub(va),qa.normalize(),0!==qa.x||0!==qa.y||0!==qa.z))p=3*S,w[p]=qa.x,w[p+1]=qa.y,w[p+2]=qa.z,Q.gammaInput?H(v,p,q,s*s):E(v,p,q,s),S+=1}else p instanceof THREE.PointLight?(Y+=1,p.visible&&(ia=3*ba,Q.gammaInput?H(x,ia,q,s*s):E(x,ia,q,s),va.setFromMatrixPosition(p.matrixWorld),y[ia]=va.x,y[ia+1]=va.y,y[ia+2]=va.z,z[ba]=u,ba+=1)):p instanceof THREE.SpotLight?(Z+=1,p.visible&&(ia=3*ha,Q.gammaInput?H(G,
-ia,q,s*s):E(G,ia,q,s),va.setFromMatrixPosition(p.matrixWorld),C[ia]=va.x,C[ia+1]=va.y,C[ia+2]=va.z,A[ha]=u,qa.copy(va),va.setFromMatrixPosition(p.target.matrixWorld),qa.sub(va),qa.normalize(),J[ia]=qa.x,J[ia+1]=qa.y,J[ia+2]=qa.z,B[ha]=Math.cos(p.angle),I[ha]=p.exponent,ha+=1)):p instanceof THREE.HemisphereLight&&(R+=1,p.visible&&(qa.setFromMatrixPosition(p.matrixWorld),qa.normalize(),0!==qa.x||0!==qa.y||0!==qa.z))&&(u=3*W,X[u]=qa.x,X[u+1]=qa.y,X[u+2]=qa.z,q=p.color,p=p.groundColor,Q.gammaInput?(s*=
-s,H(O,u,q,s),H(N,u,p,s)):(E(O,u,q,s),E(N,u,p,s)),W+=1);c=3*S;for(f=Math.max(v.length,3*cc);c<f;c++)v[c]=0;c=3*ba;for(f=Math.max(x.length,3*Y);c<f;c++)x[c]=0;c=3*ha;for(f=Math.max(G.length,3*Z);c<f;c++)G[c]=0;c=3*W;for(f=Math.max(O.length,3*R);c<f;c++)O[c]=0;c=3*W;for(f=Math.max(N.length,3*R);c<f;c++)N[c]=0;t.directional.length=S;t.point.length=ba;t.spot.length=ha;t.hemi.length=W;t.ambient[0]=l;t.ambient[1]=n;t.ambient[2]=r;Xa=!1}c=Pb;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=
-c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngleCos.value=c.spot.anglesCos;k.spotLightExponent.value=c.spot.exponents;k.hemisphereLightSkyColor.value=c.hemi.skyColors;
-k.hemisphereLightGroundColor.value=c.hemi.groundColors;k.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=d.opacity;Q.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;k.map.value=d.map;k.lightMap.value=d.lightMap;k.specularMap.value=d.specularMap;d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale);d.normalMap&&(k.normalMap.value=
-d.normalMap,k.normalScale.value.copy(d.normalScale));var T;d.map?T=d.map:d.specularMap?T=d.specularMap:d.normalMap?T=d.normalMap:d.bumpMap&&(T=d.bumpMap);void 0!==T&&(c=T.offset,T=T.repeat,k.offsetRepeat.value.set(c.x,c.y,T.x,T.y));k.envMap.value=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof
-THREE.LineBasicMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity,k.dashSize.value=d.dashSize,k.totalSize.value=d.dashSize+d.gapSize,k.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?(k.psColor.value=d.color,k.opacity.value=d.opacity,k.size.value=d.size,k.scale.value=F.height/2,k.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(k.shininess.value=d.shininess,Q.gammaInput?(k.ambient.value.copyGammaToLinear(d.ambient),
-k.emissive.value.copyGammaToLinear(d.emissive),k.specular.value.copyGammaToLinear(d.specular)):(k.ambient.value=d.ambient,k.emissive.value=d.emissive,k.specular.value=d.specular),d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(Q.gammaInput?(k.ambient.value.copyGammaToLinear(d.ambient),k.emissive.value.copyGammaToLinear(d.emissive)):(k.ambient.value=d.ambient,k.emissive.value=d.emissive),d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?
-(k.mNear.value=a.near,k.mFar.value=a.far,k.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(k.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&k.shadowMatrix)for(c=T=0,f=b.length;c<f;c++)l=b[c],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)&&(k.shadowMap.value[T]=l.shadowMap,k.shadowMapSize.value[T]=l.shadowMapSize,k.shadowMatrix.value[T]=l.shadowMatrix,k.shadowDarkness.value[T]=l.shadowDarkness,k.shadowBias.value[T]=
-l.shadowBias,T++);b=d.uniformsList;k=0;for(T=b.length;k<T;k++)if(f=g.uniforms[b[k][1]])if(c=b[k][0],n=c.type,l=c.value,"i"===n)m.uniform1i(f,l);else if("f"===n)m.uniform1f(f,l);else if("v2"===n)m.uniform2f(f,l.x,l.y);else if("v3"===n)m.uniform3f(f,l.x,l.y,l.z);else if("v4"===n)m.uniform4f(f,l.x,l.y,l.z,l.w);else if("c"===n)m.uniform3f(f,l.r,l.g,l.b);else if("iv1"===n)m.uniform1iv(f,l);else if("iv"===n)m.uniform3iv(f,l);else if("fv1"===n)m.uniform1fv(f,l);else if("fv"===n)m.uniform3fv(f,l);else if("v2v"===
-n){void 0===c._array&&(c._array=new Float32Array(2*l.length));n=0;for(r=l.length;n<r;n++)t=2*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y;m.uniform2fv(f,c._array)}else if("v3v"===n){void 0===c._array&&(c._array=new Float32Array(3*l.length));n=0;for(r=l.length;n<r;n++)t=3*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y,c._array[t+2]=l[n].z;m.uniform3fv(f,c._array)}else if("v4v"===n){void 0===c._array&&(c._array=new Float32Array(4*l.length));n=0;for(r=l.length;n<r;n++)t=4*n,c._array[t]=l[n].x,c._array[t+1]=
-l[n].y,c._array[t+2]=l[n].z,c._array[t+3]=l[n].w;m.uniform4fv(f,c._array)}else if("m4"===n)void 0===c._array&&(c._array=new Float32Array(16)),l.flattenToArray(c._array),m.uniformMatrix4fv(f,!1,c._array);else if("m4v"===n){void 0===c._array&&(c._array=new Float32Array(16*l.length));n=0;for(r=l.length;n<r;n++)l[n].flattenToArrayOffset(c._array,16*n);m.uniformMatrix4fv(f,!1,c._array)}else if("t"===n){if(t=l,l=M(),m.uniform1i(f,l),t)if(t.image instanceof Array&&6===t.image.length){if(c=t,f=l,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||
-(c.addEventListener("dispose",Fb),c.image.__webglTextureCube=m.createTexture(),Q.info.memory.textures++);m.activeTexture(m.TEXTURE0+f);m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;l=[];for(n=0;6>n;n++)Q.autoScaleCubemaps&&!f?(r=l,t=n,v=c.image[n],x=dc,v.width<=x&&v.height<=x||(y=Math.max(v.width,v.height),w=Math.floor(v.width*x/y),x=Math.floor(v.height*x/y),y=document.createElement("canvas"),y.width=
-w,y.height=x,y.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,w,x),v=y),r[t]=v):l[n]=c.image[n];n=l[0];r=THREE.Math.isPowerOfTwo(n.width)&&THREE.Math.isPowerOfTwo(n.height);t=K(c.format);v=K(c.type);D(m.TEXTURE_CUBE_MAP,c,r);for(n=0;6>n;n++)if(f)for(x=l[n].mipmaps,y=0,z=x.length;y<z;y++)w=x[y],c.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,y,t,w.width,w.height,0,w.data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,y,t,w.width,w.height,0,t,v,w.data);else m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+
-n,0,t,t,v,l[n]);c.generateMipmaps&&r&&m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):Q.setTexture(t,l)}else if("tv"===n){void 0===c._array&&(c._array=[]);n=0;for(r=c.value.length;n<r;n++)c._array[n]=M();m.uniform1iv(f,c._array);n=0;for(r=
-c.value.length;n<r;n++)t=c.value[n],l=c._array[n],t&&Q.setTexture(t,l)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+n);(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&(va.setFromMatrixPosition(a.matrixWorld),m.uniform3f(h.cameraPosition,va.x,va.y,va.z));(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&m.uniformMatrix4fv(h.viewMatrix,
-!1,a.matrixWorldInverse.elements)}m.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&m.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function M(){var a=Ja;a>=Bb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Bb);Ja+=1;return a}function H(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function E(a,b,c,
-d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function J(a){a!==wa&&(m.lineWidth(a),wa=a)}function y(a,b,c){da!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),da=a);!a||aa===b&&oa===c||(m.polygonOffset(b,c),aa=b,oa=c)}function z(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function I(a,b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return m.getShaderParameter(c,
-m.COMPILE_STATUS)?c:(console.error(m.getShaderInfoLog(c)),console.error(z(b)),null)}function D(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,K(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,K(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,K(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,K(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,C(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,
-C(b.minFilter)));cb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(m.texParameterf(a,cb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Gb)),b.__oldAnisotropy=b.anisotropy)}function B(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,
-b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height)}function C(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function K(a){if(a===THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;
-if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;
-if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;
-if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;
-if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return m.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;if(void 0!==Pa){if(a===THREE.RGB_S3TC_DXT1_Format)return Pa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Pa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Pa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Pa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}
-console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),N=void 0!==a.context?a.context:null,X=void 0!==a.precision?a.precision:"highp",S=void 0!==a.alpha?a.alpha:!1,ma=void 0!==a.depth?a.depth:!0,ea=void 0!==a.stencil?a.stencil:!0,W=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ca=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,fa=new THREE.Color(0),T=0;this.domElement=F;this.context=
-null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!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 Q=this,ha=[],R=0,Ba=null,ba=null,Fa=-1,ia=null,Ca=null,Ja=0,Ga=-1,xa=-1,ya=-1,Ra=-1,na=-1,Ha=-1,ka=-1,Da=-1,da=null,aa=null,oa=null,wa=null,Ia=0,Ea=0,Ka=F.width,ja=F.height,sa=0,La=0,lb=new Uint8Array(16),qb=new THREE.Frustum,Ob=new THREE.Matrix4,bc=new THREE.Matrix4,va=new THREE.Vector3,qa=new THREE.Vector3,Xa=!0,Pb=
-{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:[]}},m,rb,Ab,cb,Pa,sb;(function(){try{var a={alpha:S,depth:ma,stencil:ea,antialias:W,premultipliedAlpha:O,preserveDrawingBuffer:ca};m=N||F.getContext("webgl",a)||F.getContext("experimental-webgl",a);if(null===m)throw"Error creating WebGL context.";
-}catch(b){console.error(b)}rb=m.getExtension("OES_texture_float");m.getExtension("OES_texture_float_linear");Ab=m.getExtension("OES_standard_derivatives");cb=m.getExtension("EXT_texture_filter_anisotropic")||m.getExtension("MOZ_EXT_texture_filter_anisotropic")||m.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Pa=m.getExtension("WEBGL_compressed_texture_s3tc")||m.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||m.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");sb=m.getExtension("OES_element_index_uint");
-null===rb&&console.log("THREE.WebGLRenderer: Float textures not supported.");null===Ab&&console.log("THREE.WebGLRenderer: Standard derivatives not supported.");null===cb&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");null===Pa&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");null===sb&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,
+f)if(g){var k=g.itemSize;m.bindBuffer(m.ARRAY_BUFFER,g.buffer);h(f);m.vertexAttribPointer(f,k,m.FLOAT,!1,0,d*k*4)}else a.defaultAttributeValues&&(2===a.defaultAttributeValues[e].length?m.vertexAttrib2fv(f,a.defaultAttributeValues[e]):3===a.defaultAttributeValues[e].length&&m.vertexAttrib3fv(f,a.defaultAttributeValues[e]))}}function h(a){0===lb[a]&&(m.enableVertexAttribArray(a),lb[a]=1)}function k(){for(var a=0,b=lb.length;a<b;a++)1===lb[a]&&(m.disableVertexAttribArray(a),lb[a]=0)}function l(a,b){return a.z!==
+b.z?b.z-a.z:a.id-b.id}function p(a,b){return b[0]-a[0]}function n(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)Ca=Ba=null,Fa=ia=xa=Ga=Da=ka=ya=-1,Xa=!0,a[d].render(b,c,sa,La),Ca=Ba=null,Fa=ia=xa=Ga=Da=ka=ya=-1,Xa=!0}function r(a,b,c,d,e,f,g,h){var k,m,l,p;b?(m=a.length-1,p=b=-1):(m=0,b=a.length,p=1);for(var n=m;n!==b;n+=p)if(k=a[n],k.render){m=k.object;l=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&Q.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);Q.setDepthTest(k.depthTest);
+Q.setDepthWrite(k.depthWrite);y(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}Q.setMaterialFaces(k);l instanceof THREE.BufferGeometry?Q.renderBufferDirect(d,e,f,k,l,m):Q.renderBuffer(d,e,f,k,l,m)}}function s(a,b,c,d,e,f,g){for(var h,k,m=0,l=a.length;m<l;m++)if(h=a[m],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&Q.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);Q.setDepthTest(h.depthTest);Q.setDepthWrite(h.depthWrite);y(h.polygonOffset,h.polygonOffsetFactor,
+h.polygonOffsetUnits)}Q.renderImmediateObject(c,d,e,h,k)}}function t(a,d){var e,f,g;if(void 0===a.__webglInit){a.__webglInit=!0;a._modelViewMatrix=new THREE.Matrix4;a._normalMatrix=new THREE.Matrix3;f=a.geometry;if(void 0===f){a.__webglActive=!0;return}if(void 0===f.__webglInit)if(f.__webglInit=!0,f.addEventListener("dispose",Cb),f instanceof THREE.BufferGeometry)for(g in f.attributes){var h="index"===g?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER,k=f.attributes[g];k.buffer=m.createBuffer();m.bindBuffer(h,
+k.buffer);m.bufferData(h,k.array,m.STATIC_DRAW)}else if(a instanceof THREE.Mesh)for(e in g=a.material,void 0===f.geometryGroups&&f.makeGroups(g instanceof THREE.MeshFaceMaterial,sb?4294967296:65535),f.geometryGroups){if(g=f.geometryGroups[e],!g.__webglVertexBuffer){h=g;h.__webglVertexBuffer=m.createBuffer();h.__webglNormalBuffer=m.createBuffer();h.__webglTangentBuffer=m.createBuffer();h.__webglColorBuffer=m.createBuffer();h.__webglUVBuffer=m.createBuffer();h.__webglUV2Buffer=m.createBuffer();h.__webglSkinIndicesBuffer=
+m.createBuffer();h.__webglSkinWeightsBuffer=m.createBuffer();h.__webglFaceBuffer=m.createBuffer();h.__webglLineBuffer=m.createBuffer();var l=k=void 0;if(h.numMorphTargets)for(h.__webglMorphTargetsBuffers=[],k=0,l=h.numMorphTargets;k<l;k++)h.__webglMorphTargetsBuffers.push(m.createBuffer());if(h.numMorphNormals)for(h.__webglMorphNormalsBuffers=[],k=0,l=h.numMorphNormals;k<l;k++)h.__webglMorphNormalsBuffers.push(m.createBuffer());Q.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=
+!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),g.__webglLineDistanceBuffer=m.createBuffer(),Q.info.memory.geometries++,g=f,h=g.vertices.length,g.__vertexArray=new Float32Array(3*h),g.__colorArray=new Float32Array(3*h),g.__lineDistanceArray=new Float32Array(1*h),g.__webglLineCount=h,b(g,a),f.verticesNeedUpdate=
+!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),Q.info.memory.geometries++,g=f,h=g.vertices.length,g.__vertexArray=new Float32Array(3*h),g.__colorArray=new Float32Array(3*h),g.__sortArray=[],g.__webglParticleCount=h,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0)}if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof
+THREE.BufferGeometry)q(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],q(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,q(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);
+a.__webglActive=!0}}function q(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?x(b.__webglObjects,a):a instanceof THREE.Sprite?G(b.__webglSprites,a):a instanceof THREE.LensFlare?G(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||
+a.immediateRenderCallback)&&x(b.__webglObjectsImmediate,a);delete a.__webglActive}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function G(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function A(a,b,c,d,e){Ja=0;d.needsUpdate&&(d.program&&Db(d),Q.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(Q.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,k=d.uniforms;g!==Ba&&
+(m.useProgram(g),Ba=g,f=!0);d.id!==Fa&&(Fa=d.id,f=!0);if(f||a!==Ca)m.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==Ca&&(Ca=a);if(d.skinning)if(Eb&&e.useVertexTexture){if(null!==h.boneTexture){var l=M();m.uniform1i(h.boneTexture,l);Q.setTexture(e.boneTexture,l)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,
+!1,e.boneMatrices);if(f){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Xa){var p,n=l=0,r=0,q,s,u,t=Pb,v=t.directional.colors,w=t.directional.positions,x=t.point.colors,y=t.point.positions,z=t.point.distances,G=t.spot.colors,C=t.spot.positions,A=t.spot.distances,J=t.spot.directions,B=t.spot.anglesCos,
+I=t.spot.exponents,O=t.hemi.skyColors,N=t.hemi.groundColors,X=t.hemi.positions,S=0,ba=0,ha=0,W=0,cc=0,Y=0,Z=0,R=0,ia=p=0;c=u=ia=0;for(f=b.length;c<f;c++)if(p=b[c],!p.onlyShadow)if(q=p.color,s=p.intensity,u=p.distance,p instanceof THREE.AmbientLight)p.visible&&(Q.gammaInput?(l+=q.r*q.r,n+=q.g*q.g,r+=q.b*q.b):(l+=q.r,n+=q.g,r+=q.b));else if(p instanceof THREE.DirectionalLight){if(cc+=1,p.visible&&(qa.setFromMatrixPosition(p.matrixWorld),va.setFromMatrixPosition(p.target.matrixWorld),qa.sub(va),qa.normalize(),
+0!==qa.x||0!==qa.y||0!==qa.z))p=3*S,w[p]=qa.x,w[p+1]=qa.y,w[p+2]=qa.z,Q.gammaInput?H(v,p,q,s*s):E(v,p,q,s),S+=1}else p instanceof THREE.PointLight?(Y+=1,p.visible&&(ia=3*ba,Q.gammaInput?H(x,ia,q,s*s):E(x,ia,q,s),va.setFromMatrixPosition(p.matrixWorld),y[ia]=va.x,y[ia+1]=va.y,y[ia+2]=va.z,z[ba]=u,ba+=1)):p instanceof THREE.SpotLight?(Z+=1,p.visible&&(ia=3*ha,Q.gammaInput?H(G,ia,q,s*s):E(G,ia,q,s),va.setFromMatrixPosition(p.matrixWorld),C[ia]=va.x,C[ia+1]=va.y,C[ia+2]=va.z,A[ha]=u,qa.copy(va),va.setFromMatrixPosition(p.target.matrixWorld),
+qa.sub(va),qa.normalize(),J[ia]=qa.x,J[ia+1]=qa.y,J[ia+2]=qa.z,B[ha]=Math.cos(p.angle),I[ha]=p.exponent,ha+=1)):p instanceof THREE.HemisphereLight&&(R+=1,p.visible&&(qa.setFromMatrixPosition(p.matrixWorld),qa.normalize(),0!==qa.x||0!==qa.y||0!==qa.z))&&(u=3*W,X[u]=qa.x,X[u+1]=qa.y,X[u+2]=qa.z,q=p.color,p=p.groundColor,Q.gammaInput?(s*=s,H(O,u,q,s),H(N,u,p,s)):(E(O,u,q,s),E(N,u,p,s)),W+=1);c=3*S;for(f=Math.max(v.length,3*cc);c<f;c++)v[c]=0;c=3*ba;for(f=Math.max(x.length,3*Y);c<f;c++)x[c]=0;c=3*ha;
+for(f=Math.max(G.length,3*Z);c<f;c++)G[c]=0;c=3*W;for(f=Math.max(O.length,3*R);c<f;c++)O[c]=0;c=3*W;for(f=Math.max(N.length,3*R);c<f;c++)N[c]=0;t.directional.length=S;t.point.length=ba;t.spot.length=ha;t.hemi.length=W;t.ambient[0]=l;t.ambient[1]=n;t.ambient[2]=r;Xa=!1}c=Pb;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;
+k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngleCos.value=c.spot.anglesCos;k.spotLightExponent.value=c.spot.exponents;k.hemisphereLightSkyColor.value=c.hemi.skyColors;k.hemisphereLightGroundColor.value=c.hemi.groundColors;k.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof
+THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=d.opacity;Q.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;k.map.value=d.map;k.lightMap.value=d.lightMap;k.specularMap.value=d.specularMap;d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale);d.normalMap&&(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale));var T;d.map?T=d.map:d.specularMap?T=d.specularMap:d.normalMap?T=d.normalMap:d.bumpMap&&(T=d.bumpMap);
+void 0!==T&&(c=T.offset,T=T.repeat,k.offsetRepeat.value.set(c.x,c.y,T.x,T.y));k.envMap.value=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(k.diffuse.value=
+d.color,k.opacity.value=d.opacity,k.dashSize.value=d.dashSize,k.totalSize.value=d.dashSize+d.gapSize,k.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?(k.psColor.value=d.color,k.opacity.value=d.opacity,k.size.value=d.size,k.scale.value=F.height/2,k.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(k.shininess.value=d.shininess,Q.gammaInput?(k.ambient.value.copyGammaToLinear(d.ambient),k.emissive.value.copyGammaToLinear(d.emissive),k.specular.value.copyGammaToLinear(d.specular)):
+(k.ambient.value=d.ambient,k.emissive.value=d.emissive,k.specular.value=d.specular),d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(Q.gammaInput?(k.ambient.value.copyGammaToLinear(d.ambient),k.emissive.value.copyGammaToLinear(d.emissive)):(k.ambient.value=d.ambient,k.emissive.value=d.emissive),d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(k.mNear.value=a.near,k.mFar.value=a.far,k.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&
+(k.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&k.shadowMatrix)for(c=T=0,f=b.length;c<f;c++)l=b[c],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)&&(k.shadowMap.value[T]=l.shadowMap,k.shadowMapSize.value[T]=l.shadowMapSize,k.shadowMatrix.value[T]=l.shadowMatrix,k.shadowDarkness.value[T]=l.shadowDarkness,k.shadowBias.value[T]=l.shadowBias,T++);b=d.uniformsList;k=0;for(T=b.length;k<T;k++)if(f=g.uniforms[b[k][1]])if(c=b[k][0],n=c.type,
+l=c.value,"i"===n)m.uniform1i(f,l);else if("f"===n)m.uniform1f(f,l);else if("v2"===n)m.uniform2f(f,l.x,l.y);else if("v3"===n)m.uniform3f(f,l.x,l.y,l.z);else if("v4"===n)m.uniform4f(f,l.x,l.y,l.z,l.w);else if("c"===n)m.uniform3f(f,l.r,l.g,l.b);else if("iv1"===n)m.uniform1iv(f,l);else if("iv"===n)m.uniform3iv(f,l);else if("fv1"===n)m.uniform1fv(f,l);else if("fv"===n)m.uniform3fv(f,l);else if("v2v"===n){void 0===c._array&&(c._array=new Float32Array(2*l.length));n=0;for(r=l.length;n<r;n++)t=2*n,c._array[t]=
+l[n].x,c._array[t+1]=l[n].y;m.uniform2fv(f,c._array)}else if("v3v"===n){void 0===c._array&&(c._array=new Float32Array(3*l.length));n=0;for(r=l.length;n<r;n++)t=3*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y,c._array[t+2]=l[n].z;m.uniform3fv(f,c._array)}else if("v4v"===n){void 0===c._array&&(c._array=new Float32Array(4*l.length));n=0;for(r=l.length;n<r;n++)t=4*n,c._array[t]=l[n].x,c._array[t+1]=l[n].y,c._array[t+2]=l[n].z,c._array[t+3]=l[n].w;m.uniform4fv(f,c._array)}else if("m4"===n)void 0===c._array&&
+(c._array=new Float32Array(16)),l.flattenToArray(c._array),m.uniformMatrix4fv(f,!1,c._array);else if("m4v"===n){void 0===c._array&&(c._array=new Float32Array(16*l.length));n=0;for(r=l.length;n<r;n++)l[n].flattenToArrayOffset(c._array,16*n);m.uniformMatrix4fv(f,!1,c._array)}else if("t"===n){if(t=l,l=M(),m.uniform1i(f,l),t)if(t.image instanceof Array&&6===t.image.length){if(c=t,f=l,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Fb),c.image.__webglTextureCube=
+m.createTexture(),Q.info.memory.textures++);m.activeTexture(m.TEXTURE0+f);m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;l=[];for(n=0;6>n;n++)Q.autoScaleCubemaps&&!f?(r=l,t=n,v=c.image[n],x=dc,v.width<=x&&v.height<=x||(y=Math.max(v.width,v.height),w=Math.floor(v.width*x/y),x=Math.floor(v.height*x/y),y=document.createElement("canvas"),y.width=w,y.height=x,y.getContext("2d").drawImage(v,0,0,v.width,v.height,
+0,0,w,x),v=y),r[t]=v):l[n]=c.image[n];n=l[0];r=THREE.Math.isPowerOfTwo(n.width)&&THREE.Math.isPowerOfTwo(n.height);t=K(c.format);v=K(c.type);D(m.TEXTURE_CUBE_MAP,c,r);for(n=0;6>n;n++)if(f)for(x=l[n].mipmaps,y=0,z=x.length;y<z;y++)w=x[y],c.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,y,t,w.width,w.height,0,w.data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,y,t,w.width,w.height,0,t,v,w.data);else m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,t,t,v,l[n]);c.generateMipmaps&&
+r&&m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):Q.setTexture(t,l)}else if("tv"===n){void 0===c._array&&(c._array=[]);n=0;for(r=c.value.length;n<r;n++)c._array[n]=M();m.uniform1iv(f,c._array);n=0;for(r=c.value.length;n<r;n++)t=c.value[n],
+l=c._array[n],t&&Q.setTexture(t,l)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+n);(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&(va.setFromMatrixPosition(a.matrixWorld),m.uniform3f(h.cameraPosition,va.x,va.y,va.z));(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&m.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}m.uniformMatrix4fv(h.modelViewMatrix,
+!1,e._modelViewMatrix.elements);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&m.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function M(){var a=Ja;a>=Bb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Bb);Ja+=1;return a}function H(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function E(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function J(a){a!==wa&&(m.lineWidth(a),
+wa=a)}function y(a,b,c){da!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),da=a);!a||aa===b&&oa===c||(m.polygonOffset(b,c),aa=b,oa=c)}function z(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function I(a,b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return m.getShaderParameter(c,m.COMPILE_STATUS)?c:(console.error(m.getShaderInfoLog(c)),
+console.error(z(b)),null)}function D(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,K(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,K(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,K(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,K(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,C(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,C(b.minFilter)));cb&&b.type!==THREE.FloatType&&(1<
+b.anisotropy||b.__oldAnisotropy)&&(m.texParameterf(a,cb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Gb)),b.__oldAnisotropy=b.anisotropy)}function B(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,
+m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height)}function C(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function K(a){if(a===THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;
+if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;
+if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;
+if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;
+if(a===THREE.DstColorFactor)return m.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;if(void 0!==Pa){if(a===THREE.RGB_S3TC_DXT1_Format)return Pa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Pa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Pa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Pa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",
+THREE.REVISION);a=a||{};var F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),N=void 0!==a.context?a.context:null,X=void 0!==a.precision?a.precision:"highp",S=void 0!==a.alpha?a.alpha:!1,ma=void 0!==a.depth?a.depth:!0,ea=void 0!==a.stencil?a.stencil:!0,W=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ca=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,fa=new THREE.Color(0),T=0;this.domElement=F;this.context=null;this.devicePixelRatio=
+void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!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 Q=this,ha=[],R=0,Ba=null,ba=null,Fa=-1,ia=null,Ca=null,Ja=0,Ga=-1,xa=-1,ya=-1,Ra=-1,na=-1,Ha=-1,ka=-1,Da=-1,da=null,aa=null,oa=null,wa=null,Ia=0,Ea=0,Ka=F.width,ja=F.height,sa=0,La=0,lb=new Uint8Array(16),qb=new THREE.Frustum,Ob=new THREE.Matrix4,bc=new THREE.Matrix4,va=new THREE.Vector3,qa=new THREE.Vector3,Xa=!0,Pb={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:[]}},m,rb,Ab,cb,Pa,sb;(function(){try{var a={alpha:S,depth:ma,stencil:ea,antialias:W,premultipliedAlpha:O,preserveDrawingBuffer:ca};m=N||F.getContext("webgl",a)||F.getContext("experimental-webgl",a);if(null===m)throw"Error creating WebGL context.";}catch(b){console.error(b)}rb=
+m.getExtension("OES_texture_float");m.getExtension("OES_texture_float_linear");Ab=m.getExtension("OES_standard_derivatives");cb=m.getExtension("EXT_texture_filter_anisotropic")||m.getExtension("MOZ_EXT_texture_filter_anisotropic")||m.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Pa=m.getExtension("WEBGL_compressed_texture_s3tc")||m.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||m.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");sb=m.getExtension("OES_element_index_uint");null===rb&&
+console.log("THREE.WebGLRenderer: Float textures not supported.");null===Ab&&console.log("THREE.WebGLRenderer: Standard derivatives not supported.");null===cb&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");null===Pa&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");null===sb&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,
 rangeMax:1,precision:1}})})();m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.viewport(Ia,Ea,Ka,ja);m.clearColor(fa.r,fa.g,fa.b,T);this.context=m;var Bb=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),xb=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS);m.getParameter(m.MAX_TEXTURE_SIZE);var dc=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),
 Gb=cb?m.getParameter(cb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Hb=0<xb,Eb=Hb&&rb;Pa&&m.getParameter(m.COMPRESSED_TEXTURE_FORMATS);var ec=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),fc=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_FLOAT);var rc=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_FLOAT),sc=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,
 m.HIGH_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_INT);var tc=0<ec.precision&&0<rc.precision,Ib=0<fc.precision&&0<sc.precision;"highp"!==X||tc||(Ib?(X="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(X="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));
@@ -462,9 +462,9 @@ l;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(m.b
 e.__webglLineDistanceBuffer),h(b.lineDistance),m.vertexAttribPointer(b.lineDistance,1,m.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(f=e.__typeArray===Uint32Array?m.UNSIGNED_INT:m.UNSIGNED_SHORT,d.wireframe?(J(d.wireframeLinewidth),a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,f,0)):(a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,f,0)),Q.info.render.calls++,Q.info.render.vertices+=e.__webglFaceCount,
 Q.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,J(d.linewidth),m.drawArrays(f,0,e.__webglLineCount),Q.info.render.calls++):f instanceof THREE.ParticleSystem&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),Q.info.render.calls++,Q.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,
 f,g,h,k=a.__lights,p=a.fog;Fa=-1;Xa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ob.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);qb.setFromMatrix(Ob);this.autoUpdateObjects&&this.initWebGLObjects(a);n(this.renderPluginsPre,a,b);Q.info.render.calls=0;Q.info.render.vertices=0;Q.info.render.faces=0;Q.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,
-this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.materialId=g.material.id,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||qb.intersectsObject(g))){var q=g;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,t=q.object,u=q.buffer,v=t.geometry,t=t.material;t instanceof THREE.MeshFaceMaterial?(t=t.materials[v instanceof
-THREE.BufferGeometry?0:u.materialIndex],t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null)):t&&(t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(va.setFromMatrixPosition(g.matrixWorld),va.applyProjection(Ob),f.z=va.z))}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,
-g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),y(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,k,p,!0,d),s(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),
+this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||qb.intersectsObject(g))){var q=g;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,t=q.object,u=q.buffer,v=t.geometry,t=t.material;t instanceof THREE.MeshFaceMaterial?(t=t.materials[v instanceof THREE.BufferGeometry?0:
+u.materialIndex],t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null)):t&&(t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(va.setFromMatrixPosition(g.matrixWorld),va.applyProjection(Ob),f.z=va.z))}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),
+g._normalMatrix.getNormalMatrix(g._modelViewMatrix),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),y(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,k,p,!0,d),s(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),
 r(a.__webglObjects,!0,"opaque",b,k,p,!1,d),s(a.__webglObjectsImmediate,"opaque",b,k,p,!1,d),r(a.__webglObjects,!1,"transparent",b,k,p,!0,d),s(a.__webglObjectsImmediate,"transparent",b,k,p,!0,d));n(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,
 c.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=A(a,b,c,d,e);ia=-1;Q.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,qb):e.render(function(a){Q.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)t(a.__objectsAdded[0],
 a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)u(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,g=a.__webglObjects.length;b<g;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&u(h,a),t(h,a));var k=h,l=k.geometry,n=void 0,r=void 0,q=void 0;if(l instanceof THREE.BufferGeometry){var s=m.DYNAMIC_DRAW,x=l.attributes,y=void 0,z=void 0;for(y in x)z=x[y],z.needsUpdate&&("index"===y?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,z.buffer),