diff --git a/build/three.js b/build/three.js index f74255cb8eae96d4ede0344decc18f81960c593c..6a33bc44400430e39d1953903e1f002b7107e644 100644 --- a/build/three.js +++ b/build/three.js @@ -19312,6 +19312,9 @@ THREE.WebGLRenderer = function ( parameters ) { var opaqueObjects = []; var transparentObjects = []; + var opaqueImmediateObjects = []; + var transparentImmediateObjects = []; + var sprites = []; var lensFlares = []; @@ -20810,9 +20813,13 @@ THREE.WebGLRenderer = function ( parameters ) { _frustum.setFromMatrix( _projScreenMatrix ); lights.length = 0; + opaqueObjects.length = 0; transparentObjects.length = 0; + opaqueImmediateObjects.length = 0; + transparentImmediateObjects.length = 0; + sprites.length = 0; lensFlares.length = 0; @@ -20847,34 +20854,7 @@ THREE.WebGLRenderer = function ( parameters ) { } - // set matrices for immediate objects - - for ( var i = 0, il = objects.objectsImmediate.length; i < il; i ++ ) { - - var webglObject = objects.objectsImmediate[ i ]; - var object = webglObject.object; - - if ( object.visible === true ) { - - setupMatrices( object, camera ); - - var material = object.material; - - if ( material.transparent ) { - - webglObject.transparent = material; - webglObject.opaque = null; - - } else { - - webglObject.opaque = material; - webglObject.transparent = null; - - } - - } - - } + // if ( scene.overrideMaterial ) { @@ -20882,7 +20862,9 @@ THREE.WebGLRenderer = function ( parameters ) { renderObjects( opaqueObjects, camera, lights, fog, overrideMaterial ); renderObjects( transparentObjects, camera, lights, fog, overrideMaterial ); - renderObjectsImmediate( objects.objectsImmediate, '', camera, lights, fog, overrideMaterial ); + + renderObjectsImmediate( opaqueImmediateObjects, camera, lights, fog, overrideMaterial ); + renderObjectsImmediate( transparentImmediateObjects, camera, lights, fog, overrideMaterial ); } else { @@ -20891,12 +20873,12 @@ THREE.WebGLRenderer = function ( parameters ) { state.setBlending( THREE.NoBlending ); renderObjects( opaqueObjects, camera, lights, fog, null ); - renderObjectsImmediate( objects.objectsImmediate, 'opaque', camera, lights, fog, null ); + renderObjectsImmediate( opaqueImmediateObjects, camera, lights, fog, null ); // transparent pass (back-to-front order) renderObjects( transparentObjects, camera, lights, fog, null ); - renderObjectsImmediate( objects.objectsImmediate, 'transparent', camera, lights, fog, null ); + renderObjectsImmediate( transparentImmediateObjects, camera, lights, fog, null ); } @@ -20954,6 +20936,20 @@ THREE.WebGLRenderer = function ( parameters ) { lensFlares.push( object ); + } else if ( object instanceof THREE.ImmediateRenderObject ) { + + var material = object.material; + + if ( material.transparent ) { + + transparentImmediateObjects.push( object ); + + } else { + + opaqueImmediateObjects.push( object ); + + } + } else { var webglObject = objects.objects[ object.id ]; @@ -21010,7 +21006,6 @@ THREE.WebGLRenderer = function ( parameters ) { for ( var i = 0, l = renderList.length; i < l; i ++ ) { var webglObject = renderList[ i ]; - var object = webglObject.object; setupMatrices( object, camera ); @@ -21037,20 +21032,19 @@ THREE.WebGLRenderer = function ( parameters ) { } - function renderObjectsImmediate ( renderList, materialType, camera, lights, fog, overrideMaterial ) { + function renderObjectsImmediate( renderList, camera, lights, fog, overrideMaterial ) { var material = overrideMaterial; for ( var i = 0, l = renderList.length; i < l; i ++ ) { - var webglObject = renderList[ i ]; - var object = webglObject.object; + var object = renderList[ i ]; - if ( object.visible === true ) { + setupMatrices( object, camera ); - if ( overrideMaterial === null ) material = webglObject[ materialType ]; + if ( object.visible === true ) { - if ( ! material ) continue; + if ( overrideMaterial === null ) material = object.material; _this.renderImmediateObject( camera, lights, fog, material, object ); @@ -21074,7 +21068,11 @@ THREE.WebGLRenderer = function ( parameters ) { } else { - object.render( function ( object ) { _this.renderBufferImmediate( object, program, material ); } ); + object.render( function ( object ) { + + _this.renderBufferImmediate( object, program, material ); + + } ); } @@ -22209,7 +22207,7 @@ THREE.WebGLRenderer = function ( parameters ) { } - function setupMatrices ( object, camera ) { + function setupMatrices( object, camera ) { object._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); object._normalMatrix.getNormalMatrix( object._modelViewMatrix ); @@ -23572,7 +23570,6 @@ THREE.WebGLGeometries = function ( gl, info ) { THREE.WebGLObjects = function ( gl, properties, info ) { var objects = {}; - var objectsImmediate = []; var morphInfluences = new Float32Array( 8 ); @@ -23601,10 +23598,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) { delete objects[ object.id ]; - } else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) { - - removeInstances( objectsImmediate, object ); - } delete object._modelViewMatrix; @@ -23631,7 +23624,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) { // this.objects = objects; - this.objectsImmediate = objectsImmediate; this.geometries = geometries; @@ -23661,16 +23653,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) { z: 0 }; - } else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) { - - objectsImmediate.push( { - id: null, - object: object, - opaque: null, - transparent: null, - z: 0 - } ); - } } @@ -23838,7 +23820,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) { this.clear = function () { objects = {}; - objectsImmediate = []; }; @@ -24457,7 +24438,6 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) { _max = new THREE.Vector3(), _webglObjects = _objects.objects, - _webglObjectsImmediate = _objects.objectsImmediate, _matrixPosition = new THREE.Vector3(), @@ -24759,23 +24739,6 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) { } - // set matrices and render immediate objects - - for ( j = 0, jl = _webglObjectsImmediate.length; j < jl; j ++ ) { - - webglObject = _webglObjectsImmediate[ j ]; - object = webglObject.object; - - if ( object.visible && object.castShadow ) { - - object._modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); - - _renderer.renderImmediateObject( shadowCamera, _lights, fog, _depthMaterial, object ); - - } - - } - } // restore GL state @@ -24798,7 +24761,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) { }; - function projectObject( object, shadowCamera ) { + function projectObject( object, camera ) { if ( object.visible === true ) { @@ -24806,14 +24769,14 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) { if ( webglObject && object.castShadow && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) { - object._modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld ); + object._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); _renderList.push( webglObject ); } for ( var i = 0, l = object.children.length; i < l; i ++ ) { - projectObject( object.children[ i ], shadowCamera ); + projectObject( object.children[ i ], camera ); } @@ -25349,12 +25312,12 @@ THREE.WebGLState = function ( gl, paramThreeToGL ) { } - var boundTexture = currentBoundTextures[currentTextureSlot]; + var boundTexture = currentBoundTextures[ currentTextureSlot ]; if ( boundTexture === undefined ) { boundTexture = { type: undefined, texture: undefined }; - currentBoundTextures[currentTextureSlot] = boundTexture; + currentBoundTextures[ currentTextureSlot ] = boundTexture; } diff --git a/build/three.min.js b/build/three.min.js index b6df5560b25bf8c8e39104bf4b9820f9f3abe959..7a2c48e14b67995a2e3f292c11cc3b016c165a0c 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -94,22 +94,22 @@ void 0===c&&(c=0);void 0===d&&(d=b.length/b.itemSize);for(var e=0;ed?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new THREE.Vector3, -b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),k=-this.direction.dot(b),l=c.dot(this.direction),m=-c.dot(b),p=c.lengthSq(),n=Math.abs(1-k*k),r;0=-r?e<=r?(h=1/n,d*=h,e*=h,k=d*(d+k*e+2*l)+e*(k*d+e+2*m)+p):(e=h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*m)+p):(e=-h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*m)+p):e<=-r?(d=Math.max(0,-(-k*h+l)),e= -0=-q?e<=q?(h=1/n,d*=h,e*=h,k=d*(d+k*e+2*l)+e*(k*d+e+2*m)+p):(e=h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*m)+p):(e=-h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*m)+p):e<=-q?(d=Math.max(0,-(-k*h+l)),e= +0f)return null;f=Math.sqrt(f-e);e=d-f;d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<= a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},isIntersectionBox:function(){var a=new THREE.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null; if(e>c||c!==c)c=e;if(fg||e>d)return null;if(e>c||c!==c)c=e;if(gd?null:this.at(0<=c?c:d,b)},intersectTriangle:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Vector3;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0f)h=-1,f=-f;else return null;a.subVectors(this.origin, @@ -130,8 +130,8 @@ THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.c this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius); return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}}; THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]}; -THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],m=c[8],p=c[9],n=c[10],r=c[11],t=c[12],q=c[13],u=c[14],c=c[15];b[0].setComponents(f-a,l-g,r-m,c-t).normalize();b[1].setComponents(f+ -a,l+g,r+m,c+t).normalize();b[2].setComponents(f+d,l+h,r+p,c+q).normalize();b[3].setComponents(f-d,l-h,r-p,c-q).normalize();b[4].setComponents(f-e,l-k,r-n,c-u).normalize();b[5].setComponents(f+e,l+k,r+n,c+u).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes, +THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],m=c[8],p=c[9],n=c[10],q=c[11],r=c[12],s=c[13],u=c[14],c=c[15];b[0].setComponents(f-a,l-g,q-m,c-r).normalize();b[1].setComponents(f+ +a,l+g,q+m,c+r).normalize();b[2].setComponents(f+d,l+h,q+p,c+s).normalize();b[3].setComponents(f-d,l-h,q-p,c-s).normalize();b[4].setComponents(f-e,l-k,q-n,c-u).normalize();b[5].setComponents(f+e,l+k,q+n,c+u).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes, c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)e;e++){var f=d[e];a.x=0g&&0>f)return!1}return!0}}(), containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0}; THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d, @@ -194,32 +194,32 @@ return this},setXYZ:function(a,b,c,d){a=a*this.data.stride+this.offset;this.data THREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate= this.elementsNeedUpdate=this.verticesNeedUpdate=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;cd?-1:1,e.vertexTangents[c]=new THREE.Vector4(w.x,w.y,w.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;cd?-1:1,e.vertexTangents[c]=new THREE.Vector4(v.x,v.y,v.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;cd;d++)if(e[d]===e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;cpa?-1:1;h[4*a]=T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=ea}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()"); -else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],l=[],m=0;mq;q++)t=b[3*c+q],-1===n[t]?(p[2*q]=t,p[2*q+1]=-1,m++): -n[t]k.index+a)for(k={start:f,count:0,index:g},h.push(k),m=0;6>m;m+=2)q=p[m+1],-1m;m+=2)t=p[m],q=p[m+1],-1===q&&(q=g++),n[t]=q,r[q]=t,e[f++]=q-k.index,k.count++}this.reorderBuffers(e,r,g);return this.drawcalls=this.offsets=h},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a);else{void 0=== +this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;doa?-1:1;h[4*a]=T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=fa}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()"); +else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],l=[],m=0;ms;s++)r=b[3*c+s],-1===n[r]?(p[2*s]=r,p[2*s+1]=-1,m++): +n[r]k.index+a)for(k={start:f,count:0,index:g},h.push(k),m=0;6>m;m+=2)s=p[m+1],-1m;m+=2)r=p[m],s=p[m+1],-1===s&&(s=g++),n[r]=s,q[s]=r,e[f++]=s-k.index,k.count++}this.reorderBuffers(e,q,g);return this.drawcalls=this.offsets=h},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a);else{void 0=== b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,f=a.attributes[d],g=f.array,h=0,f=f.itemSize*b;ha.opacity&&(h.transparent=!0);void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&&(h.wireframe=a.wireframe); void 0!==a.vertexColors&&("face"===a.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=e(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=e(a.colorSpecular));a.colorEmissive&&(h.emissive=e(a.colorEmissive));void 0!==a.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),a.opacity=a.transparency);void 0!==a.opacity&&(h.opacity=a.opacity);a.specularCoef&&(h.shininess= a.specularCoef);a.mapDiffuse&&b&&d(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&d(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapAO&&b&&d(h,"aoMap",a.mapAO,a.mapAORepeat,a.mapAOOffset,a.mapAOWrap,a.mapAOAnisotropy);a.mapBump&&b&&d(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&d(h,"normalMap",a.mapNormal,a.mapNormalRepeat, @@ -293,10 +293,10 @@ THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d g.src=a;return g},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)}; THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText),k=h.metadata;if(void 0!==k){if("object"===k.type){console.error("THREE.JSONLoader: "+b+" should be loaded with THREE.ObjectLoader instead.");return}if("scene"===k.type){console.error("THREE.JSONLoader: "+b+" seems to be a Scene. Use THREE.SceneLoader instead.");return}}h= a.parse(h,d);c(h.geometry,h.materials)}else console.error("THREE.JSONLoader: "+b+" seems to be unreachable or the file is empty.");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load "+b+" ("+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)}; -THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,l,m,p,n,r,t,q,u,v,x=a.faces;m=a.vertices;var z=a.normals,w=a.colors,H=0;if(void 0!==a.uvs){for(d=0;dg;g++)n=x[k++],v=u[2*n],n=u[2*n+1],v=new THREE.Vector2(v,n),2!==g&&c.faceVertexUvs[d][h].push(v),0!==g&&c.faceVertexUvs[d][h+1].push(v);p&&(p=3*x[k++],r.normal.set(z[p++],z[p++],z[p]),q.normal.copy(r.normal));if(t)for(d=0;4>d;d++)p=3*x[k++],t=new THREE.Vector3(z[p++],z[p++],z[p]),2!==d&&r.vertexNormals.push(t), -0!==d&&q.vertexNormals.push(t);m&&(m=x[k++],m=w[m],r.color.setHex(m),q.color.setHex(m));if(b)for(d=0;4>d;d++)m=x[k++],m=w[m],2!==d&&r.vertexColors.push(new THREE.Color(m)),0!==d&&q.vertexColors.push(new THREE.Color(m));c.faces.push(r);c.faces.push(q)}else{r=new THREE.Face3;r.a=x[k++];r.b=x[k++];r.c=x[k++];h&&k++;h=c.faces.length;if(d)for(d=0;dg;g++)n=x[k++],v=u[2*n],n=u[2*n+1],v=new THREE.Vector2(v,n),c.faceVertexUvs[d][h].push(v);p&&(p=3*x[k++], -r.normal.set(z[p++],z[p++],z[p]));if(t)for(d=0;3>d;d++)p=3*x[k++],t=new THREE.Vector3(z[p++],z[p++],z[p]),r.vertexNormals.push(t);m&&(m=x[k++],r.color.setHex(w[m]));if(b)for(d=0;3>d;d++)m=x[k++],r.vertexColors.push(new THREE.Color(w[m]));c.faces.push(r)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;dg;g++)n=x[k++],w=u[2*n],n=u[2*n+1],w=new THREE.Vector2(w,n),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);p&&(p=3*x[k++],q.normal.set(z[p++],z[p++],z[p]),s.normal.copy(q.normal));if(r)for(d=0;4>d;d++)p=3*x[k++],r=new THREE.Vector3(z[p++],z[p++],z[p]),2!==d&&q.vertexNormals.push(r), +0!==d&&s.vertexNormals.push(r);m&&(m=x[k++],m=v[m],q.color.setHex(m),s.color.setHex(m));if(b)for(d=0;4>d;d++)m=x[k++],m=v[m],2!==d&&q.vertexColors.push(new THREE.Color(m)),0!==d&&s.vertexColors.push(new THREE.Color(m));c.faces.push(q);c.faces.push(s)}else{q=new THREE.Face3;q.a=x[k++];q.b=x[k++];q.c=x[k++];h&&k++;h=c.faces.length;if(d)for(d=0;dg;g++)n=x[k++],w=u[2*n],n=u[2*n+1],w=new THREE.Vector2(w,n),c.faceVertexUvs[d][h].push(w);p&&(p=3*x[k++], +q.normal.set(z[p++],z[p++],z[p]));if(r)for(d=0;3>d;d++)p=3*x[k++],r=new THREE.Vector3(z[p++],z[p++],z[p]),q.vertexNormals.push(r);m&&(m=x[k++],q.color.setHex(v[m]));if(b)for(d=0;3>d;d++)m=x[k++],q.vertexColors.push(new THREE.Color(v[m]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;dc.far||d.push({distance:l,distanceToRay:Math.sqrt(f),point:k.clone(),index:g,face:null,object:e})}};if(f instanceof THREE.BufferGeometry){var l=f.attributes,m=l.position.array;if(void 0!==l.index){var l=l.index.array,p=f.offsets;0===p.length&&p.push({start:0,count:l.length,index:0});for(var n=0,r=p.length;nc.far||d.push({distance:l,distanceToRay:Math.sqrt(f),point:k.clone(),index:g,face:null,object:e})}};if(f instanceof THREE.BufferGeometry){var l=f.attributes,m=l.position.array;if(void 0!==l.index){var l=l.index.array,p=f.offsets;0===p.length&&p.push({start:0,count:l.length,index:0});for(var n=0,q=p.length;nf||(z=b.origin.distanceTo(m),zd.far||e.push({distance:z,point:l.clone().applyMatrix4(this.matrixWorld),index:g,offsetIndex:q,face:null,faceIndex:null, +THREE.BufferGeometry){var n=g.attributes;if(void 0!==n.index){var q=n.index.array,n=n.position.array,r=g.offsets;0===r.length&&(r=[{start:0,count:q.length,index:0}]);for(var s=0;sf||(z=b.origin.distanceTo(m),zd.far||e.push({distance:z,point:l.clone().applyMatrix4(this.matrixWorld),index:g,offsetIndex:s,face:null,faceIndex:null, object:this}))}}else for(n=n.position.array,g=0;gf||(z=b.origin.distanceTo(m),zd.far||e.push({distance:z,point:l.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g instanceof THREE.Geometry)for(h=g.vertices,k=h.length,g=0;gf||(z=b.origin.distanceTo(m),zd.far||e.push({distance:z,point:l.clone().applyMatrix4(this.matrixWorld), index:g,face:null,faceIndex:null,object:this}))}}}();THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE[this.type](this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a}; THREE.Line.prototype.toJSON=function(a){var b=THREE.Object3D.prototype.toJSON.call(this,a);void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON());void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON());b.object.geometry=this.geometry.uuid;b.object.material=this.material.uuid;return b};THREE.LineStrip=0;THREE.LinePieces=1;THREE.LineSegments=function(a,b){THREE.Line.call(this,a,b);this.type="LineSegments"}; @@ -387,11 +387,11 @@ THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototyp THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0g.far||h.push({distance:H,point:w,face:new THREE.Face3(m,p,n,THREE.Triangle.normal(d,e,f)),faceIndex:Math.floor(k/3),object:this})}}}}else for(t=m.position.array,r=k=0,z=t.length;kg.far||h.push({distance:H,point:w,face:new THREE.Face3(m,p,n,THREE.Triangle.normal(d,e,f)),index:Math.floor(k/3),object:this}));else if(k instanceof THREE.Geometry)for(r=l instanceof THREE.MeshFaceMaterial,t=!0===r?l.materials:null,q=k.vertices,u=k.faces,v=0,x=u.length;vg.far||h.push({distance:H,point:w, -face:z,faceIndex:v,object:this}))}}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a}; +p,n;if(k instanceof THREE.BufferGeometry)if(m=k.attributes,void 0!==m.index){var q=m.index.array,r=m.position.array,s=k.offsets;0===s.length&&(s=[{start:0,count:q.length,index:0}]);for(var u=0,w=s.length;ug.far||h.push({distance:H,point:v,face:new THREE.Face3(m,p,n,THREE.Triangle.normal(d,e,f)),faceIndex:Math.floor(k/3),object:this})}}}}else for(r=m.position.array,q=k=0,z=r.length;kg.far||h.push({distance:H,point:v,face:new THREE.Face3(m,p,n,THREE.Triangle.normal(d,e,f)),index:Math.floor(k/3),object:this}));else if(k instanceof THREE.Geometry)for(q=l instanceof THREE.MeshFaceMaterial,r=!0===q?l.materials:null,s=k.vertices,u=k.faces,w=0,x=u.length;wg.far||h.push({distance:H,point:v, +face:z,faceIndex:w,object:this}))}}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a}; THREE.Mesh.prototype.toJSON=function(a){var b=THREE.Object3D.prototype.toJSON.call(this,a);void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON(a));void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON(a));b.object.geometry=this.geometry.uuid;b.object.material=this.material.uuid;return b};THREE.Bone=function(a){THREE.Object3D.call(this);this.type="Bone";this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype); THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.clone=function(a){void 0===a&&(a=new THREE.Bone(this.skin));THREE.Object3D.prototype.clone.call(this,a);a.skin=this.skin;return a}; THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=THREE.Math.nextPowerOfTwo(Math.sqrt(4*this.bones.length)),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),this.boneTexture.minFilter= @@ -486,94 +486,94 @@ tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.Sh THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",THREE.ShaderChunk.logdepthbuf_fragment, "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {", THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")}}; -THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===S&&(a*=d,b*=d,c*=d);s.clearColor(a,b,c,d)}function c(){O.init();s.viewport(Oa,za,Fa,Ga);b(aa.r,aa.g,aa.b,fa)}function d(){Ua=jb=null;qa="";Va=-1;cb=!0;O.reset()}function e(a){a=a.target;a.removeEventListener("dispose",e);a:{var b=Z.get(a);if(a.image&&b.__image__webglTextureCube)s.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;s.deleteTexture(b.__webglTexture)}Z.delete(a)}Aa.textures--}function f(a){var b=a.target; -b.removeEventListener("dispose",f);a=Z.get(b);if(b&&void 0!==a.__webglTexture){s.deleteTexture(a.__webglTexture);if(b instanceof THREE.WebGLRenderTargetCube)for(b=0;6>b;b++)s.deleteFramebuffer(a.__webglFramebuffer[b]),s.deleteRenderbuffer(a.__webglRenderbuffer[b]);else s.deleteFramebuffer(a.__webglFramebuffer),s.deleteRenderbuffer(a.__webglRenderbuffer);Z.delete(a)}Aa.textures--}function g(a){a=a.target;a.removeEventListener("dispose",g);h(a);Z.delete(a)}function h(a){var b=Z.get(a).program.program; -if(void 0!==b){a.program=void 0;a=0;for(var c=va.length;a!==c;++a){var d=va[a];if(d.program===b){0===--d.usedTimes&&(c-=1,va[a]=va[c],va.pop(),s.deleteProgram(b),Aa.programs=c);break}}}}function k(a,b,c,d){var e;if(c instanceof THREE.InstancedBufferGeometry&&(e=V.get("ANGLE_instanced_arrays"),null===e)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}var g=c.attributes;b=b.getAttributes(); -a=a.defaultAttributeValues;for(var f in b){var h=b[f];if(0<=h){var k=g[f];if(void 0!==k){var l=k.itemSize;O.enableAttribute(h);var n=ia.getAttributeBuffer(k);if(k instanceof THREE.InterleavedBufferAttribute){var m=k.data,p=m.stride,k=k.offset;s.bindBuffer(s.ARRAY_BUFFER,n);s.vertexAttribPointer(h,l,s.FLOAT,!1,p*m.array.BYTES_PER_ELEMENT,(d*p+k)*m.array.BYTES_PER_ELEMENT);if(m instanceof THREE.InstancedInterleavedBuffer){if(null===e){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays."); -return}e.vertexAttribDivisorANGLE(h,m.meshPerAttribute);void 0===c.maxInstancedCount&&(c.maxInstancedCount=m.meshPerAttribute*m.count)}}else if(s.bindBuffer(s.ARRAY_BUFFER,n),s.vertexAttribPointer(h,l,s.FLOAT,!1,0,d*l*4),k instanceof THREE.InstancedBufferAttribute){if(null===e){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");return}e.vertexAttribDivisorANGLE(h,k.meshPerAttribute);void 0=== -c.maxInstancedCount&&(c.maxInstancedCount=k.meshPerAttribute*k.count)}}else if(void 0!==a&&(l=a[f],void 0!==l))switch(l.length){case 2:s.vertexAttrib2fv(h,l);break;case 3:s.vertexAttrib3fv(h,l);break;case 4:s.vertexAttrib4fv(h,l);break;default:s.vertexAttrib1fv(h,l)}}}O.disableUnusedAttributes()}function l(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.object.material.id!==b.object.material.id?a.object.material.id-b.object.material.id:a.z!==b.z? -a.z-b.z:a.id-b.id}function m(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function p(a){if(!0===a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group))if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),ia.init(a),a instanceof THREE.Light)ea.push(a);else if(a instanceof THREE.Sprite)Ea.push(a);else if(a instanceof THREE.LensFlare)Na.push(a);else{var b=ia.objects[a.id];if(b&&(!1===a.frustumCulled||!0=== -Ha.intersectsObject(a))){var c=a.material;Z.get(c)&&(c.program=Z.get(c).program);c.transparent?pa.push(b):na.push(b);!0===ka.sortObjects&&(oa.setFromMatrixPosition(a.matrixWorld),oa.applyProjection(Pa),b.z=oa.z)}}b=0;for(c=a.children.length;bja;ja++)La[ja]=!ka.autoScaleCubemaps||Tb||Fb?Fb?ha.image[ja].image:ha.image[ja]:H(ha.image[ja],ac);var Ub=La[0],Vb=THREE.Math.isPowerOfTwo(Ub.width)&&THREE.Math.isPowerOfTwo(Ub.height),Ca=G(ha.format),Gb=G(ha.type);w(s.TEXTURE_CUBE_MAP,ha,Vb);for(ja=0;6>ja;ja++)if(Tb)for(var Ma,Wb=La[ja].mipmaps,$a=0,bc=Wb.length;$a=ab&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ab);db+=1;return a}function z(a,b,c,d){a[b+0]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function w(a,b,c){c?(s.texParameteri(a,s.TEXTURE_WRAP_S,G(b.wrapS)),s.texParameteri(a,s.TEXTURE_WRAP_T,G(b.wrapT)),s.texParameteri(a,s.TEXTURE_MAG_FILTER,G(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,G(b.minFilter))):(s.texParameteri(a,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(a,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE), -b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+b.sourceFile+" )"),s.texParameteri(a,s.TEXTURE_MAG_FILTER,y(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,y(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+ -b.sourceFile+" )"));(c=V.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&b.type!==THREE.HalfFloatType&&(1b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a, -0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a}function K(a,b,c){s.bindFramebuffer(s.FRAMEBUFFER,a);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,c,Z.get(b).__webglTexture,0)}function D(a,b){s.bindRenderbuffer(s.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT16,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER, -s.DEPTH_ATTACHMENT,s.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,a)):s.renderbufferStorage(s.RENDERBUFFER,s.RGBA4,b.width,b.height)}function y(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?s.NEAREST:s.LINEAR}function G(a){var b;if(a===THREE.RepeatWrapping)return s.REPEAT;if(a===THREE.ClampToEdgeWrapping)return s.CLAMP_TO_EDGE; -if(a===THREE.MirroredRepeatWrapping)return s.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return s.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return s.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return s.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return s.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return s.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return s.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return s.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return s.UNSIGNED_SHORT_4_4_4_4; -if(a===THREE.UnsignedShort5551Type)return s.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return s.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return s.BYTE;if(a===THREE.ShortType)return s.SHORT;if(a===THREE.UnsignedShortType)return s.UNSIGNED_SHORT;if(a===THREE.IntType)return s.INT;if(a===THREE.UnsignedIntType)return s.UNSIGNED_INT;if(a===THREE.FloatType)return s.FLOAT;b=V.get("OES_texture_half_float");if(null!==b&&a===THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return s.ALPHA; -if(a===THREE.RGBFormat)return s.RGB;if(a===THREE.RGBAFormat)return s.RGBA;if(a===THREE.LuminanceFormat)return s.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return s.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return s.FUNC_ADD;if(a===THREE.SubtractEquation)return s.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return s.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return s.ZERO;if(a===THREE.OneFactor)return s.ONE;if(a===THREE.SrcColorFactor)return s.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return s.ONE_MINUS_SRC_COLOR; -if(a===THREE.SrcAlphaFactor)return s.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return s.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return s.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return s.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return s.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return s.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return s.SRC_ALPHA_SATURATE;b=V.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT; -if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=V.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; -if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=V.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),A=void 0!==a.context?a.context:null,I=F.width,N=F.height,E=1,B=void 0!==a.precision?a.precision:"highp",C=void 0!==a.alpha?a.alpha:!1,M=void 0!==a.depth?a.depth:!0, -R=void 0!==a.stencil?a.stencil:!0,U=void 0!==a.antialias?a.antialias:!1,S=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,T=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,aa=new THREE.Color(0),fa=0,ea=[],na=[],pa=[],Ea=[],Na=[];this.domElement=F;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.maxMorphTargets= -8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var ka=this,va=[],jb=null,Da=null,Va=-1,qa="",Ua=null,db=0,Oa=0,za=0,Fa=F.width,Ga=F.height,bb=0,ib=0,Ha=new THREE.Frustum,Pa=new THREE.Matrix4,oa=new THREE.Vector3,ga=new THREE.Vector3,cb=!0,Mb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[], -groundColors:[],positions:[]}},Aa={programs:0,geometries:0,textures:0},Q={calls:0,vertices:0,faces:0,points:0};this.info={render:Q,memory:Aa,programs:va};var s;try{a={alpha:C,depth:M,stencil:R,antialias:U,premultipliedAlpha:S,preserveDrawingBuffer:T};s=A||F.getContext("webgl",a)||F.getContext("experimental-webgl",a);if(null===s){if(null!==F.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}F.addEventListener("webglcontextlost", -function(a){a.preventDefault();d();c();ia.clear();Z.clear()},!1)}catch(Hb){console.error("THREE.WebGLRenderer: "+Hb)}var O=new THREE.WebGLState(s,G);void 0===s.getShaderPrecisionFormat&&(s.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var Z=new THREE.WebGLProperties,ia=new THREE.WebGLObjects(s,Z,this.info),V=new THREE.WebGLExtensions(s);V.get("OES_texture_float");V.get("OES_texture_float_linear");V.get("OES_texture_half_float");V.get("OES_texture_half_float_linear"); -V.get("OES_standard_derivatives");V.get("ANGLE_instanced_arrays");V.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);L&&V.get("EXT_frag_depth");c();this.context=s;this.extensions=V;this.state=O;var ma=new THREE.WebGLShadowMap(this,ea,ia);this.shadowMap=ma;var ab=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),A=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Ib=s.getParameter(s.MAX_TEXTURE_SIZE),ac=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),lb=0h;h++)c.__webglFramebuffer[h]=s.createFramebuffer(),c.__webglRenderbuffer[h]=s.createRenderbuffer(),O.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,e,a.width,a.height,0,e,g,null),K(c.__webglFramebuffer[h],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+h),D(c.__webglRenderbuffer[h], -a);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),O.bindTexture(s.TEXTURE_2D,c.__webglTexture),w(s.TEXTURE_2D,a,d),O.texImage2D(s.TEXTURE_2D,0,e,a.width,a.height,0,e,g,null),K(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer): -a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):D(c.__webglRenderbuffer,a),a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);b?O.bindTexture(s.TEXTURE_CUBE_MAP,null):O.bindTexture(s.TEXTURE_2D,null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=Z.get(a),b=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Fa,a=Ga,d=Oa,e=za); -b!==Da&&(s.bindFramebuffer(s.FRAMEBUFFER,b),s.viewport(d,e,c,a),Da=b);bb=c;ib=a};this.readRenderTargetPixels=function(a,b,c,d,e,g){if(!(a instanceof THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(Z.get(a).__webglFramebuffer)if(a.format!==THREE.RGBAFormat)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");else{var f=!1;Z.get(a).__webglFramebuffer!== -Da&&(s.bindFramebuffer(s.FRAMEBUFFER,Z.get(a).__webglFramebuffer),f=!0);s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,c,d,e,s.RGBA,s.UNSIGNED_BYTE,g):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");f&&s.bindFramebuffer(s.FRAMEBUFFER,Da)}};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}; +THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===Q&&(a*=d,b*=d,c*=d);t.clearColor(a,b,c,d)}function c(){N.init();t.viewport(Ia,Ja,Ca,wa);b(aa.r,aa.g,aa.b,ea)}function d(){Wa=kb=null;xa="";Xa=-1;eb=!0;N.reset()}function e(a){a=a.target;a.removeEventListener("dispose",e);a:{var b=Z.get(a);if(a.image&&b.__image__webglTextureCube)t.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;t.deleteTexture(b.__webglTexture)}Z.delete(a)}Da.textures--}function f(a){var b=a.target; +b.removeEventListener("dispose",f);a=Z.get(b);if(b&&void 0!==a.__webglTexture){t.deleteTexture(a.__webglTexture);if(b instanceof THREE.WebGLRenderTargetCube)for(b=0;6>b;b++)t.deleteFramebuffer(a.__webglFramebuffer[b]),t.deleteRenderbuffer(a.__webglRenderbuffer[b]);else t.deleteFramebuffer(a.__webglFramebuffer),t.deleteRenderbuffer(a.__webglRenderbuffer);Z.delete(a)}Da.textures--}function g(a){a=a.target;a.removeEventListener("dispose",g);h(a);Z.delete(a)}function h(a){var b=Z.get(a).program.program; +if(void 0!==b){a.program=void 0;a=0;for(var c=va.length;a!==c;++a){var d=va[a];if(d.program===b){0===--d.usedTimes&&(c-=1,va[a]=va[c],va.pop(),t.deleteProgram(b),Da.programs=c);break}}}}function k(a,b,c,d){var e;if(c instanceof THREE.InstancedBufferGeometry&&(e=V.get("ANGLE_instanced_arrays"),null===e)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}var g=c.attributes;b=b.getAttributes(); +a=a.defaultAttributeValues;for(var f in b){var h=b[f];if(0<=h){var k=g[f];if(void 0!==k){var l=k.itemSize;N.enableAttribute(h);var n=pa.getAttributeBuffer(k);if(k instanceof THREE.InterleavedBufferAttribute){var m=k.data,p=m.stride,k=k.offset;t.bindBuffer(t.ARRAY_BUFFER,n);t.vertexAttribPointer(h,l,t.FLOAT,!1,p*m.array.BYTES_PER_ELEMENT,(d*p+k)*m.array.BYTES_PER_ELEMENT);if(m instanceof THREE.InstancedInterleavedBuffer){if(null===e){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays."); +return}e.vertexAttribDivisorANGLE(h,m.meshPerAttribute);void 0===c.maxInstancedCount&&(c.maxInstancedCount=m.meshPerAttribute*m.count)}}else if(t.bindBuffer(t.ARRAY_BUFFER,n),t.vertexAttribPointer(h,l,t.FLOAT,!1,0,d*l*4),k instanceof THREE.InstancedBufferAttribute){if(null===e){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");return}e.vertexAttribDivisorANGLE(h,k.meshPerAttribute);void 0=== +c.maxInstancedCount&&(c.maxInstancedCount=k.meshPerAttribute*k.count)}}else if(void 0!==a&&(l=a[f],void 0!==l))switch(l.length){case 2:t.vertexAttrib2fv(h,l);break;case 3:t.vertexAttrib3fv(h,l);break;case 4:t.vertexAttrib4fv(h,l);break;default:t.vertexAttrib1fv(h,l)}}}N.disableUnusedAttributes()}function l(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.object.material.id!==b.object.material.id?a.object.material.id-b.object.material.id:a.z!==b.z? +a.z-b.z:a.id-b.id}function m(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function p(a){if(!0===a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group))if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),pa.init(a),a instanceof THREE.Light)fa.push(a);else if(a instanceof THREE.Sprite)Ha.push(a);else if(a instanceof THREE.LensFlare)Qa.push(a);else if(a instanceof THREE.ImmediateRenderObject){var b=a.material; +b.transparent?Ga.push(a):Ba.push(a)}else{var c=pa.objects[a.id];!c||!1!==a.frustumCulled&&!0!==Ra.intersectsObject(a)||(b=a.material,Z.get(b)&&(b.program=Z.get(b).program),b.transparent?oa.push(c):la.push(c),!0===ja.sortObjects&&(na.setFromMatrixPosition(a.matrixWorld),na.applyProjection(Ka),c.z=na.z))}b=0;for(c=a.children.length;bia;ia++)Oa[ia]=!ja.autoScaleCubemaps||Tb||Fb?Fb?ha.image[ia].image:ha.image[ia]:H(ha.image[ia],ac);var Ub=Oa[0],Vb=THREE.Math.isPowerOfTwo(Ub.width)&&THREE.Math.isPowerOfTwo(Ub.height),Fa=F(ha.format), +Gb=F(ha.type);v(t.TEXTURE_CUBE_MAP,ha,Vb);for(ia=0;6>ia;ia++)if(Tb)for(var Pa,Wb=Oa[ia].mipmaps,bb=0,bc=Wb.length;bb=cb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+cb);fb+=1;return a}function z(a,b,c,d){a[b+0]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function v(a,b,c){c?(t.texParameteri(a,t.TEXTURE_WRAP_S,F(b.wrapS)),t.texParameteri(a,t.TEXTURE_WRAP_T,F(b.wrapT)), +t.texParameteri(a,t.TEXTURE_MAG_FILTER,F(b.magFilter)),t.texParameteri(a,t.TEXTURE_MIN_FILTER,F(b.minFilter))):(t.texParameteri(a,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(a,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+b.sourceFile+" )"),t.texParameteri(a,t.TEXTURE_MAG_FILTER,D(b.magFilter)), +t.texParameteri(a,t.TEXTURE_MIN_FILTER,D(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+b.sourceFile+" )"));(c=V.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&b.type!==THREE.HalfFloatType&&(1b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a}function I(a,b,c){t.bindFramebuffer(t.FRAMEBUFFER,a); +t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,c,Z.get(b).__webglTexture,0)}function y(a,b){t.bindRenderbuffer(t.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,b.width,b.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,b.width,b.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER, +a)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,b.width,b.height)}function D(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?t.NEAREST:t.LINEAR}function F(a){var b;if(a===THREE.RepeatWrapping)return t.REPEAT;if(a===THREE.ClampToEdgeWrapping)return t.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return t.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return t.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return t.NEAREST_MIPMAP_NEAREST; +if(a===THREE.NearestMipMapLinearFilter)return t.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return t.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return t.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return t.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return t.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return t.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return t.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return t.UNSIGNED_SHORT_5_6_5; +if(a===THREE.ByteType)return t.BYTE;if(a===THREE.ShortType)return t.SHORT;if(a===THREE.UnsignedShortType)return t.UNSIGNED_SHORT;if(a===THREE.IntType)return t.INT;if(a===THREE.UnsignedIntType)return t.UNSIGNED_INT;if(a===THREE.FloatType)return t.FLOAT;b=V.get("OES_texture_half_float");if(null!==b&&a===THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return t.ALPHA;if(a===THREE.RGBFormat)return t.RGB;if(a===THREE.RGBAFormat)return t.RGBA;if(a===THREE.LuminanceFormat)return t.LUMINANCE; +if(a===THREE.LuminanceAlphaFormat)return t.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return t.FUNC_ADD;if(a===THREE.SubtractEquation)return t.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return t.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return t.ZERO;if(a===THREE.OneFactor)return t.ONE;if(a===THREE.SrcColorFactor)return t.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return t.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return t.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return t.ONE_MINUS_SRC_ALPHA; +if(a===THREE.DstAlphaFactor)return t.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return t.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return t.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return t.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return t.SRC_ALPHA_SATURATE;b=V.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT; +if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=V.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=V.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT; +if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.context?a.context:null,S=B.width,G=B.height,A=1,E=void 0!==a.precision?a.precision:"highp",J=void 0!==a.alpha?a.alpha:!1,M=void 0!==a.depth?a.depth:!0,R=void 0!==a.stencil?a.stencil:!0,U=void 0!==a.antialias?a.antialias:!1,Q=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,T=void 0!==a.preserveDrawingBuffer? +a.preserveDrawingBuffer:!1,L=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,aa=new THREE.Color(0),ea=0,fa=[],la=[],oa=[],Ba=[],Ga=[],Ha=[],Qa=[];this.domElement=B;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var ja=this,va=[],kb=null,ua=null,Xa=-1,xa="",Wa=null,fb=0,Ia=0,Ja=0,Ca=B.width,wa= +B.height,db=0,jb=0,Ra=new THREE.Frustum,Ka=new THREE.Matrix4,na=new THREE.Vector3,ga=new THREE.Vector3,eb=!0,Mb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},Da={programs:0,geometries:0,textures:0},P={calls:0,vertices:0,faces:0,points:0};this.info={render:P,memory:Da, +programs:va};var t;try{a={alpha:J,depth:M,stencil:R,antialias:U,premultipliedAlpha:Q,preserveDrawingBuffer:T};t=C||B.getContext("webgl",a)||B.getContext("experimental-webgl",a);if(null===t){if(null!==B.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}B.addEventListener("webglcontextlost",function(a){a.preventDefault();d();c();pa.clear();Z.clear()},!1)}catch(Hb){console.error("THREE.WebGLRenderer: "+Hb)}var N=new THREE.WebGLState(t, +F);void 0===t.getShaderPrecisionFormat&&(t.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var Z=new THREE.WebGLProperties,pa=new THREE.WebGLObjects(t,Z,this.info),V=new THREE.WebGLExtensions(t);V.get("OES_texture_float");V.get("OES_texture_float_linear");V.get("OES_texture_half_float");V.get("OES_texture_half_float_linear");V.get("OES_standard_derivatives");V.get("ANGLE_instanced_arrays");V.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296); +L&&V.get("EXT_frag_depth");c();this.context=t;this.extensions=V;this.state=N;var ma=new THREE.WebGLShadowMap(this,fa,pa);this.shadowMap=ma;var cb=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),C=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Ib=t.getParameter(t.MAX_TEXTURE_SIZE),ac=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),mb=0h;h++)c.__webglFramebuffer[h]=t.createFramebuffer(),c.__webglRenderbuffer[h]=t.createRenderbuffer(),N.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,e,a.width,a.height,0,e,g,null),I(c.__webglFramebuffer[h],a,t.TEXTURE_CUBE_MAP_POSITIVE_X+h),y(c.__webglRenderbuffer[h], +a);a.generateMipmaps&&d&&t.generateMipmap(t.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=t.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:t.createRenderbuffer(),N.bindTexture(t.TEXTURE_2D,c.__webglTexture),v(t.TEXTURE_2D,a,d),N.texImage2D(t.TEXTURE_2D,0,e,a.width,a.height,0,e,g,null),I(c.__webglFramebuffer,a,t.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,c.__webglRenderbuffer): +a.depthBuffer&&a.stencilBuffer&&t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,c.__webglRenderbuffer):y(c.__webglRenderbuffer,a),a.generateMipmaps&&d&&t.generateMipmap(t.TEXTURE_2D);b?N.bindTexture(t.TEXTURE_CUBE_MAP,null):N.bindTexture(t.TEXTURE_2D,null);t.bindRenderbuffer(t.RENDERBUFFER,null);t.bindFramebuffer(t.FRAMEBUFFER,null)}a?(c=Z.get(a),b=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Ca,a=wa,d=Ia,e=Ja); +b!==ua&&(t.bindFramebuffer(t.FRAMEBUFFER,b),t.viewport(d,e,c,a),ua=b);db=c;jb=a};this.readRenderTargetPixels=function(a,b,c,d,e,g){if(!(a instanceof THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(Z.get(a).__webglFramebuffer)if(a.format!==THREE.RGBAFormat)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");else{var f=!1;Z.get(a).__webglFramebuffer!== +ua&&(t.bindFramebuffer(t.FRAMEBUFFER,Z.get(a).__webglFramebuffer),f=!0);t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE?t.readPixels(b,c,d,e,t.RGBA,t.UNSIGNED_BYTE,g):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");f&&t.bindFramebuffer(t.FRAMEBUFFER,ua)}};this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}; this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Object.defineProperties(this,{shadowMapEnabled:{get:function(){return ma.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");ma.enabled=a}},shadowMapType:{get:function(){return ma.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."); ma.type=a}},shadowMapCullFace:{get:function(){return ma.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");ma.cullFace=a}},shadowMapDebug:{get:function(){return ma.debug},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.");ma.debug=a}},shadowMapCascade:{get:function(){return ma.cascade},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCascade is now .shadowMap.cascade.");ma.cascade=a}}})}; THREE.WebGLRenderTarget=function(a,b,c){this.uuid=THREE.Math.generateUUID();this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1, @@ -583,79 +583,79 @@ this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this. THREE.WebGLExtensions=function(a){var b={};this.get=function(c){if(void 0!==b[c])return b[c];var d;switch(c){case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); break;case "WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:d=a.getExtension(c)}null===d&&console.warn("THREE.WebGLRenderer: "+c+" extension not supported.");return b[c]=d}}; THREE.WebGLGeometries=function(a,b){function c(e){e=e.target;var f=d[e.id],g;for(g in f.attributes){var h=f.attributes[g];void 0!==h.buffer&&(a.deleteBuffer(h.buffer),delete h.buffer)}e.removeEventListener("dispose",c);delete d[e.id];b.memory.geometries--}var d={};this.get=function(a){var f=a.geometry;if(void 0!==d[f.id])return d[f.id];f.addEventListener("dispose",c);d[f.id]=f instanceof THREE.BufferGeometry?f:(new THREE.BufferGeometry).setFromObject(a);b.memory.geometries++;return d[f.id]}}; -THREE.WebGLObjects=function(a,b,c){function d(a){a.target.traverse(function(a){a.removeEventListener("remove",d);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete f[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var c=g,e=c.length-1;0<=e;e--)c[e].object===a&&c.splice(e,1);delete a._modelViewMatrix;delete a._normalMatrix;b.delete(a)})}function e(a,b){return b[0]-a[0]}var f={},g=[],h=new Float32Array(8),k=new THREE.WebGLGeometries(a, -c);this.objects=f;this.objectsImmediate=g;this.geometries=k;this.init=function(a){var c=b.get(a);void 0===c.__webglInit&&(c.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",d));void 0===c.__webglActive&&(c.__webglActive=!0,a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.PointCloud?f[a.id]={id:a.id,object:a,z:0}:(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&g.push({id:null,object:a,opaque:null, -transparent:null,z:0}))};this.getAttributeBuffer=function(a){return a instanceof THREE.InterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer};this.update=function(c){for(var d=0,g=c.length;dM;M++)C[M]=new THREE.Vector3,A[M]=new THREE.Vector3;C=B.shadowCascadeNearZ[I];B=B.shadowCascadeFarZ[I];A[0].set(-1,-1,C);A[1].set(1,-1,C);A[2].set(-1,1,C);A[3].set(1,1,C);A[4].set(-1,-1,B);A[5].set(1,-1,B);A[6].set(-1,1,B);A[7].set(1,1,B);E.originalCamera=r;A= -new THREE.Gyroscope;A.position.copy(y.shadowCascadeOffset);A.add(E);A.add(E.target);r.add(A);y.shadowCascadeArray[F]=E}I=y;C=F;B=I.shadowCascadeArray[C];B.position.copy(I.position);B.target.position.copy(I.target.position);B.lookAt(B.target);B.shadowCameraVisible=I.shadowCameraVisible;B.shadowDarkness=I.shadowDarkness;B.shadowBias=I.shadowCascadeBias[C];A=I.shadowCascadeNearZ[C];I=I.shadowCascadeFarZ[C];B=B.pointsFrustum;B[0].z=A;B[1].z=A;B[2].z=A;B[3].z=A;B[4].z=I;B[5].z=I;B[6].z=I;B[7].z=I;N[G]= -E;G++}else N[G]=y,G++;t=0;for(D=N.length;tJ;J++)E[J]=new THREE.Vector3,B[J]=new THREE.Vector3;E=A.shadowCascadeNearZ[C];A=A.shadowCascadeFarZ[C];B[0].set(-1,-1,E);B[1].set(1,-1,E);B[2].set(-1,1,E);B[3].set(1,1,E);B[4].set(-1,-1,A);B[5].set(1,-1,A);B[6].set(-1,1,A);B[7].set(1,1,A);G.originalCamera=n;B= +new THREE.Gyroscope;B.position.copy(y.shadowCascadeOffset);B.add(G);B.add(G.target);n.add(B);y.shadowCascadeArray[F]=G}C=y;E=F;A=C.shadowCascadeArray[E];A.position.copy(C.position);A.target.position.copy(C.target.position);A.lookAt(A.target);A.shadowCameraVisible=C.shadowCameraVisible;A.shadowDarkness=C.shadowDarkness;A.shadowBias=C.shadowCascadeBias[E];B=C.shadowCascadeNearZ[E];C=C.shadowCascadeFarZ[E];A=A.pointsFrustum;A[0].z=B;A[1].z=B;A[2].z=B;A[3].z=B;A[4].z=C;A[5].z=C;A[6].z=C;A[7].z=C;S[D]= +G;D++}else S[D]=y,D++;q=0;for(I=S.length;qI;I++)C=B[I],C.copy(A[I]),C.unproject(F),C.applyMatrix4(G.matrixWorldInverse),C.xl.x&&(l.x=C.x),C.yl.y&&(l.y=C.y),C.zl.z&&(l.z=C.z);G.left=k.x;G.right=l.x;G.top=l.y;G.bottom=k.y;G.updateProjectionMatrix()}G=y.shadowMap;A=y.shadowMatrix;F=y.shadowCamera; -F.position.setFromMatrixPosition(y.matrixWorld);p.setFromMatrixPosition(y.target.matrixWorld);F.lookAt(p);F.updateMatrixWorld();F.matrixWorldInverse.getInverse(F.matrixWorld);y.cameraHelper&&(y.cameraHelper.visible=y.shadowCameraVisible);y.shadowCameraVisible&&y.cameraHelper.update();A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);A.multiply(F.projectionMatrix);A.multiply(F.matrixWorldInverse);h.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse);g.setFromMatrix(h);a.setRenderTarget(G);a.clear(); -n.length=0;d(c,F);y=0;for(G=n.length;yC;C++)E=A[C],E.copy(B[C]),E.unproject(F),E.applyMatrix4(D.matrixWorldInverse),E.xl.x&&(l.x=E.x),E.yl.y&&(l.y=E.y),E.zl.z&&(l.z=E.z);D.left=k.x;D.right=l.x;D.top=l.y;D.bottom=k.y;D.updateProjectionMatrix()}D=y.shadowMap;B=y.shadowMatrix;F=y.shadowCamera; +F.position.setFromMatrixPosition(y.matrixWorld);m.setFromMatrixPosition(y.target.matrixWorld);F.lookAt(m);F.updateMatrixWorld();F.matrixWorldInverse.getInverse(F.matrixWorld);y.cameraHelper&&(y.cameraHelper.visible=y.shadowCameraVisible);y.shadowCameraVisible&&y.cameraHelper.update();B.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);B.multiply(F.projectionMatrix);B.multiply(F.matrixWorldInverse);h.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse);g.setFromMatrix(h);a.setRenderTarget(D);a.clear(); +p.length=0;d(c,F);y=0;for(D=p.length;y 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); -w.compileShader(C);w.compileShader(M);w.attachShader(B,C);w.attachShader(B,M);w.linkProgram(B);y=B;v=w.getAttribLocation(y,"position");x=w.getAttribLocation(y,"uv");c=w.getUniformLocation(y,"uvOffset");d=w.getUniformLocation(y,"uvScale");e=w.getUniformLocation(y,"rotation");f=w.getUniformLocation(y,"scale");g=w.getUniformLocation(y,"color");h=w.getUniformLocation(y,"map");k=w.getUniformLocation(y,"opacity");l=w.getUniformLocation(y,"modelViewMatrix");m=w.getUniformLocation(y,"projectionMatrix");p= -w.getUniformLocation(y,"fogType");n=w.getUniformLocation(y,"fogDensity");r=w.getUniformLocation(y,"fogNear");t=w.getUniformLocation(y,"fogFar");q=w.getUniformLocation(y,"fogColor");u=w.getUniformLocation(y,"alphaTest");B=document.createElement("canvas");B.width=8;B.height=8;C=B.getContext("2d");C.fillStyle="white";C.fillRect(0,0,8,8);G=new THREE.Texture(B);G.needsUpdate=!0}w.useProgram(y);H.initAttributes();H.enableAttribute(v);H.enableAttribute(x);H.disableUnusedAttributes();H.disable(w.CULL_FACE); -H.enable(w.BLEND);w.bindBuffer(w.ARRAY_BUFFER,K);w.vertexAttribPointer(v,2,w.FLOAT,!1,16,0);w.vertexAttribPointer(x,2,w.FLOAT,!1,16,8);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,D);w.uniformMatrix4fv(m,!1,E.projectionMatrix.elements);H.activeTexture(w.TEXTURE0);w.uniform1i(h,0);C=B=0;(M=N.fog)?(w.uniform3f(q,M.color.r,M.color.g,M.color.b),M instanceof THREE.Fog?(w.uniform1f(r,M.near),w.uniform1f(t,M.far),w.uniform1i(p,1),C=B=1):M instanceof THREE.FogExp2&&(w.uniform1f(n,M.density),w.uniform1i(p,2),C=B=2)): -(w.uniform1i(p,0),C=B=0);for(var M=0,R=b.length;M 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); +v.compileShader(J);v.compileShader(M);v.attachShader(E,J);v.attachShader(E,M);v.linkProgram(E);D=E;w=v.getAttribLocation(D,"position");x=v.getAttribLocation(D,"uv");c=v.getUniformLocation(D,"uvOffset");d=v.getUniformLocation(D,"uvScale");e=v.getUniformLocation(D,"rotation");f=v.getUniformLocation(D,"scale");g=v.getUniformLocation(D,"color");h=v.getUniformLocation(D,"map");k=v.getUniformLocation(D,"opacity");l=v.getUniformLocation(D,"modelViewMatrix");m=v.getUniformLocation(D,"projectionMatrix");p= +v.getUniformLocation(D,"fogType");n=v.getUniformLocation(D,"fogDensity");q=v.getUniformLocation(D,"fogNear");r=v.getUniformLocation(D,"fogFar");s=v.getUniformLocation(D,"fogColor");u=v.getUniformLocation(D,"alphaTest");E=document.createElement("canvas");E.width=8;E.height=8;J=E.getContext("2d");J.fillStyle="white";J.fillRect(0,0,8,8);F=new THREE.Texture(E);F.needsUpdate=!0}v.useProgram(D);H.initAttributes();H.enableAttribute(w);H.enableAttribute(x);H.disableUnusedAttributes();H.disable(v.CULL_FACE); +H.enable(v.BLEND);v.bindBuffer(v.ARRAY_BUFFER,I);v.vertexAttribPointer(w,2,v.FLOAT,!1,16,0);v.vertexAttribPointer(x,2,v.FLOAT,!1,16,8);v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,y);v.uniformMatrix4fv(m,!1,A.projectionMatrix.elements);H.activeTexture(v.TEXTURE0);v.uniform1i(h,0);J=E=0;(M=G.fog)?(v.uniform3f(s,M.color.r,M.color.g,M.color.b),M instanceof THREE.Fog?(v.uniform1f(q,M.near),v.uniform1f(r,M.far),v.uniform1i(p,1),J=E=1):M instanceof THREE.FogExp2&&(v.uniform1f(n,M.density),v.uniform1i(p,2),J=E=2)): +(v.uniform1i(p,0),J=E=0);for(var M=0,R=b.length;Mp-1?0:p-1,r=p+1>e-1?e-1:p+1,t=0>m-1?0:m-1,q=m+1>d-1?d-1:m+1,u=[],v=[0,0,h[4*(p*d+m)]/255*b];u.push([-1,0,h[4*(p*d+t)]/255*b]);u.push([-1,-1,h[4*(n*d+t)]/255*b]);u.push([0,-1,h[4*(n*d+m)]/255*b]);u.push([1,-1,h[4*(n*d+q)]/255*b]);u.push([1,0,h[4*(p*d+q)]/255*b]);u.push([1,1,h[4*(r*d+q)]/255*b]);u.push([0,1,h[4*(r*d+m)]/255* -b]);u.push([-1,1,h[4*(r*d+t)]/255*b]);n=[];t=u.length;for(r=0;rp-1?0:p-1,q=p+1>e-1?e-1:p+1,r=0>m-1?0:m-1,s=m+1>d-1?d-1:m+1,u=[],w=[0,0,h[4*(p*d+m)]/255*b];u.push([-1,0,h[4*(p*d+r)]/255*b]);u.push([-1,-1,h[4*(n*d+r)]/255*b]);u.push([0,-1,h[4*(n*d+m)]/255*b]);u.push([1,-1,h[4*(n*d+s)]/255*b]);u.push([1,0,h[4*(p*d+s)]/255*b]);u.push([1,1,h[4*(q*d+s)]/255*b]);u.push([0,1,h[4*(q*d+m)]/255* +b]);u.push([-1,1,h[4*(q*d+r)]/255*b]);n=[];r=u.length;for(q=0;qe)return null;var f=[],g=[],h=[],k,l,m;if(0=p--){console.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);m=l+1;e<=m&&(m=0);var n;a:{var r=n=void 0,t=void 0,q=void 0, -u=void 0,v=void 0,x=void 0,z=void 0,w=void 0,r=a[g[k]].x,t=a[g[k]].y,q=a[g[l]].x,u=a[g[l]].y,v=a[g[m]].x,x=a[g[m]].y;if(1E-10>(q-r)*(x-t)-(u-t)*(v-r))n=!1;else{var H=void 0,K=void 0,D=void 0,y=void 0,G=void 0,F=void 0,A=void 0,I=void 0,N=void 0,E=void 0,N=I=A=w=z=void 0,H=v-q,K=x-u,D=r-v,y=t-x,G=q-r,F=u-t;for(n=0;ne)return null;var f=[],g=[],h=[],k,l,m;if(0=p--){console.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);m=l+1;e<=m&&(m=0);var n;a:{var q=n=void 0,r=void 0,s=void 0, +u=void 0,w=void 0,x=void 0,z=void 0,v=void 0,q=a[g[k]].x,r=a[g[k]].y,s=a[g[l]].x,u=a[g[l]].y,w=a[g[m]].x,x=a[g[m]].y;if(1E-10>(s-q)*(x-r)-(u-r)*(w-q))n=!1;else{var H=void 0,I=void 0,y=void 0,D=void 0,F=void 0,B=void 0,C=void 0,S=void 0,G=void 0,A=void 0,G=S=C=v=z=void 0,H=w-s,I=x-u,y=q-w,D=r-x,F=s-q,B=u-r;for(n=0;nMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; +THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,f,g,h,k,l,m,p,n,q,r,s;d=0;for(e=this.actions.length;dMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;cl&&(f=b[g],k=-k,h=b[e],l=-l),!(a.yh.y))if(a.y===f.y){if(a.x===f.x)return!0}else{e=l*(a.x-f.x)-k*(a.y-f.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===f.y&&(h.x<=a.x&&a.x<=f.x||f.x<=a.x&& -a.x<=h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;by||y>D)return[];k=l*m-k*p;if(0>k||k>D)return[]}else{if(0d?[]: +THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!==b.x?a.xD||D>y)return[];k=l*m-k*p;if(0>k||k>y)return[]}else{if(0d?[]: k===d?g?[]:[f]:a<=d?[f,h]:[f,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10f&&(f=d);var g=a+1;g>d&&(g= -0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;cE){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(p=F;pf&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;cA){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(p=B;ph;h++)l=k[h].x+":"+k[h].y,l=m[l],void 0!==l&&(k[h]=l);return p.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1- a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)}; THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; @@ -723,12 +723,12 @@ THREE.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function( for(b=0;bc;c++){for(var d=this.keyTypes[c],e=this.data.hierarchy[a].keys[0],g=this.getNextKeyWith(d,a,1);g.timee.index;)e=g,g=this.getNextKeyWith(d,a,g.index+1);f.prevKey[d]=e;f.nextKey[d]=g}}},resetBlendWeights:function(){for(var a=0,b=this.hierarchy.length;aa.length-2?p:p+1;c[3]=p>a.length-3?p:p+2;p=a[c[0]];r=a[c[1]];t=a[c[2]];q=a[c[3]];c=e*e;n=e*c;d[0]=f(p[0],r[0],t[0],q[0],e,c,n);d[1]=f(p[1],r[1],t[1],q[1],e,c,n);d[2]=f(p[2],r[2],t[2],q[2],e,c,n);return d},f=function(a,b,c,d, +c&&(c=c.blending,c.positionWeight=0,c.quaternionWeight=0,c.scaleWeight=0)}},update:function(){var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,p,n,q,r,s;e=(a.length-1)*b;p=Math.floor(e);e-=p;c[0]=0===p?p:p-1;c[1]=p;c[2]=p>a.length-2?p:p+1;c[3]=p>a.length-3?p:p+2;p=a[c[0]];q=a[c[1]];r=a[c[2]];s=a[c[3]];c=e*e;n=e*c;d[0]=f(p[0],q[0],r[0],s[0],e,c,n);d[1]=f(p[1],q[1],r[1],s[1],e,c,n);d[2]=f(p[2],q[2],r[2],s[2],e,c,n);return d},f=function(a,b,c,d, e,f,n){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*n+(-3*(b-c)-2*a-d)*f+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){f=this.data.length;if(this.currentTime>f||0>this.currentTime)this.loop?(this.currentTime%=f,0>this.currentTime&&(this.currentTime+=f),this.reset()):this.stop();f=0;for(var h=this.hierarchy.length;fp;p++){var n=this.keyTypes[p], -r=l.prevKey[n],t=l.nextKey[n];if(0this.timeScale&&r.time>=this.currentTime){r=this.data.hierarchy[f].keys[0];for(t=this.getNextKeyWith(n,f,1);t.timer.index;)r=t,t=this.getNextKeyWith(n,f,t.index+1);l.prevKey[n]=r;l.nextKey[n]=t}var q=(this.currentTime-r.time)/(t.time-r.time),u=r[n],v=t[n];0>q&&(q=0);1this.timeScale&&q.time>=this.currentTime){q=this.data.hierarchy[f].keys[0];for(r=this.getNextKeyWith(n,f,1);r.timeq.index;)q=r,r=this.getNextKeyWith(n,f,r.index+1);l.prevKey[n]=q;l.nextKey[n]=r}var s=(this.currentTime-q.time)/(r.time-q.time),u=q[n],w=r[n];0>s&&(s=0);1this.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);a=this.duration/this.frames;var b=Math.floor(this.currentTime/a),c=this.mesh.morphTargetInfluences;b!==this.currentFrame&&(c[this.lastFrame]=0,c[this.currentFrame]= 1,c[b]=0,this.lastFrame=this.currentFrame,this.currentFrame=b);c[b]=this.currentTime%a/a;c[this.lastFrame]=1-c[b]}}}; -THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g){var q,u=h.widthSegments,v=h.heightSegments,x=e/2,z=f/2,w=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",v=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",u=h.depthSegments;var H=u+1,K=v+1,D=e/u,y=f/v,G=new THREE.Vector3;G[q]=0n;n++){d[0]=p[g[n]];d[1]=p[g[(n+1)%3]];d.sort(f);var r=d.toString();void 0===e[r]?e[r]={vert1:d[0],vert2:d[1],face1:l, -face2:void 0}:e[r].face2=l}d=[];for(r in e)if(f=e[r],void 0===f.face2||h[f.face1].normal.dot(h[f.face2].normal)<=c)g=k[f.vert1],d.push(g.x),d.push(g.y),d.push(g.z),g=k[f.vert2],d.push(g.x),d.push(g.y),d.push(g.z);this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(d),3))};THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry; +THREE.CylinderGeometry=function(a,b,c,d,e,f,g,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;h=void 0!==h?h:2*Math.PI;var k=c/2,l,m,p=[],n=[];for(m=0;m<=e;m++){var q=[],r=[],s=m/e,u=s*(b-a)+a;for(l=0;l<=d;l++){var w=l/d,x=new THREE.Vector3;x.x=u*Math.sin(w*h+ +g);x.y=-s*c+k;x.z=u*Math.cos(w*h+g);this.vertices.push(x);q.push(this.vertices.length-1);r.push(new THREE.Vector2(w,1-s))}p.push(q);n.push(r)}c=(b-a)/c;for(l=0;ln;n++){d[0]=p[g[n]];d[1]=p[g[(n+1)%3]];d.sort(f);var q=d.toString();void 0===e[q]?e[q]={vert1:d[0],vert2:d[1],face1:l, +face2:void 0}:e[q].face2=l}d=[];for(q in e)if(f=e[q],void 0===f.face2||h[f.face1].normal.dot(h[f.face2].normal)<=c)g=k[f.vert1],d.push(g.x),d.push(g.y),d.push(g.z),g=k[f.vert2],d.push(g.x),d.push(g.y),d.push(g.z);this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(d),3))};THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry; THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10d?-1E-10>f&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(L=a.length;0<=--L;){c=L;d=L-1;0>d&&(d=a.length-1);for(var e=0,f=r+2*m,e=0;ed?-1E-10>f&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(L=a.length;0<=--L;){c=L;d=L-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*m,e=0;eMath.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y, 1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===Array.isArray(a)&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;cc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+.5,a.y)); -return a.clone()}THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,l=0,m=a.length;lr&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>p&&(b[2].x+=1));l=0;for(m=this.vertices.length;lq&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>p&&(b[2].x+=1));l=0;for(m=this.vertices.length;lp;p++){b[0]=m[e[p]];b[1]=m[e[(p+1)%3]];b.sort(d);var n=b.toString();void 0===c[n]&&(k[2*h]=b[0],k[2*h+1]=b[1],c[n]=!0,h++)}b=new Float32Array(6*h);a=0;for(l=h;ap;p++)h=f[k[2*a+p]],e=6*a+3*p,b[e+0]=h.x,b[e+1]=h.y, -b[e+2]=h.z;this.addAttribute("position",new THREE.BufferAttribute(b,3))}else if(a instanceof THREE.BufferGeometry){if(void 0!==a.attributes.index){f=a.attributes.position;l=a.attributes.index.array;g=a.drawcalls;h=0;0===g.length&&(g=[{count:l.length,index:0,start:0}]);for(var k=new Uint32Array(2*l.length),m=0,r=g.length;mp;p++)b[0]=e+l[a+p],b[1]=e+l[a+(p+1)%3],b.sort(d),n=b.toString(),void 0===c[n]&&(k[2*h]=b[0],k[2* +b[e+2]=h.z;this.addAttribute("position",new THREE.BufferAttribute(b,3))}else if(a instanceof THREE.BufferGeometry){if(void 0!==a.attributes.index){f=a.attributes.position;l=a.attributes.index.array;g=a.drawcalls;h=0;0===g.length&&(g=[{count:l.length,index:0,start:0}]);for(var k=new Uint32Array(2*l.length),m=0,q=g.length;mp;p++)b[0]=e+l[a+p],b[1]=e+l[a+(p+1)%3],b.sort(d),n=b.toString(),void 0===c[n]&&(k[2*h]=b[0],k[2* h+1]=b[1],c[n]=!0,h++)}b=new Float32Array(6*h);a=0;for(l=h;ap;p++)e=6*a+3*p,h=k[2*a+p],b[e+0]=f.getX(h),b[e+1]=f.getY(h),b[e+2]=f.getZ(h)}else for(f=a.attributes.position.array,h=f.length/3,k=h/3,b=new Float32Array(6*h),a=0,l=k;ap;p++)e=18*a+6*p,k=9*a+3*p,b[e+0]=f[k],b[e+1]=f[k+1],b[e+2]=f[k+2],h=9*a+(p+1)%3*3,b[e+3]=f[h],b[e+4]=f[h+1],b[e+5]=f[h+2];this.addAttribute("position",new THREE.BufferAttribute(b,3))}};THREE.WireframeGeometry.prototype=Object.create(THREE.BufferGeometry.prototype); THREE.WireframeGeometry.prototype.constructor=THREE.WireframeGeometry;THREE.AxisHelper=function(a){a=a||1;var b=new Float32Array([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a]),c=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);a=new THREE.BufferGeometry;a.addAttribute("position",new THREE.BufferAttribute(b,3));a.addAttribute("color",new THREE.BufferAttribute(c,3));b=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.LineSegments.call(this,a,b)};THREE.AxisHelper.prototype=Object.create(THREE.LineSegments.prototype); THREE.AxisHelper.prototype.constructor=THREE.AxisHelper; @@ -846,12 +846,12 @@ THREE.SpotLightHelper.prototype.constructor=THREE.SpotLightHelper;THREE.SpotLigh THREE.SpotLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){var c=this.light.distance?this.light.distance:1E4,d=c*Math.tan(this.light.angle);this.cone.scale.set(d,d,c);a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(b.sub(a));this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(); THREE.VertexNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16711680;d=void 0!==d?d:1;b=0;c=this.object.geometry;c instanceof THREE.Geometry?b=3*c.faces.length:c instanceof THREE.BufferGeometry&&(b=c.attributes.normal.count);c=new THREE.BufferGeometry;b=new THREE.Float32Attribute(6*b,3);c.addAttribute("position",b);THREE.LineSegments.call(this,c,new THREE.LineBasicMaterial({color:a,linewidth:d}));this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()}; THREE.VertexNormalsHelper.prototype=Object.create(THREE.LineSegments.prototype);THREE.VertexNormalsHelper.prototype.constructor=THREE.VertexNormalsHelper; -THREE.VertexNormalsHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){var c=["a","b","c"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);var d=this.object.matrixWorld,e=this.geometry.attributes.position,f=this.object.geometry;if(f instanceof THREE.Geometry)for(var g=f.vertices,h=f.faces,k=f=0,l=h.length;k