|
@@ -7,12 +7,13 @@ THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THRE
|
|
|
THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;
|
|
|
THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;
|
|
|
THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.Color=function(a){void 0!==a&&this.set(a);return this};
|
|
|
-THREE.extend(THREE.Color.prototype,{r:1,g:1,b:1,set:function(a){switch(typeof a){case "number":this.setHex(a);break;case "string":this.setStyle(a)}},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;0===c?this.r=this.g=this.b=0:(d=Math.floor(6*a),e=6*a-d,a=c*(1-b),f=c*(1-b*e),b=c*(1-b*(1-e)),0===d?(this.r=c,this.g=b,this.b=a):1===d?(this.r=f,
|
|
|
-this.g=c,this.b=a):2===d?(this.r=a,this.g=c,this.b=b):3===d?(this.r=a,this.g=f,this.b=c):4===d?(this.r=b,this.g=a,this.b=c):5===d&&(this.r=c,this.g=a,this.b=f));return this},setStyle:function(a){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(a))return a=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(a))return a=/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(a),
|
|
|
-this.r=Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},copy:function(a){this.r=a.r;
|
|
|
-this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return 255*this.r<<16^
|
|
|
-255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},getHSV:function(a){var b=this.r,c=this.g,d=this.b,e=Math.max(Math.max(b,c),d),f=Math.min(Math.min(b,c),d);if(f===e)f=b=0;else{var g=e-f,f=g/e,b=(b===e?(c-d)/g:c===e?2+(d-b)/g:4+(b-c)/g)/6;0>b&&(b+=1);1<b&&(b-=1)}void 0===a&&(a={h:0,s:0,v:0});a.h=b;a.s=f;a.v=e;return a},add:function(a){this.r+=a.r;this.g+=
|
|
|
-a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerp:function(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}});
|
|
|
+THREE.extend(THREE.Color.prototype,{r:1,g:1,b:1,set:function(a){switch(typeof a){case "number":this.setHex(a);break;case "string":this.setStyle(a)}},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){console.log("DEPRECATED: Color's .setHSV() will be removed. Use .setHSL( h, s, l ) instead.");return this.setHSL(a,b*c/(1>(a=(2-b)*c)?a:2-a),a/2)},setHSL:function(a,
|
|
|
+b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*c:0.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a},b=0.5>=c?c*(1+b):c+b-c*b,c=2*c-b;this.r=d(c,b,a+1/3);this.g=d(c,b,a);this.b=d(c,b,a-1/3)}return this},setStyle:function(a){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(a))return a=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(a))return a=
|
|
|
+/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(a),this.r=Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),
|
|
|
+this},copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return 255*
|
|
|
+this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},getHSL:function(){var a={h:0,s:0,l:0};return function(){var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var i=e-f,f=0.5>=h?i/(e+f):i/(2-e-f);switch(e){case b:g=(c-d)/i+(c<d?6:0);break;case c:g=(d-b)/i+2;break;case d:g=(b-c)/i+4}g/=6}a.h=g;a.s=
|
|
|
+f;a.l=h;return a}}(),offsetHSL:function(a,b,c){var d=this.getHSL();d.h+=a;d.s+=b;d.l+=c;this.setHSL(d.h,d.s,d.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerp:function(a,b){this.r+=
|
|
|
+(a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}});
|
|
|
THREE.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,
|
|
|
darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,
|
|
|
grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,
|
|
@@ -341,35 +342,35 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
|
|
|
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
|
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
|
|
|
depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a){if(a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer)}function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?
|
|
|
-g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}function d(a,b){var c=b.geometry,d=a.faces3,h=a.faces4,i=3*d.length+4*h.length,k=1*d.length+2*h.length,h=3*d.length+4*h.length,d=e(b,a),l=g(d),m=f(d),n=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);m&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));n&&
|
|
|
-(a.__colorArray=new Float32Array(3*i));if(l){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*i);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*i)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*i),a.__skinWeightArray=new Float32Array(4*i));a.__faceArray=new Uint16Array(3*k);a.__lineArray=new Uint16Array(2*h);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(l=a.numMorphTargets;c<
|
|
|
-l;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(l=a.numMorphNormals;c<l;c++)a.__morphNormalsArrays.push(new Float32Array(3*i))}a.__webglFaceCount=3*k;a.__webglLineCount=2*h;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in d.attributes){var k=d.attributes[p],c={},q;for(q in k)c[q]=k[q];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,h=1,"v2"===c.type?h=2:
|
|
|
-"v3"===c.type?h=3:"v4"===c.type?h=4:"c"===c.type&&(h=3),c.size=h,c.array=new Float32Array(i*h),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(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 g(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){var b,c,d;for(b in a.attributes)d="index"===b?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,c=a.attributes[b],c.buffer=j.createBuffer(),j.bindBuffer(d,c.buffer),j.bufferData(d,c.array,j.STATIC_DRAW)}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;a.elementsNeedUpdate&&
|
|
|
-void 0!==e&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(j.bindBuffer(j.ARRAY_BUFFER,g.buffer),j.bufferData(j.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==h&&(j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.colorsNeedUpdate&&void 0!==i&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){qa[a]||(j.enableVertexAttribArray(a),qa[a]=!0)}function l(){for(var a in qa)qa[a]&&(j.disableVertexAttribArray(a),qa[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function m(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ga=
|
|
|
-mb=null,ta=Ma=ha=X=ia=$a=ra=-1,ab=!0,a[d].render(b,c,mc,qb),ga=mb=null,ta=Ma=ha=X=ia=$a=ra=-1,ab=!0}function r(a,b,c,d,e,f,g,j){var h,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(h=a[m],h.render){i=h.object;k=h.buffer;if(j)h=j;else{h=h[c];if(!h)continue;g&&L.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);L.setDepthTest(h.depthTest);L.setDepthWrite(h.depthWrite);H(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}L.setMaterialFaces(h);k instanceof
|
|
|
-THREE.BufferGeometry?L.renderBufferDirect(d,e,f,h,k,i):L.renderBuffer(d,e,f,h,k,i)}}function p(a,b,c,d,e,f,g){for(var j,h,i=0,k=a.length;i<k;i++)if(j=a[i],h=j.object,h.visible){if(g)j=g;else{j=j[b];if(!j)continue;f&&L.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);L.setDepthTest(j.depthTest);L.setDepthWrite(j.depthWrite);H(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,j,h)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
+g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}function d(a,b){var c=b.geometry,d=a.faces3,i=a.faces4,h=3*d.length+4*i.length,k=1*d.length+2*i.length,i=3*d.length+4*i.length,d=e(b,a),l=g(d),m=f(d),n=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*h);m&&(a.__normalArray=new Float32Array(3*h));c.hasTangents&&(a.__tangentArray=new Float32Array(4*h));n&&
|
|
|
+(a.__colorArray=new Float32Array(3*h));if(l){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*h);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*h)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*h),a.__skinWeightArray=new Float32Array(4*h));a.__faceArray=new Uint16Array(3*k);a.__lineArray=new Uint16Array(2*i);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(l=a.numMorphTargets;c<
|
|
|
+l;c++)a.__morphTargetsArrays.push(new Float32Array(3*h))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(l=a.numMorphNormals;c<l;c++)a.__morphNormalsArrays.push(new Float32Array(3*h))}a.__webglFaceCount=3*k;a.__webglLineCount=2*i;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in d.attributes){var k=d.attributes[p],c={},q;for(q in k)c[q]=k[q];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,i=1,"v2"===c.type?i=2:
|
|
|
+"v3"===c.type?i=3:"v4"===c.type?i=4:"c"===c.type&&(i=3),c.size=i,c.array=new Float32Array(h*i),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(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 g(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){var b,c,d;for(b in a.attributes)d="index"===b?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,c=a.attributes[b],c.buffer=j.createBuffer(),j.bindBuffer(d,c.buffer),j.bufferData(d,c.array,j.STATIC_DRAW)}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,i=d.uv,h=d.color,d=d.tangent;a.elementsNeedUpdate&&
|
|
|
+void 0!==e&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(j.bindBuffer(j.ARRAY_BUFFER,g.buffer),j.bufferData(j.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==i&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.colorsNeedUpdate&&void 0!==h&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){qa[a]||(j.enableVertexAttribArray(a),qa[a]=!0)}function l(){for(var a in qa)qa[a]&&(j.disableVertexAttribArray(a),qa[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function m(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ga=
|
|
|
+mb=null,ta=Ma=ha=X=ia=$a=ra=-1,ab=!0,a[d].render(b,c,mc,qb),ga=mb=null,ta=Ma=ha=X=ia=$a=ra=-1,ab=!0}function r(a,b,c,d,e,f,g,j){var i,h,k,l;b?(h=a.length-1,l=b=-1):(h=0,b=a.length,l=1);for(var m=h;m!==b;m+=l)if(i=a[m],i.render){h=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;g&&L.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);L.setDepthTest(i.depthTest);L.setDepthWrite(i.depthWrite);H(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}L.setMaterialFaces(i);k instanceof
|
|
|
+THREE.BufferGeometry?L.renderBufferDirect(d,e,f,i,k,h):L.renderBuffer(d,e,f,i,k,h)}}function p(a,b,c,d,e,f,g){for(var i,j,h=0,k=a.length;h<k;h++)if(i=a[h],j=i.object,j.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&L.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);L.setDepthTest(i.depthTest);L.setDepthWrite(i.depthWrite);H(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,i,j)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
function x(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function D(a,b,c,d,e){ma=0;d.needsUpdate&&(d.program&&aa(d),L.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets));
|
|
|
-var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==mb&&(j.useProgram(g),mb=g,f=!0);d.id!==ta&&(ta=d.id,f=!0);if(f||a!==ga)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ga&&(ga=a);if(d.skinning)if(tc&&e.useVertexTexture){if(null!==h.boneTexture){var k=K();j.uniform1i(h.boneTexture,k);L.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?
|
|
|
-(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ab){for(var l,m=k=0,n=0,p,q,s,r=xb,t=r.directional.colors,v=r.directional.positions,x=r.point.colors,w=r.point.positions,C=r.point.distances,A=r.spot.colors,D=r.spot.positions,G=r.spot.distances,H=r.spot.directions,J=r.spot.anglesCos,O=r.spot.exponents,T=r.hemi.skyColors,X=r.hemi.groundColors,va=r.hemi.positions,
|
|
|
+var f=!1,g=d.program,i=g.uniforms,h=d.uniforms;g!==mb&&(j.useProgram(g),mb=g,f=!0);d.id!==ta&&(ta=d.id,f=!0);if(f||a!==ga)j.uniformMatrix4fv(i.projectionMatrix,!1,a.projectionMatrix.elements),a!==ga&&(ga=a);if(d.skinning)if(tc&&e.useVertexTexture){if(null!==i.boneTexture){var k=K();j.uniform1i(i.boneTexture,k);L.setTexture(e.boneTexture,k)}}else null!==i.boneGlobalMatrices&&j.uniformMatrix4fv(i.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(h.fogColor.value=c.color,c instanceof THREE.Fog?
|
|
|
+(h.fogNear.value=c.near,h.fogFar.value=c.far):c instanceof THREE.FogExp2&&(h.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ab){for(var l,m=k=0,n=0,p,q,s,r=xb,t=r.directional.colors,v=r.directional.positions,x=r.point.colors,w=r.point.positions,C=r.point.distances,A=r.spot.colors,D=r.spot.positions,G=r.spot.distances,H=r.spot.directions,J=r.spot.anglesCos,O=r.spot.exponents,T=r.hemi.skyColors,X=r.hemi.groundColors,va=r.hemi.positions,
|
|
|
W=0,V=0,ja=0,da=0,ha=0,ka=0,fa=0,Ya=0,N=l=0,c=s=N=0,f=b.length;c<f;c++)l=b[c],l.onlyShadow||(p=l.color,q=l.intensity,s=l.distance,l instanceof THREE.AmbientLight?l.visible&&(L.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,n+=p.b*p.b):(k+=p.r,m+=p.g,n+=p.b)):l instanceof THREE.DirectionalLight?(ha+=1,l.visible&&(Na.getPositionFromMatrix(l.matrixWorld),Pa.getPositionFromMatrix(l.target.matrixWorld),Na.sub(Pa),Na.normalize(),0===Na.x&&0===Na.y&&0===Na.z||(l=3*W,v[l]=Na.x,v[l+1]=Na.y,v[l+2]=Na.z,L.gammaInput?z(t,
|
|
|
l,p,q*q):F(t,l,p,q),W+=1))):l instanceof THREE.PointLight?(ka+=1,l.visible&&(N=3*V,L.gammaInput?z(x,N,p,q*q):F(x,N,p,q),Pa.getPositionFromMatrix(l.matrixWorld),w[N]=Pa.x,w[N+1]=Pa.y,w[N+2]=Pa.z,C[V]=s,V+=1)):l instanceof THREE.SpotLight?(fa+=1,l.visible&&(N=3*ja,L.gammaInput?z(A,N,p,q*q):F(A,N,p,q),Pa.getPositionFromMatrix(l.matrixWorld),D[N]=Pa.x,D[N+1]=Pa.y,D[N+2]=Pa.z,G[ja]=s,Na.copy(Pa),Pa.getPositionFromMatrix(l.target.matrixWorld),Na.sub(Pa),Na.normalize(),H[N]=Na.x,H[N+1]=Na.y,H[N+2]=Na.z,
|
|
|
J[ja]=Math.cos(l.angle),O[ja]=l.exponent,ja+=1)):l instanceof THREE.HemisphereLight&&(Ya+=1,l.visible&&(Na.getPositionFromMatrix(l.matrixWorld),Na.normalize(),0===Na.x&&0===Na.y&&0===Na.z||(s=3*da,va[s]=Na.x,va[s+1]=Na.y,va[s+2]=Na.z,p=l.color,l=l.groundColor,L.gammaInput?(q*=q,z(T,s,p,q),z(X,s,l,q)):(F(T,s,p,q),F(X,s,l,q)),da+=1))));c=3*W;for(f=Math.max(t.length,3*ha);c<f;c++)t[c]=0;c=3*V;for(f=Math.max(x.length,3*ka);c<f;c++)x[c]=0;c=3*ja;for(f=Math.max(A.length,3*fa);c<f;c++)A[c]=0;c=3*da;for(f=
|
|
|
-Math.max(T.length,3*Ya);c<f;c++)T[c]=0;c=3*da;for(f=Math.max(X.length,3*Ya);c<f;c++)X[c]=0;r.directional.length=W;r.point.length=V;r.spot.length=ja;r.hemi.length=da;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;ab=!1}c=xb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=
|
|
|
-c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=
|
|
|
-d.opacity;L.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Y;d.map?Y=d.map:d.specularMap?Y=d.specularMap:d.normalMap?Y=d.normalMap:d.bumpMap&&(Y=d.bumpMap);void 0!==Y&&(c=Y.offset,Y=Y.repeat,i.offsetRepeat.value.set(c.x,c.y,Y.x,Y.y));
|
|
|
-i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=
|
|
|
-d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=M.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),
|
|
|
-d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&
|
|
|
-i.shadowMatrix){c=Y=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Y]=k.shadowMap,i.shadowMapSize.value[Y]=k.shadowMapSize,i.shadowMatrix.value[Y]=k.shadowMatrix,i.shadowDarkness.value[Y]=k.shadowDarkness,i.shadowBias.value[Y]=k.shadowBias,Y++}b=d.uniformsList;i=0;for(Y=b.length;i<Y;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,
|
|
|
+Math.max(T.length,3*Ya);c<f;c++)T[c]=0;c=3*da;for(f=Math.max(X.length,3*Ya);c<f;c++)X[c]=0;r.directional.length=W;r.point.length=V;r.spot.length=ja;r.hemi.length=da;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;ab=!1}c=xb;h.ambientLightColor.value=c.ambient;h.directionalLightColor.value=c.directional.colors;h.directionalLightDirection.value=c.directional.positions;h.pointLightColor.value=c.point.colors;h.pointLightPosition.value=c.point.positions;h.pointLightDistance.value=c.point.distances;h.spotLightColor.value=
|
|
|
+c.spot.colors;h.spotLightPosition.value=c.spot.positions;h.spotLightDistance.value=c.spot.distances;h.spotLightDirection.value=c.spot.directions;h.spotLightAngleCos.value=c.spot.anglesCos;h.spotLightExponent.value=c.spot.exponents;h.hemisphereLightSkyColor.value=c.hemi.skyColors;h.hemisphereLightGroundColor.value=c.hemi.groundColors;h.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){h.opacity.value=
|
|
|
+d.opacity;L.gammaInput?h.diffuse.value.copyGammaToLinear(d.color):h.diffuse.value=d.color;h.map.value=d.map;h.lightMap.value=d.lightMap;h.specularMap.value=d.specularMap;d.bumpMap&&(h.bumpMap.value=d.bumpMap,h.bumpScale.value=d.bumpScale);d.normalMap&&(h.normalMap.value=d.normalMap,h.normalScale.value.copy(d.normalScale));var Y;d.map?Y=d.map:d.specularMap?Y=d.specularMap:d.normalMap?Y=d.normalMap:d.bumpMap&&(Y=d.bumpMap);void 0!==Y&&(c=Y.offset,Y=Y.repeat,h.offsetRepeat.value.set(c.x,c.y,Y.x,Y.y));
|
|
|
+h.envMap.value=d.envMap;h.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;h.reflectivity.value=d.reflectivity;h.refractionRatio.value=d.refractionRatio;h.combine.value=d.combine;h.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity,h.dashSize.value=d.dashSize,h.totalSize.value=
|
|
|
+d.dashSize+d.gapSize,h.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(h.psColor.value=d.color,h.opacity.value=d.opacity,h.size.value=d.size,h.scale.value=M.height/2,h.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(h.shininess.value=d.shininess,L.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive),h.specular.value.copyGammaToLinear(d.specular)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive,h.specular.value=d.specular),
|
|
|
+d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(L.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive),d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(h.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&
|
|
|
+h.shadowMatrix){c=Y=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))h.shadowMap.value[Y]=k.shadowMap,h.shadowMapSize.value[Y]=k.shadowMapSize,h.shadowMatrix.value[Y]=k.shadowMatrix,h.shadowDarkness.value[Y]=k.shadowDarkness,h.shadowBias.value[Y]=k.shadowBias,Y++}b=d.uniformsList;h=0;for(Y=b.length;h<Y;h++)if(f=g.uniforms[b[h][1]])if(c=b[h][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,
|
|
|
k);else if("v2"===m)j.uniform2f(f,k.x,k.y);else if("v3"===m)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===m)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===m)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===m)j.uniform1iv(f,k);else if("iv"===m)j.uniform3iv(f,k);else if("fv1"===m)j.uniform1fv(f,k);else if("fv"===m)j.uniform3fv(f,k);else if("v2v"===m){void 0===c._array&&(c._array=new Float32Array(2*k.length));m=0;for(n=k.length;m<n;m++)r=2*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y;j.uniform2fv(f,c._array)}else if("v3v"===
|
|
|
m){void 0===c._array&&(c._array=new Float32Array(3*k.length));m=0;for(n=k.length;m<n;m++)r=3*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z;j.uniform3fv(f,c._array)}else if("v4v"===m){void 0===c._array&&(c._array=new Float32Array(4*k.length));m=0;for(n=k.length;m<n;m++)r=4*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z,c._array[r+3]=k[m].w;j.uniform4fv(f,c._array)}else if("m4"===m)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,
|
|
|
!1,c._array);else if("m4v"===m){void 0===c._array&&(c._array=new Float32Array(16*k.length));m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=K(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(m=0;6>m;m++)L.autoScaleCubemaps&&!f?(n=k,r=m,t=c.image[m],x=id,t.width<=x&&t.height<=x||(w=Math.max(t.width,t.height),v=Math.floor(t.width*x/w),x=Math.floor(t.height*x/w),w=document.createElement("canvas"),w.width=v,w.height=x,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,x),t=w),n[r]=t):k[m]=c.image[m];m=k[0];n=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=I(c.format);
|
|
|
t=I(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(m=0;6>m;m++)if(f){x=k[m].mipmaps;w=0;for(C=x.length;w<C;w++)v=x[w],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,t,k[m]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?
|
|
|
-(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):L.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=K();j.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)r=c.value[m],k=c._array[m],r&&L.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)Pa.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,Pa.x,Pa.y,
|
|
|
-Pa.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function K(){var a=ma;a>=Oc&&console.warn("WebGLRenderer: trying to use "+
|
|
|
+(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):L.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=K();j.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)r=c.value[m],k=c._array[m],r&&L.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==i.cameraPosition)Pa.getPositionFromMatrix(a.matrixWorld),j.uniform3f(i.cameraPosition,Pa.x,Pa.y,
|
|
|
+Pa.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==i.viewMatrix&&j.uniformMatrix4fv(i.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(i.modelViewMatrix,!1,e._modelViewMatrix.elements);i.normalMatrix&&j.uniformMatrix3fv(i.normalMatrix,!1,e._normalMatrix.elements);null!==i.modelMatrix&&j.uniformMatrix4fv(i.modelMatrix,!1,e.matrixWorld.elements);return g}function K(){var a=ma;a>=Oc&&console.warn("WebGLRenderer: trying to use "+
|
|
|
a+" texture units while this GPU supports only "+Oc);ma+=1;return a}function A(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(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 F(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function H(a,b,c){Ra!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ra=a);if(a&&(Ua!==b||Sa!==c))j.polygonOffset(b,c),
|
|
|
Ua=b,Sa=c}function G(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function V(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(G(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,I(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,I(b.wrapT)),
|
|
|
j.texParameteri(a,j.TEXTURE_MAG_FILTER,I(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,I(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,C(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,C(b.minFilter)));if(ob&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,ob.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ec)),b.__oldAnisotropy=b.anisotropy}
|
|
@@ -396,27 +397,27 @@ j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer
|
|
|
L.info.memory.geometries--},Qc=function(a){a=a.target;a.removeEventListener("dispose",Qc);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));L.info.memory.textures--},Rc=function(a){a=a.target;a.removeEventListener("dispose",Rc);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);L.info.memory.textures--},O=function(a){a=a.target;a.removeEventListener("dispose",O);aa(a)},aa=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=va.length;a<c;a++)if(d=va[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=va.length;a<c;a++)d=va[a],d.program!==b&&e.push(d);va=e;j.deleteProgram(b);L.info.memory.programs--}}};this.renderBufferImmediate=
|
|
|
function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,
|
|
|
-3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,i,h,k,m,l,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],h=n[p+4],m=n[p+5],i=n[p+6],k=n[p+7],l=n[p+8],d=(d+g+i)/3,e=(e+h+k)/3,f=(f+m+l)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
|
|
|
+3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,k,m,l,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],m=n[p+5],h=n[p+6],k=n[p+7],l=n[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+m+l)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
|
|
|
3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,
|
|
|
-0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=D(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==Ma&&(Ma=d,b=!0),b&&l(),f instanceof THREE.Mesh)if(f=e.attributes.index){d=e.offsets;1<d.length&&(b=!0);for(var c=0,g=d.length;c<g;c++){var i=d[c].index;if(b){var h=e.attributes.position,m=h.itemSize;j.bindBuffer(j.ARRAY_BUFFER,h.buffer);k(a.position);j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,4*i*m);m=e.attributes.normal;if(0<=
|
|
|
-a.normal&&m){var n=m.itemSize;j.bindBuffer(j.ARRAY_BUFFER,m.buffer);k(a.normal);j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,4*i*n)}m=e.attributes.uv;0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,4*i*n));m=e.attributes.color;0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,4*i*n));m=e.attributes.tangent;0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,4*i*n));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,d[c].count,j.UNSIGNED_SHORT,2*d[c].start);L.info.render.calls++;L.info.render.vertices+=d[c].count;L.info.render.faces+=d[c].count/3}}else b&&(h=e.attributes.position,m=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.normal,0<=a.normal&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=D(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==Ma&&(Ma=d,b=!0),b&&l(),f instanceof THREE.Mesh)if(f=e.attributes.index){d=e.offsets;1<d.length&&(b=!0);for(var c=0,g=d.length;c<g;c++){var h=d[c].index;if(b){var i=e.attributes.position,m=i.itemSize;j.bindBuffer(j.ARRAY_BUFFER,i.buffer);k(a.position);j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,4*h*m);m=e.attributes.normal;if(0<=
|
|
|
+a.normal&&m){var n=m.itemSize;j.bindBuffer(j.ARRAY_BUFFER,m.buffer);k(a.normal);j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,4*h*n)}m=e.attributes.uv;0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,4*h*n));m=e.attributes.color;0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,4*h*n));m=e.attributes.tangent;0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,4*h*n));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,d[c].count,j.UNSIGNED_SHORT,2*d[c].start);L.info.render.calls++;L.info.render.vertices+=d[c].count;L.info.render.faces+=d[c].count/3}}else b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.normal,0<=a.normal&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
m.buffer),k(a.normal),j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,0)),m=e.attributes.uv,0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,0)),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),m=e.attributes.tangent,0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,
|
|
|
-!1,0,0))),j.drawArrays(j.TRIANGLES,0,h.numItems/3),L.info.render.calls++,L.info.render.vertices+=h.numItems/3,L.info.render.faces+=h.numItems/3/3;else f instanceof THREE.ParticleSystem?b&&(h=e.attributes.position,m=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,
|
|
|
-h.numItems/3),L.info.render.calls++,L.info.render.points+=h.numItems/3):f instanceof THREE.Line&&b&&(h=e.attributes.position,m=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.LINE_STRIP,0,h.numItems/3),L.info.render.calls++,L.info.render.points+=h.numItems)};this.renderBuffer=
|
|
|
-function(a,b,c,d,e,f){if(!1!==d.visible){var g,i,c=D(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Ma&&(Ma=c,a=!0);a&&l();if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(b.position),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),j.vertexAttribPointer(c.position,
|
|
|
-3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var h=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<i.length;)0<=c["morphTarget"+h]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[h]]),k(c["morphTarget"+h]),j.vertexAttribPointer(c["morphTarget"+h],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+h]&&d.morphNormals&&
|
|
|
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[h]]),k(c["morphNormal"+h]),j.vertexAttribPointer(c["morphNormal"+h],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[h]=g[i[h]],h++}else{i=[];g=f.morphTargetInfluences;var n,p=g.length;for(n=0;n<p;n++)h=g[n],0<h&&i.push([h,n]);i.length>d.numSupportedMorphTargets?(i.sort(m),i.length=d.numSupportedMorphTargets):i.length>d.numSupportedMorphNormals?i.sort(m):0===i.length&&i.push([0,0]);for(h=0;h<d.numSupportedMorphTargets;)i[h]?(n=i[h][1],0<=
|
|
|
-c["morphTarget"+h]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),k(c["morphTarget"+h]),j.vertexAttribPointer(c["morphTarget"+h],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+h]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),k(c["morphNormal"+h]),j.vertexAttribPointer(c["morphNormal"+h],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[h]=g[n]):f.__webglMorphTargetInfluences[h]=0,h++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
|
|
|
-f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(i=e.__webglCustomAttributesList.length;g<i;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),k(b[c.buffer.belongsToAttribute]),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),k(b.color),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+!1,0,0))),j.drawArrays(j.TRIANGLES,0,i.numItems/3),L.info.render.calls++,L.info.render.vertices+=i.numItems/3,L.info.render.faces+=i.numItems/3/3;else f instanceof THREE.ParticleSystem?b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,
|
|
|
+i.numItems/3),L.info.render.calls++,L.info.render.points+=i.numItems/3):f instanceof THREE.Line&&b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.LINE_STRIP,0,i.numItems/3),L.info.render.calls++,L.info.render.points+=i.numItems)};this.renderBuffer=
|
|
|
+function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,c=D(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Ma&&(Ma=c,a=!0);a&&l();if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(b.position),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),j.vertexAttribPointer(c.position,
|
|
|
+3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var i=0;h=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[h[i]]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&
|
|
|
+(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[h[i]]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[h[i]],i++}else{h=[];g=f.morphTargetInfluences;var n,p=g.length;for(n=0;n<p;n++)i=g[n],0<i&&h.push([i,n]);h.length>d.numSupportedMorphTargets?(h.sort(m),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(m):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?(n=h[i][1],0<=
|
|
|
+c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[n]):f.__webglMorphTargetInfluences[i]=0,i++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
|
|
|
+f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),k(b[c.buffer.belongsToAttribute]),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),k(b.color),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
e.__webglNormalBuffer),k(b.normal),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),k(b.tangent),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),k(b.uv),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0));0<=b.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),k(b.uv2),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=b.skinIndex&&0<=b.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
e.__webglSkinIndicesBuffer),k(b.skinIndex),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(b.skinWeight),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));0<=b.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(b.lineDistance),j.vertexAttribPointer(b.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==fb&&(j.lineWidth(d),fb=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==fb&&(j.lineWidth(d),fb=d),j.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof
|
|
|
-THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}};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,i,h=a.__lights,k=a.fog;ta=-1;ab=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&
|
|
|
-b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);gc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ea.setFromMatrix(gc);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;L.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);i=a.__webglObjects;d=0;for(e=i.length;d<e;d++)if(f=i[d],g=f.object,
|
|
|
+THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}};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,i=a.__lights,k=a.fog;ta=-1;ab=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&
|
|
|
+b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);gc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ea.setFromMatrix(gc);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;L.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.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||Ea.intersectsObject(g))){A(g,b);var m=f,l=m.buffer,q=void 0,t=q=void 0,t=m.object.material;if(t instanceof THREE.MeshFaceMaterial)q=l.materialIndex,q=t.materials[q],q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);else if(q=t)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:
|
|
|
-(Pa.getPositionFromMatrix(g.matrixWorld),Pa.applyProjection(gc),f.z=Pa.z),f.id=g.id)}this.sortObjects&&i.sort(n);i=a.__webglObjectsImmediate;d=0;for(e=i.length;d<e;d++)f=i[d],g=f.object,g.visible&&(A(g,b),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),H(d.polygonOffset,d.polygonOffsetFactor,
|
|
|
-d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,h,k,!0,d),p(a.__webglObjectsImmediate,"",b,h,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,h,k,!1,d),p(a.__webglObjectsImmediate,"opaque",b,h,k,!1,d),r(a.__webglObjects,!1,"transparent",b,h,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,h,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?
|
|
|
+(Pa.getPositionFromMatrix(g.matrixWorld),Pa.applyProjection(gc),f.z=Pa.z),f.id=g.id)}this.sortObjects&&h.sort(n);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(A(g,b),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),H(d.polygonOffset,d.polygonOffsetFactor,
|
|
|
+d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,i,k,!0,d),p(a.__webglObjectsImmediate,"",b,i,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,i,k,!1,d),p(a.__webglObjectsImmediate,"opaque",b,i,k,!1,d),r(a.__webglObjects,!1,"transparent",b,i,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,i,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?
|
|
|
(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=D(a,b,c,d,e);Ma=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ea):e.render(function(a){L.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=
|
|
|
function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,n=void 0,l=void 0,p=void 0,r=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",xd)),b instanceof THREE.Mesh)if(l=b.geometry,p=b.material,
|
|
|
l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var s=l,z=void 0,C=void 0,B=void 0,A=void 0,D=void 0,F=void 0,G={},H=s.morphTargets.length,I=s.morphNormals.length,K=p instanceof THREE.MeshFaceMaterial;s.geometryGroups={};z=0;for(C=s.faces.length;z<C;z++)B=s.faces[z],A=K?B.materialIndex:0,void 0===G[A]&&(G[A]={hash:A,counter:0}),F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:H,numMorphNormals:I}),
|
|
@@ -470,11 +471,11 @@ void 0,Ca=void 0,ba=void 0;if(Nc.sortParticles){vb.copy(gc);vb.multiply(Nc.matri
|
|
|
kc[na][1],ba.array[na]=ba.value[ec];else if(2===ba.size)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.r,ba.array[ca+1]=Ca.g,ba.array[ca+2]=Ca.b,ca+=3;else for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ca+=3;else if(4===ba.size)for(na=0;na<Lb;na++)ec=kc[na][1],Ca=ba.value[ec],ba.array[ca]=Ca.x,
|
|
|
ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ba.array[ca+3]=Ca.w,ca+=4}}else{if(Id)for(ub=0;ub<vd;ub++)dc=gd[ub],ca=3*ub,wc[ca]=dc.x,wc[ca+1]=dc.y,wc[ca+2]=dc.z;if(Jd)for(cc=0;cc<Hd;cc++)rc=wd[cc],ca=3*cc,xc[ca]=rc.r,xc[ca+1]=rc.g,xc[ca+2]=rc.b;if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo))if(Lb=ba.value.length,ca=0,1===ba.size)for(na=0;na<Lb;na++)ba.array[na]=ba.value[na];else if(2===ba.size)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=
|
|
|
Ca.x,ba.array[ca+1]=Ca.y,ca+=2;else if(3===ba.size)if("c"===ba.type)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.r,ba.array[ca+1]=Ca.g,ba.array[ca+2]=Ca.b,ca+=3;else for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ca+=3;else if(4===ba.size)for(na=0;na<Lb;na++)Ca=ba.value[na],ba.array[ca]=Ca.x,ba.array[ca+1]=Ca.y,ba.array[ca+2]=Ca.z,ba.array[ca+3]=Ca.w,ca+=4}}if(Id||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-wc,ud);if(Jd||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xc,ud);if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],ba.needsUpdate||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ba.buffer),j.bufferData(j.ARRAY_BUFFER,ba.array,ud)}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;ta.attributes&&t(ta)}}};this.initMaterial=function(a,b,c,d){var e,f,g,i;a.addEventListener("dispose",O);var h,k,m,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof
|
|
|
+wc,ud);if(Jd||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xc,ud);if(lc){Kb=0;for(Dc=lc.length;Kb<Dc;Kb++)if(ba=lc[Kb],ba.needsUpdate||Nc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ba.buffer),j.bufferData(j.ARRAY_BUFFER,ba.array,ud)}}N.verticesNeedUpdate=!1;N.colorsNeedUpdate=!1;ta.attributes&&t(ta)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",O);var i,k,m,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof
|
|
|
THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,r,s;e=g=r=s=
|
|
|
-p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&p++);e=g;f=r;g=s;i=p;p=q=0;for(s=b.length;p<s;p++)r=b[p],r.castShadow&&(r instanceof THREE.SpotLight&&q++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&q++);l=q;tc&&d&&d.useVertexTexture?m=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&
|
|
|
+p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&p++);e=g;f=r;g=s;h=p;p=q=0;for(s=b.length;p<s;p++)r=b[p],r.castShadow&&(r instanceof THREE.SpotLight&&q++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&q++);l=q;tc&&d&&d.useVertexTexture?m=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&
|
|
|
(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),m=b);a:{r=a.fragmentShader;s=a.vertexShader;p=a.uniforms;b=a.attributes;q=a.defines;var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,
|
|
|
-skinning:a.skinning,maxBones:m,useVertexTexture:tc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:i,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
|
|
|
+skinning:a.skinning,maxBones:m,useVertexTexture:tc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
|
|
|
alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,x,d=[];n?d.push(n):(d.push(r),d.push(s));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(v=va.length;t<v;t++)if(d=va[t],d.code===n){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");
|
|
|
v=[];for(x in q)d=q[x],!1!==d&&(d="#define "+x+" "+d,v.push(d));d=v.join("\n");x=j.createProgram();v=["precision "+W+" float;",d,sc?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,
|
|
|
"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):
|
|
@@ -484,20 +485,20 @@ c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.
|
|
|
"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=V("fragment",t+r);v=V("vertex",v+s);j.attachShader(x,v);j.attachShader(x,t);j.linkProgram(x);j.getProgramParameter(x,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(x,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
j.getError()+"]");j.deleteShader(t);j.deleteShader(v);x.uniforms={};x.attributes={};var w;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(w in p)t.push(w);w=t;t=0;for(v=w.length;t<v;t++)p=w[t],x.uniforms[p]=j.getUniformLocation(x,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)t.push("morphTarget"+
|
|
|
w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],x.attributes[t]=j.getAttribLocation(x,t);x.id=Ya++;va.push({program:x,code:n,usedTimes:1});L.info.memory.programs=va.length;k=x}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)x=b+k,0<=w[x]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)x=
|
|
|
-b+k,0<=w[x]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;X!==
|
|
|
+b+k,0<=w[x]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;X!==
|
|
|
b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),X=b);ha!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),ha=a)};this.setDepthTest=function(a){$a!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),$a=a)};this.setDepthWrite=function(a){ia!==a&&(j.depthMask(a),ia=a)};this.setBlending=function(a,b,c,d){a!==ra&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),
|
|
|
j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),ra=a);if(a===THREE.CustomBlending){if(b!==fa&&(j.blendEquation(I(b)),fa=b),c!==Da||d!==Za)j.blendFunc(I(c),I(d)),Da=c,Za=d}else Za=
|
|
|
Da=fa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Qc),a.__webglTexture=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=I(a.format),
|
|
|
-f=I(a.type);B(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var i=0,h=g.length;i<h;i++)c=g[i],j.texImage2D(j.TEXTURE_2D,i,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){i=0;for(h=g.length;i<h;i++)c=g[i],j.compressedTexImage2D(j.TEXTURE_2D,i,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){i=0;for(h=g.length;i<h;i++)c=g[i],j.texImage2D(j.TEXTURE_2D,
|
|
|
-i,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Rc);a.__webglTexture=
|
|
|
-j.createTexture();L.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=I(a.format),e=I(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);B(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,i=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,i,g.__webglTexture,0);T(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),B(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),
|
|
|
+f=I(a.type);B(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,
|
|
|
+h,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Rc);a.__webglTexture=
|
|
|
+j.createTexture();L.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=I(a.format),e=I(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);B(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
+a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);T(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),B(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),
|
|
|
j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):T(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,
|
|
|
null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Jb,a=fc,d=pb,e=Ib);b!==Hb&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Hb=b);mc=c;qb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){THREE.EventDispatcher.call(this);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,1);
|
|
|
this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a};
|
|
|
THREE.WebGLRenderTarget.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
|
|
|
-this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;a.getHSV(e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,m=h.length;n<m;n++){var s=h[n].clone();c&&s.applyMatrix4(c);g.push(s)}n=0;for(m=k.length;n<m;n++){var s=k[n],r,p,q=s.vertexNormals,x=s.vertexColors;s instanceof THREE.Face3?
|
|
|
+this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,m=h.length;n<m;n++){var s=h[n].clone();c&&s.applyMatrix4(c);g.push(s)}n=0;for(m=k.length;n<m;n++){var s=k[n],r,p,q=s.vertexNormals,x=s.vertexColors;s instanceof THREE.Face3?
|
|
|
r=new THREE.Face3(s.a+e,s.b+e,s.c+e):s instanceof THREE.Face4&&(r=new THREE.Face4(s.a+e,s.b+e,s.c+e,s.d+e));r.normal.copy(s.normal);d&&r.normal.applyMatrix3(d).normalize();g=0;for(h=q.length;g<h;g++)p=q[g].clone(),d&&p.applyMatrix3(d).normalize(),r.vertexNormals.push(p);r.color.copy(s.color);g=0;for(h=x.length;g<h;g++)p=x[g],r.vertexColors.push(p.clone());r.materialIndex=s.materialIndex;r.centroid.copy(s.centroid);c&&r.centroid.applyMatrix4(c);i.push(r)}n=0;for(m=f.length;n<m;n++){c=f[n];d=[];g=0;
|
|
|
for(h=c.length;g<h;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));l.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,g=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||g.push(f);a.faces=g},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.add(h);
|
|
|
h.copy(c);h.multiplyScalar(f);g.add(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a],e=b.vertices[a.b],f=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,
|
|
@@ -602,9 +603,9 @@ f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,th
|
|
|
m=this.vertices[k[0][h+1]].clone()):(n=this.vertices[k[1][h]].clone(),m=this.vertices[k[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],r=k[i+1][h],p=k[i+1][h+1],q=k[i][h+1],x=n.clone(),t=n.clone(),v=m.clone(),w=m.clone(),D=l[i][h].clone(),K=l[i+1][h].clone(),A=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(s,r,p,q,[x,t,v,w]));this.faceVertexUvs[0].push([D,K,A,z])}}if(!f&&0<
|
|
|
a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],r=k[0][h+1],p=this.vertices.length-1,x=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),D=l[0][h].clone(),K=l[0][h+1].clone(),A=new THREE.Vector2(K.u,0),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([D,K,A])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],r=k[i][h],p=this.vertices.length-1,x=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,
|
|
|
-1,0),v=new THREE.Vector3(0,-1,0),D=l[i][h+1].clone(),K=l[i][h].clone(),A=new THREE.Vector2(K.u,1),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([D,K,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,i=THREE.ExtrudeGeometry.__v5,h=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);i.copy(a).add(f);h.copy(a).add(g);if(i.equals(h))return g.clone();
|
|
|
-i.copy(b).add(f);h.copy(c).add(g);f=d.dot(g);g=h.sub(i).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(i).sub(a).clone()}function e(c,d){var e,f;for(J=c.length;0<=--J;){e=J;f=J-1;0>f&&(f=c.length-1);for(var g=0,i=s+2*l,
|
|
|
-g=0;g<i;g++){var h=ua*g,k=ua*(g+1),m=d+e+h,h=d+f+h,n=d+f+k,k=d+e+k,p=c,q=g,r=i,x=e,w=f,m=m+V,h=h+V,n=n+V,k=k+V;G.faces.push(new THREE.Face4(m,h,n,k,null,null,t));m=v.generateSideWallUV(G,a,p,b,m,h,n,k,q,r,x,w);G.faceVertexUvs[0].push(m)}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=V;d+=V;e+=V;G.faces.push(new THREE.Face3(c,d,e,null,null,x));c=f?v.generateBottomUV(G,a,b,c,d,e):v.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
|
|
|
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
|
+h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(J=c.length;0<=--J;){e=J;f=J-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*l,
|
|
|
+g=0;g<h;g++){var i=ua*g,k=ua*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,x=e,w=f,m=m+V,i=i+V,n=n+V,k=k+V;G.faces.push(new THREE.Face4(m,i,n,k,null,null,t));m=v.generateSideWallUV(G,a,p,b,m,i,n,k,q,r,x,w);G.faceVertexUvs[0].push(m)}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=V;d+=V;e+=V;G.faces.push(new THREE.Face3(c,d,e,null,null,x));c=f?v.generateBottomUV(G,a,b,c,d,e):v.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
|
|
|
100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,p,q=!1,x=b.material,t=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,D,K,A;r&&(p=r.getSpacedPoints(s),q=!0,n=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,
|
|
|
!1),D=new THREE.Vector3,K=new THREE.Vector3,A=new THREE.Vector3);n||(k=i=l=0);var z,F,H,G=this,V=this.vertices.length,m=a.extractPoints(m),B=m.shape,m=m.holes;if(r=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();F=0;for(H=m.length;F<H;F++)z=m[F],THREE.Shape.Utils.isClockWise(z)&&(m[F]=z.reverse());r=!1}var T=THREE.Shape.Utils.triangulateShape(B,m),r=B;F=0;for(H=m.length;F<H;F++)z=m[F],B=B.concat(z);var C,I,M,W,ua=B.length,Ha=T.length,oa=[],J=0,da=r.length;C=da-1;for(I=J+1;J<da;J++,C++,I++)C===da&&
|
|
|
(C=0),I===da&&(I=0),oa[J]=d(r[J],r[C],r[I]);var ka=[],Y,L=oa.concat();F=0;for(H=m.length;F<H;F++){z=m[F];Y=[];J=0;da=z.length;C=da-1;for(I=J+1;J<da;J++,C++,I++)C===da&&(C=0),I===da&&(I=0),Y[J]=d(z[J],z[C],z[I]);ka.push(Y);L=L.concat(Y)}for(C=0;C<l;C++){z=C/l;M=i*(1-z);I=k*Math.sin(z*Math.PI/2);J=0;for(da=r.length;J<da;J++)W=c(r[J],oa[J],I),f(W.x,W.y,-M);F=0;for(H=m.length;F<H;F++){z=m[F];Y=ka[F];J=0;for(da=z.length;J<da;J++)W=c(z[J],Y[J],I),f(W.x,W.y,-M)}}I=k;for(J=0;J<ua;J++)W=n?c(B[J],L[J],I):B[J],
|
|
@@ -672,8 +673,8 @@ b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scal
|
|
|
b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(A.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var V,B,T,C,I;for(V=0;V<t;V++)if(A=16/f,z.set(A*w,A),C=a[V],v.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),F.copy(v),H.x=F.x*D+D,
|
|
|
H.y=F.y*K+K,l||0<H.x&&H.x<e&&0<H.y&&H.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,z.x,z.y);b.uniform3f(G.screenPosition,F.x,F.y,F.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(G.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);C.positionScreen.copy(F);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);B=0;for(T=C.lensFlares.length;B<T;B++)I=C.lensFlares[B],0.001<I.opacity&&0.001<I.scale&&(F.x=I.x,F.y=I.y,F.z=I.z,A=I.size*I.scale/f,z.x=A*w,z.y=A,b.uniform3f(G.screenPosition,F.x,F.y,F.z),b.uniform2f(G.scale,z.x,z.y),b.uniform1f(G.rotation,I.rotation),b.uniform1f(G.opacity,
|
|
|
-I.opacity),b.uniform3f(G.color,I.color.r,I.color.g,I.color.b),c.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst),c.setTexture(I.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,i=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:i,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,m){var s,r,p,q,x,t,v,w,D,K=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
+I.opacity),b.uniform3f(G.color,I.color.r,I.color.g,I.color.b),c.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst),c.setTexture(I.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,m){var s,r,p,q,x,t,v,w,D,K=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=n.__lights.length;s<r;s++)if(p=n.__lights[s],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(x=0;x<p.shadowCascadeCount;x++){var A;if(p.shadowCascadeArray[x])A=p.shadowCascadeArray[x];else{D=p;v=x;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=D.shadowCameraNear;A.shadowCameraFar=D.shadowCameraFar;A.shadowCameraLeft=D.shadowCameraLeft;A.shadowCameraRight=D.shadowCameraRight;
|
|
|
A.shadowCameraBottom=D.shadowCameraBottom;A.shadowCameraTop=D.shadowCameraTop;A.shadowCameraVisible=D.shadowCameraVisible;A.shadowDarkness=D.shadowDarkness;A.shadowBias=D.shadowCascadeBias[v];A.shadowMapWidth=D.shadowCascadeWidth[v];A.shadowMapHeight=D.shadowCascadeHeight[v];A.pointsWorld=[];A.pointsFrustum=[];w=A.pointsWorld;t=A.pointsFrustum;for(var z=0;8>z;z++)w[z]=new THREE.Vector3,t[z]=new THREE.Vector3;w=D.shadowCascadeNearZ[v];D=D.shadowCascadeFarZ[v];t[0].set(-1,-1,w);t[1].set(1,-1,w);t[2].set(-1,
|
|
|
1,w);t[3].set(1,1,w);t[4].set(-1,-1,D);t[5].set(1,-1,D);t[6].set(-1,1,D);t[7].set(1,1,D);A.originalCamera=m;t=new THREE.Gyroscope;t.position=p.shadowCascadeOffset;t.add(A);t.add(A.target);m.add(t);p.shadowCascadeArray[x]=A;console.log("Created virtualLight",A)}v=p;w=x;D=v.shadowCascadeArray[w];D.position.copy(v.position);D.target.position.copy(v.target.position);D.lookAt(D.target);D.shadowCameraVisible=v.shadowCameraVisible;D.shadowDarkness=v.shadowDarkness;D.shadowBias=v.shadowCascadeBias[w];t=v.shadowCascadeNearZ[w];
|