|
@@ -1,7 +1,7 @@
|
|
|
// three.js - http://github.com/mrdoob/three.js
|
|
|
'use strict';var THREE=THREE||{REVISION:"59dev"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};self.Int32Array=self.Int32Array||Array;self.Float32Array=self.Float32Array||Array;String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};
|
|
|
THREE.extend=function(a,b){if(Object.keys)for(var c=Object.keys(b),d=0,e=c.length;d<e;d++){var f=c[d];Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(b,f))}else for(f in c={}.hasOwnProperty,b)c.call(b,f)&&(a[f]=b[f]);return a};
|
|
|
-(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];void 0===window.requestAnimationFrame&&(window.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g});window.cancelAnimationFrame=window.cancelAnimationFrame||
|
|
|
+(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];void 0===window.requestAnimationFrame&&(window.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),h=window.setTimeout(function(){b(c+f)},f);a=c+f;return h});window.cancelAnimationFrame=window.cancelAnimationFrame||
|
|
|
function(a){window.clearTimeout(a)}})();THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;
|
|
|
THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;
|
|
|
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;
|
|
@@ -11,7 +11,7 @@ THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){a ins
|
|
|
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)},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}}(),getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,
|
|
|
+this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},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),h,g=(f+e)/2;if(f===e)f=h=0;else{var i=e-f,f=0.5>=g?i/(e+f):i/(2-e-f);switch(e){case b:h=(c-d)/i+(c<d?6:0);break;case c:h=(d-b)/i+2;break;case d:h=(b-c)/i+4}h/=6}a.h=h;a.s=f;a.l=g;return a}}(),getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},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},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},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,
|
|
@@ -20,12 +20,12 @@ grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:491533
|
|
|
lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,
|
|
|
palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,
|
|
|
tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"YXZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*
|
|
|
-h-f*g*e,this.w=c*d*e+f*g*h):"ZXY"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"ZYX"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e+f*g*h):"YZX"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e-f*g*h):"XZY"===b&&(this.x=f*d*e-c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e+f*g*h);return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);
|
|
|
-return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;0<j?(c=0.5/Math.sqrt(j+1),this.w=0.25/c,this.x=(i-g)*c,this.y=(d-h)*c,this.z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
|
|
|
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),h=Math.sin(a.y/2),g=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*h*g,this.y=c*h*e-f*d*g,this.z=c*d*g+f*h*e,this.w=c*d*e-f*h*g):"YXZ"===b?(this.x=f*d*e+c*h*g,this.y=c*h*e-f*d*g,this.z=c*d*
|
|
|
+g-f*h*e,this.w=c*d*e+f*h*g):"ZXY"===b?(this.x=f*d*e-c*h*g,this.y=c*h*e+f*d*g,this.z=c*d*g+f*h*e,this.w=c*d*e-f*h*g):"ZYX"===b?(this.x=f*d*e-c*h*g,this.y=c*h*e+f*d*g,this.z=c*d*g-f*h*e,this.w=c*d*e+f*h*g):"YZX"===b?(this.x=f*d*e+c*h*g,this.y=c*h*e+f*d*g,this.z=c*d*g-f*h*e,this.w=c*d*e-f*h*g):"XZY"===b&&(this.x=f*d*e-c*h*g,this.y=c*h*e-f*d*g,this.z=c*d*g+f*h*e,this.w=c*d*e+f*h*g);return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);
|
|
|
+return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],g=b[2],i=b[6],b=b[10],j=c+f+b;0<j?(c=0.5/Math.sqrt(j+1),this.w=0.25/c,this.x=(i-h)*c,this.y=(d-g)*c,this.z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-h)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+g)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-g)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(h+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+g)/c,this.y=(h+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
|
|
|
return this},conjugate:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=this.length();0===a?(this.z=this.y=this.x=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),
|
|
|
-this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,j=b.w;this.x=c*j+f*g+d*i-e*h;this.y=d*j+f*h+e*g-c*i;this.z=e*j+f*i+c*h-d*g;this.w=f*j-c*g-d*h-e*i;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this.x,d=this.y,e=this.z,
|
|
|
-f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;0>g?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,g=-g):this.copy(a);if(1<=g)return this.w=f,this.x=c,this.y=d,this.z=e,this;var h=Math.acos(g),i=Math.sqrt(1-g*g);if(0.001>Math.abs(i))return this.w=0.5*(f+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},equals:function(a){return a.x===this.x&&a.y===
|
|
|
+this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,h=b.x,g=b.y,i=b.z,j=b.w;this.x=c*j+f*h+d*i-e*g;this.y=d*j+f*g+e*h-c*i;this.z=e*j+f*i+c*g-d*h;this.w=f*j-c*h-d*g-e*i;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this.x,d=this.y,e=this.z,
|
|
|
+f=this.w,h=f*a.w+c*a.x+d*a.y+e*a.z;0>h?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,h=-h):this.copy(a);if(1<=h)return this.w=f,this.x=c,this.y=d,this.z=e,this;var g=Math.acos(h),i=Math.sqrt(1-h*h);if(0.001>Math.abs(i))return this.w=0.5*(f+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;h=Math.sin((1-b)*g)/i;g=Math.sin(b*g)/i;this.w=f*h+this.w*g;this.x=c*h+this.x*g;this.y=d*h+this.y*g;this.z=e*h+this.z*g;return this},equals:function(a){return a.x===this.x&&a.y===
|
|
|
this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
|
|
|
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,
|
|
|
b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=
|
|
@@ -36,15 +36,15 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
|
|
|
a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
|
|
|
this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*
|
|
|
b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements,e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);
|
|
|
-this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,a=a.w,h=a*b+f*d-g*c,i=a*c+g*b-e*d,j=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+i*-g-j*-f;this.y=i*a+b*-f+j*-e-h*-g;this.z=j*a+b*-g+h*-f-i*-e;return this},transformDirection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*
|
|
|
+this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,h=a.z,a=a.w,g=a*b+f*d-h*c,i=a*c+h*b-e*d,j=a*d+e*c-f*b,b=-e*b-f*c-h*d;this.x=g*a+b*-e+i*-h-j*-f;this.y=i*a+b*-f+j*-e-g*-h;this.z=j*a+b*-h+g*-f-i*-e;return this},transformDirection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*
|
|
|
b+a[6]*c+a[10]*d;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=
|
|
|
a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=
|
|
|
this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=
|
|
|
-a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],l=d[2],n=d[6],d=d[10];void 0===b||"XYZ"===
|
|
|
-b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-f,e)):(this.x=Math.atan2(n,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?(this.y=Math.atan2(g,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-l,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(n)),0.99999>Math.abs(n)?(this.y=Math.atan2(-l,d),this.z=Math.atan2(-f,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(l)),0.99999>Math.abs(l)?(this.x=Math.atan2(n,d),this.z=Math.atan2(h,
|
|
|
-e)):(this.x=0,this.z=Math.atan2(-f,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-l,e)):(this.x=0,this.y=Math.atan2(g,d))):"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(n,i),this.y=Math.atan2(g,e)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*
|
|
|
-(a.x*a.w-a.y*a.z),g-d-e+f),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),this.y=Math.asin(c(2*(a.y*a.w-a.x*
|
|
|
-a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getScaleFromMatrix:function(a){var b=
|
|
|
+a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],h=d[8],g=d[1],i=d[5],j=d[9],m=d[2],p=d[6],d=d[10];void 0===b||"XYZ"===
|
|
|
+b?(this.y=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-f,e)):(this.x=Math.atan2(p,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?(this.y=Math.atan2(h,d),this.z=Math.atan2(g,i)):(this.y=Math.atan2(-m,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(p)),0.99999>Math.abs(p)?(this.y=Math.atan2(-m,d),this.z=Math.atan2(-f,i)):(this.y=0,this.z=Math.atan2(g,e))):"ZYX"===b?(this.y=Math.asin(-c(m)),0.99999>Math.abs(m)?(this.x=Math.atan2(p,d),this.z=Math.atan2(g,
|
|
|
+e)):(this.x=0,this.z=Math.atan2(-f,i))):"YZX"===b?(this.z=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-m,e)):(this.x=0,this.y=Math.atan2(h,d))):"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(p,i),this.y=Math.atan2(h,e)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,h=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*
|
|
|
+(a.x*a.w-a.y*a.z),h-d-e+f),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),h+d-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),h-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-d+e-f)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),h-d-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),h-d-e+f),this.y=Math.asin(c(2*(a.y*a.w-a.x*
|
|
|
+a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),h+d-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),h-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),h-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+d-e-f),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getScaleFromMatrix:function(a){var b=
|
|
|
this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},getColumnFromMatrix:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];return this},toArray:function(){return[this.x,
|
|
|
this.y,this.z]},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};
|
|
|
THREE.extend(THREE.Vector3.prototype,{applyEuler:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromEuler(b,c);this.applyQuaternion(d);return this}}(),applyAxisAngle:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromAxisAngle(b,c);this.applyQuaternion(d);return this}}(),projectOnVector:function(){var a=new THREE.Vector3;return function(b){a.copy(b).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a=new THREE.Vector3;
|
|
@@ -53,8 +53,8 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
|
|
|
case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},
|
|
|
addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},
|
|
|
applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=
|
|
|
-a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>j?0.01>h?(b=0.707106781,
|
|
|
-c=0,d=0.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&
|
|
|
+a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],h=a[1],g=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-h)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+h)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+g+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;g=(g+1)/2;j=(j+1)/2;d=(d+h)/4;f=(f+c)/4;i=(i+b)/4;e>g&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):g>j?0.01>g?(b=0.707106781,
|
|
|
+c=0,d=0.707106781):(c=Math.sqrt(g),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(h-d)*(h-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+g+j-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&
|
|
|
(this.z=a.z);this.w<a.w&&(this.w=a.w);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*
|
|
|
this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&
|
|
|
a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3};
|
|
@@ -72,53 +72,53 @@ size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},exp
|
|
|
this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a){return new THREE.Vector3((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,
|
|
|
this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,
|
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,
|
|
|
-this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,f,g,h,i){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,f||0,g||0,h||0,void 0!==i?i:1)};
|
|
|
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,i){var j=this.elements;j[0]=a;j[3]=b;j[6]=c;j[1]=d;j[4]=e;j[7]=f;j[2]=g;j[5]=h;j[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},
|
|
|
-multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],a=a[8];return b*f*a-b*g*i-c*e*a+c*g*h+d*e*i-d*f*h},getInverse:function(a,
|
|
|
+this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,f,h,g,i){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,f||0,h||0,g||0,void 0!==i?i:1)};
|
|
|
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,h,g,i){var j=this.elements;j[0]=a;j[3]=b;j[6]=c;j[1]=d;j[4]=e;j[7]=f;j[2]=h;j[5]=g;j[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},
|
|
|
+multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],h=a[5],g=a[6],i=a[7],a=a[8];return b*f*a-b*h*i-c*e*a+c*h*g+d*e*i-d*f*g},getInverse:function(a,
|
|
|
b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/
|
|
|
-c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,l,n,m,p,t,r){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=g||0;q[13]=h||0;q[2]=i||0;q[6]=j||0;q[10]=void 0!==l?l:1;q[14]=n||0;q[3]=m||0;q[7]=p||0;q[11]=t||0;q[15]=void 0!==r?r:1};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,l,n,m,p,t,r){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=j;q[10]=l;q[14]=n;q[3]=m;q[7]=p;q[11]=t;q[15]=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
|
|
|
+c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,h,g,i,j,m,p,l,r,t,n){var s=this.elements=new Float32Array(16);s[0]=void 0!==a?a:1;s[4]=b||0;s[8]=c||0;s[12]=d||0;s[1]=e||0;s[5]=void 0!==f?f:1;s[9]=h||0;s[13]=g||0;s[2]=i||0;s[6]=j||0;s[10]=void 0!==m?m:1;s[14]=p||0;s[3]=l||0;s[7]=r||0;s[11]=t||0;s[15]=void 0!==n?n:1};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,g,i,j,m,p,l,r,t,n){var s=this.elements;s[0]=a;s[4]=b;s[8]=c;s[12]=d;s[1]=e;s[5]=f;s[9]=h;s[13]=g;s[2]=i;s[6]=j;s[10]=m;s[14]=p;s[3]=l;s[7]=r;s[11]=t;s[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
|
|
|
return this.copyPosition(a)},copyPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),setRotationFromEuler:function(a,
|
|
|
-b){console.warn("DEPRECATED: Matrix4's .setRotationFromEuler() has been deprecated in favor of makeRotationFromEuler. Please update your code.");return this.makeRotationFromEuler(a,b)},makeRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var j=g*i,l=g*f,n=d*i,m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+n*e;c[5]=j-m*e;c[9]=-d*h;c[2]=m-j*e;c[6]=n+l*e;c[10]=g*h}else"YXZ"===b?
|
|
|
-(j=h*i,l=h*f,n=e*i,m=e*f,c[0]=j+m*d,c[4]=n*d-l,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=l*d-n,c[6]=m+j*d,c[10]=g*h):"ZXY"===b?(j=h*i,l=h*f,n=e*i,m=e*f,c[0]=j-m*d,c[4]=-g*f,c[8]=n+l*d,c[1]=l+n*d,c[5]=g*i,c[9]=m-j*d,c[2]=-g*e,c[6]=d,c[10]=g*h):"ZYX"===b?(j=g*i,l=g*f,n=d*i,m=d*f,c[0]=h*i,c[4]=n*e-l,c[8]=j*e+m,c[1]=h*f,c[5]=m*e+j,c[9]=l*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(j=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=m-j*f,c[8]=n*f+l,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=l*f+n,c[10]=j-m*f):"XZY"===b&&
|
|
|
-(j=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=j*f+m,c[5]=g*i,c[9]=l*f-n,c[2]=n*f-l,c[6]=d*i,c[10]=m*f+j);c[3]=0;c[7]=0;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=
|
|
|
-c+c,h=d+d,i=e+e,a=c*g,j=c*h,c=c*i,l=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());
|
|
|
-b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],n=c[9],m=c[13],p=c[2],t=c[6],r=c[10],q=c[14],
|
|
|
-s=c[3],u=c[7],w=c[11],c=c[15],y=d[0],F=d[4],J=d[8],B=d[12],E=d[1],z=d[5],G=d[9],I=d[13],O=d[2],C=d[6],H=d[10],M=d[14],A=d[3],R=d[7],K=d[11],d=d[15];e[0]=f*y+g*E+h*O+i*A;e[4]=f*F+g*z+h*C+i*R;e[8]=f*J+g*G+h*H+i*K;e[12]=f*B+g*I+h*M+i*d;e[1]=j*y+l*E+n*O+m*A;e[5]=j*F+l*z+n*C+m*R;e[9]=j*J+l*G+n*H+m*K;e[13]=j*B+l*I+n*M+m*d;e[2]=p*y+t*E+r*O+q*A;e[6]=p*F+t*z+r*C+q*R;e[10]=p*J+t*G+r*H+q*K;e[14]=p*B+t*I+r*M+q*d;e[3]=s*y+u*E+w*O+c*A;e[7]=s*F+u*z+w*C+c*R;e[11]=s*J+u*G+w*H+c*K;e[15]=s*B+u*I+w*M+c*d;return this},
|
|
|
+b){console.warn("DEPRECATED: Matrix4's .setRotationFromEuler() has been deprecated in favor of makeRotationFromEuler. Please update your code.");return this.makeRotationFromEuler(a,b)},makeRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,h=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var j=h*i,m=h*f,p=d*i,l=d*f;c[0]=g*i;c[4]=-g*f;c[8]=e;c[1]=m+p*e;c[5]=j-l*e;c[9]=-d*g;c[2]=l-j*e;c[6]=p+m*e;c[10]=h*g}else"YXZ"===b?
|
|
|
+(j=g*i,m=g*f,p=e*i,l=e*f,c[0]=j+l*d,c[4]=p*d-m,c[8]=h*e,c[1]=h*f,c[5]=h*i,c[9]=-d,c[2]=m*d-p,c[6]=l+j*d,c[10]=h*g):"ZXY"===b?(j=g*i,m=g*f,p=e*i,l=e*f,c[0]=j-l*d,c[4]=-h*f,c[8]=p+m*d,c[1]=m+p*d,c[5]=h*i,c[9]=l-j*d,c[2]=-h*e,c[6]=d,c[10]=h*g):"ZYX"===b?(j=h*i,m=h*f,p=d*i,l=d*f,c[0]=g*i,c[4]=p*e-m,c[8]=j*e+l,c[1]=g*f,c[5]=l*e+j,c[9]=m*e-p,c[2]=-e,c[6]=d*g,c[10]=h*g):"YZX"===b?(j=h*g,m=h*e,p=d*g,l=d*e,c[0]=g*i,c[4]=l-j*f,c[8]=p*f+m,c[1]=f,c[5]=h*i,c[9]=-d*i,c[2]=-e*i,c[6]=m*f+p,c[10]=j-l*f):"XZY"===b&&
|
|
|
+(j=h*g,m=h*e,p=d*g,l=d*e,c[0]=g*i,c[4]=-f,c[8]=e*i,c[1]=j*f+l,c[5]=h*i,c[9]=m*f-p,c[2]=p*f-m,c[6]=d*i,c[10]=l*f+j);c[3]=0;c[7]=0;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=
|
|
|
+c+c,g=d+d,i=e+e,a=c*h,j=c*g,c=c*i,m=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(m+e);b[4]=j-f;b[8]=c+g;b[1]=j+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+m);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());
|
|
|
+b.crossVectors(c,a);h[0]=a.x;h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],j=c[1],m=c[5],p=c[9],l=c[13],r=c[2],t=c[6],n=c[10],s=c[14],
|
|
|
+q=c[3],v=c[7],y=c[11],c=c[15],D=d[0],F=d[4],H=d[8],I=d[12],G=d[1],B=d[5],C=d[9],A=d[13],J=d[2],N=d[6],z=d[10],L=d[14],w=d[3],Z=d[7],K=d[11],d=d[15];e[0]=f*D+h*G+g*J+i*w;e[4]=f*F+h*B+g*N+i*Z;e[8]=f*H+h*C+g*z+i*K;e[12]=f*I+h*A+g*L+i*d;e[1]=j*D+m*G+p*J+l*w;e[5]=j*F+m*B+p*N+l*Z;e[9]=j*H+m*C+p*z+l*K;e[13]=j*I+m*A+p*L+l*d;e[2]=r*D+t*G+n*J+s*w;e[6]=r*F+t*B+n*N+s*Z;e[10]=r*H+t*C+n*z+s*K;e[14]=r*I+t*A+n*L+s*d;e[3]=q*D+v*G+y*J+c*w;e[7]=q*F+v*B+y*N+c*Z;e[11]=q*H+v*C+y*z+c*K;e[15]=q*I+v*A+y*L+c*d;return this},
|
|
|
multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
|
|
|
-a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],l=a[6],n=a[10],m=a[14];return a[3]*(+e*h*l-d*i*l-e*g*n+c*i*n+d*g*m-c*h*m)+a[7]*(+b*h*m-b*i*n+e*f*n-d*f*m+d*i*j-e*h*j)+a[11]*(+b*i*l-b*g*m-e*f*l+c*f*m+e*g*j-c*i*j)+a[15]*(-d*g*j-b*h*l+b*g*n+d*f*l-c*f*
|
|
|
-n+c*h*j)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
|
|
|
+a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],j=a[2],m=a[6],p=a[10],l=a[14];return a[3]*(+e*g*m-d*i*m-e*h*p+c*i*p+d*h*l-c*g*l)+a[7]*(+b*g*l-b*i*p+e*f*p-d*f*l+d*i*j-e*g*j)+a[11]*(+b*i*m-b*h*l-e*f*m+c*f*l+e*h*j-c*i*j)+a[15]*(-d*h*j-b*g*m+b*h*p+d*f*m-c*f*
|
|
|
+p+c*g*j)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
|
|
|
a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
|
|
|
-b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],i=d[1],j=d[5],l=d[9],n=d[13],m=d[2],p=d[6],t=d[10],r=d[14],q=d[3],s=d[7],u=d[11],w=d[15];c[0]=l*r*s-n*t*s+n*p*u-j*r*u-l*p*w+j*t*w;c[4]=h*t*s-g*r*s-h*p*u+f*r*u+g*p*w-f*t*w;c[8]=g*n*s-h*l*s+h*j*u-f*n*u-g*j*w+f*l*w;c[12]=h*l*p-g*n*p-h*j*t+f*n*t+g*j*r-f*l*r;c[1]=n*t*q-l*r*q-n*m*u+i*r*u+l*m*w-i*t*w;c[5]=g*r*q-h*t*q+h*m*u-e*r*u-g*m*w+e*t*w;c[9]=h*l*q-g*n*q-h*i*u+e*n*u+g*i*w-
|
|
|
-e*l*w;c[13]=g*n*m-h*l*m+h*i*t-e*n*t-g*i*r+e*l*r;c[2]=j*r*q-n*p*q+n*m*s-i*r*s-j*m*w+i*p*w;c[6]=h*p*q-f*r*q-h*m*s+e*r*s+f*m*w-e*p*w;c[10]=f*n*q-h*j*q+h*i*s-e*n*s-f*i*w+e*j*w;c[14]=h*j*m-f*n*m-h*i*p+e*n*p+f*i*r-e*j*r;c[3]=l*p*q-j*t*q-l*m*s+i*t*s+j*m*u-i*p*u;c[7]=f*t*q-g*p*q+g*m*s-e*t*s-f*m*u+e*p*u;c[11]=g*j*q-f*l*q-g*i*s+e*l*s+f*i*u-e*j*u;c[15]=f*l*m-g*j*m+g*i*p-e*l*p-f*i*t+e*j*t;c=d[0]*c[0]+d[1]*c[4]+d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
+b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],j=d[5],m=d[9],p=d[13],l=d[2],r=d[6],t=d[10],n=d[14],s=d[3],q=d[7],v=d[11],y=d[15];c[0]=m*n*q-p*t*q+p*r*v-j*n*v-m*r*y+j*t*y;c[4]=g*t*q-h*n*q-g*r*v+f*n*v+h*r*y-f*t*y;c[8]=h*p*q-g*m*q+g*j*v-f*p*v-h*j*y+f*m*y;c[12]=g*m*r-h*p*r-g*j*t+f*p*t+h*j*n-f*m*n;c[1]=p*t*s-m*n*s-p*l*v+i*n*v+m*l*y-i*t*y;c[5]=h*n*s-g*t*s+g*l*v-e*n*v-h*l*y+e*t*y;c[9]=g*m*s-h*p*s-g*i*v+e*p*v+h*i*y-
|
|
|
+e*m*y;c[13]=h*p*l-g*m*l+g*i*t-e*p*t-h*i*n+e*m*n;c[2]=j*n*s-p*r*s+p*l*q-i*n*q-j*l*y+i*r*y;c[6]=g*r*s-f*n*s-g*l*q+e*n*q+f*l*y-e*r*y;c[10]=f*p*s-g*j*s+g*i*q-e*p*q-f*i*y+e*j*y;c[14]=g*j*l-f*p*l-g*i*r+e*p*r+f*i*n-e*j*n;c[3]=m*r*s-j*t*s-m*l*q+i*t*q+j*l*v-i*r*v;c[7]=f*t*s-h*r*s+h*l*q-e*t*q-f*l*v+e*r*v;c[11]=h*j*s-f*m*s-h*i*q+e*m*q+f*i*v-e*j*v;c[15]=f*m*l-h*j*l+h*i*r-e*m*r-f*i*t+e*j*t;c=d[0]*c[0]+d[1]*c[4]+d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
|
|
|
scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,
|
|
|
-0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
|
+0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,g=a.z,i=e*f,j=e*h;this.set(i*f+c,i*h-d*g,i*g+d*h,0,i*h+d*g,j*h+c,j*g-d*f,0,i*g-d*h,j*g+d*f,e*g*g+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
|
0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){console.warn("DEPRECATED: Matrix4's .compose() has been deprecated in favor of makeFromPositionQuaternionScale. Please update your code.");return this.makeFromPositionQuaternionScale(a,b,c)},makeFromPositionQuaternionScale:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},makeFromPositionEulerScale:function(a,b,c,d){this.makeRotationFromEuler(b,c);this.scale(d);this.setPosition(a);return this},
|
|
|
-makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/
|
|
|
-i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};
|
|
|
-THREE.extend(THREE.Matrix4.prototype,{decompose:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Matrix4;return function(e,f,g){var h=this.elements;a.set(h[0],h[1],h[2]);b.set(h[4],h[5],h[6]);c.set(h[8],h[9],h[10]);e=e instanceof THREE.Vector3?e:new THREE.Vector3;f=f instanceof THREE.Quaternion?f:new THREE.Quaternion;g=g instanceof THREE.Vector3?g:new THREE.Vector3;g.x=a.length();g.y=b.length();g.z=c.length();e.x=h[12];e.y=h[13];e.z=h[14];d.copy(this);d.elements[0]/=
|
|
|
-g.x;d.elements[1]/=g.x;d.elements[2]/=g.x;d.elements[4]/=g.y;d.elements[5]/=g.y;d.elements[6]/=g.y;d.elements[8]/=g.z;d.elements[9]/=g.z;d.elements[10]/=g.z;f.setFromRotationMatrix(d);return[e,f,g]}}()});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
|
|
|
+makeFrustum:function(a,b,c,d,e,f){var h=this.elements;h[0]=2*e/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*e/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(f+e)/(f-e);h[14]=-2*f*e/(f-e);h[3]=0;h[7]=0;h[11]=-1;h[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var h=this.elements,g=b-a,i=c-d,j=f-e;h[0]=2/g;h[4]=0;h[8]=0;h[12]=-((b+a)/g);h[1]=0;h[5]=2/
|
|
|
+i;h[9]=0;h[13]=-((c+d)/i);h[2]=0;h[6]=0;h[10]=-2/j;h[14]=-((f+e)/j);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};
|
|
|
+THREE.extend(THREE.Matrix4.prototype,{decompose:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Matrix4;return function(e,f,h){var g=this.elements;a.set(g[0],g[1],g[2]);b.set(g[4],g[5],g[6]);c.set(g[8],g[9],g[10]);e=e instanceof THREE.Vector3?e:new THREE.Vector3;f=f instanceof THREE.Quaternion?f:new THREE.Quaternion;h=h instanceof THREE.Vector3?h:new THREE.Vector3;h.x=a.length();h.y=b.length();h.z=c.length();e.x=g[12];e.y=g[13];e.z=g[14];d.copy(this);d.elements[0]/=
|
|
|
+h.x;d.elements[1]/=h.x;d.elements[2]/=h.x;d.elements[4]/=h.y;d.elements[5]/=h.y;d.elements[6]/=h.y;d.elements[8]/=h.z;d.elements[9]/=h.z;d.elements[10]/=h.z;f.setFromRotationMatrix(d);return[e,f,h]}}()});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
|
|
|
THREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);
|
|
|
var d=c.dot(this.direction);return c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){return 0!=a.normal.dot(this.direction)||0==a.distanceToPoint(this.origin)?!0:!1},distanceToPlane:function(a){var b=
|
|
|
a.normal.dot(this.direction);if(0==b){if(0==a.distanceToPoint(this.origin))return 0}else return-(this.origin.dot(a.normal)+a.constant)/b},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return void 0===c?void 0:this.at(c,b)},applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};
|
|
|
THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromCenterAndPoints:function(a,b){for(var c=0,d=0,e=b.length;d<e;d++)var f=a.distanceToSquared(b[d]),c=Math.max(c,f);this.center=a;this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
|
|
|
this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);
|
|
|
this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
|
|
|
-THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],l=c[8],n=c[9],m=c[10],p=c[11],t=c[12],r=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,j-g,p-l,c-t).normalize();b[1].setComponents(f+
|
|
|
-a,j+g,p+l,c+t).normalize();b[2].setComponents(f+d,j+h,p+n,c+r).normalize();b[3].setComponents(f-d,j-h,p-n,c-r).normalize();b[4].setComponents(f-e,j-i,p-m,c-q).normalize();b[5].setComponents(f+e,j+i,p+m,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)<b)return!1;return!0}}(),intersectsSphere:function(a){for(var b=
|
|
|
+THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],j=c[7],m=c[8],p=c[9],l=c[10],r=c[11],t=c[12],n=c[13],s=c[14],c=c[15];b[0].setComponents(f-a,j-h,r-m,c-t).normalize();b[1].setComponents(f+
|
|
|
+a,j+h,r+m,c+t).normalize();b[2].setComponents(f+d,j+g,r+p,c+n).normalize();b[3].setComponents(f-d,j-g,r-p,c-n).normalize();b[4].setComponents(f-e,j-i,r-l,c-s).normalize();b[5].setComponents(f+e,j+i,r+l,c+s).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)<b)return!1;return!0}}(),intersectsSphere:function(a){for(var b=
|
|
|
this.planes,c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
|
|
|
THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,
|
|
|
c);return this}}(),copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,
|
|
|
b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start),a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectLine:function(){var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),f=this.normal.dot(e);if(0==f){if(0==this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)}}(),
|
|
|
coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){var d=d||(new THREE.Matrix3).getNormalMatrix(c),e=a.copy(this.normal).applyMatrix3(d),f=this.coplanarPoint(b);f.applyMatrix4(c);this.setFromNormalAndCoplanarPoint(e,f);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&
|
|
|
a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}};THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,
|
|
|
-b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,l,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
-f+2;j=this.points[c[0]];l=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,n.x,m.x,g,h,i);d.y=b(j.y,l.y,n.y,m.y,g,h,i);d.z=b(j.z,l.z,n.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
|
|
|
-a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
|
|
|
-h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();
|
|
|
-THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,h){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),f=a.dot(c),i=b.dot(b),g=b.dot(c),j=d*i-e*e,h=h||new THREE.Vector3;if(0==j)return h.set(-2,-1,-1);j=1/j;i=(i*f-e*g)*j;d=(d*g-e*f)*j;return h.set(1-i-d,d,i)}}();
|
|
|
+b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,g,i,j,m,p,l;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);h=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
+f+2;j=this.points[c[0]];m=this.points[c[1]];p=this.points[c[2]];l=this.points[c[3]];g=h*h;i=h*g;d.x=b(j.x,m.x,p.x,l.x,h,g,i);d.y=b(j.y,m.y,p.y,l.y,h,g,i);d.z=b(j.z,m.z,p.z,l.z,h,g,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,g=[],i=0;g[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
|
|
|
+a/c,d=this.getPoint(b),h.copy(d),i+=h.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(g[b]=i,e=b);g[g.length]=i;return{chunks:g,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,h,g=[],i=new THREE.Vector3,j=this.getLength();g.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];h=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)d=e+c*(1/h)*(f-e),d=this.getPoint(d),
|
|
|
+g.push(i.copy(d).clone());g.push(i.copy(this.points[b]).clone())}this.points=g}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();
|
|
|
+THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,h,g){a.subVectors(h,e);b.subVectors(f,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),f=a.dot(c),i=b.dot(b),h=b.dot(c),j=d*i-e*e,g=g||new THREE.Vector3;if(0==j)return g.set(-2,-1,-1);j=1/j;i=(i*f-e*h)*j;d=(d*h-e*f)*j;return g.set(1-i-d,d,i)}}();
|
|
|
THREE.Triangle.containsPoint=function(){var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}();
|
|
|
THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return 0.5*a.cross(b).length()}}(),midpoint:function(a){return(a||
|
|
|
new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)},
|
|
@@ -126,11 +126,11 @@ clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Vertex=function(a
|
|
|
THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():
|
|
|
Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){};
|
|
|
THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!==
|
|
|
-this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.lengthSq()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=function(h,j,m){if(h instanceof a.Particle){f.getPositionFromMatrix(h.matrixWorld);var p=j.ray.distanceToPoint(f);if(p>h.scale.x)return m;m.push({distance:p,point:h.position,face:null,object:h})}else if(h instanceof
|
|
|
-a.LOD)f.getPositionFromMatrix(h.matrixWorld),p=j.ray.origin.distanceTo(f),i(h.getObjectForDistance(p),j,m);else if(h instanceof a.Mesh){f.getPositionFromMatrix(h.matrixWorld);b.set(f,h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis());if(!j.ray.isIntersectionSphere(b))return m;var p=h.geometry,t=p.vertices,r=h.material instanceof a.MeshFaceMaterial,q=!0===r?h.material.materials:null,s=h.material.side,u,w,y,F=j.precision;g.getInverse(h.matrixWorld);c.copy(j.ray).applyMatrix4(g);for(var J=
|
|
|
-0,B=p.faces.length;J<B;J++){var E=p.faces[J],s=!0===r?q[E.materialIndex]:h.material;if(void 0!==s){d.setFromNormalAndCoplanarPoint(E.normal,t[E.a]);var z=c.distanceToPlane(d);if(!(Math.abs(z)<F)&&!(0>z)){s=s.side;if(s!==a.DoubleSide&&(u=c.direction.dot(d.normal),!(s===a.FrontSide?0>u:0<u)))continue;if(!(z<j.near||z>j.far)){e=c.at(z,e);if(E instanceof a.Face3){if(s=t[E.a],u=t[E.b],w=t[E.c],!a.Triangle.containsPoint(e,s,u,w))continue}else if(E instanceof a.Face4){if(s=t[E.a],u=t[E.b],w=t[E.c],y=t[E.d],
|
|
|
-!a.Triangle.containsPoint(e,s,u,y)&&!a.Triangle.containsPoint(e,u,w,y))continue}else throw Error("face type not supported");m.push({distance:z,point:j.ray.at(z),face:E,faceIndex:J,object:h})}}}}}},j=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)i(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===
|
|
|
-b&&j(a,this,c);i(a,this,c);c.sort(h);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)i(a[d],this,c),!0===b&&j(a[d],this,c);c.sort(h);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=
|
|
|
+this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.lengthSq()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Vector3,h=new a.Matrix4,g=function(a,b){return a.distance-b.distance},i=function(g,j,l){if(g instanceof a.Particle){f.getPositionFromMatrix(g.matrixWorld);var r=j.ray.distanceToPoint(f);if(r>g.scale.x)return l;l.push({distance:r,point:g.position,face:null,object:g})}else if(g instanceof
|
|
|
+a.LOD)f.getPositionFromMatrix(g.matrixWorld),r=j.ray.origin.distanceTo(f),i(g.getObjectForDistance(r),j,l);else if(g instanceof a.Mesh){f.getPositionFromMatrix(g.matrixWorld);b.set(f,g.geometry.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!j.ray.isIntersectionSphere(b))return l;var r=g.geometry,t=r.vertices,n=g.material instanceof a.MeshFaceMaterial,s=!0===n?g.material.materials:null,q=g.material.side,v,y,D,F=j.precision;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);for(var H=
|
|
|
+0,I=r.faces.length;H<I;H++){var G=r.faces[H],q=!0===n?s[G.materialIndex]:g.material;if(void 0!==q){d.setFromNormalAndCoplanarPoint(G.normal,t[G.a]);var B=c.distanceToPlane(d);if(!(Math.abs(B)<F)&&!(0>B)){q=q.side;if(q!==a.DoubleSide&&(v=c.direction.dot(d.normal),!(q===a.FrontSide?0>v:0<v)))continue;if(!(B<j.near||B>j.far)){e=c.at(B,e);if(G instanceof a.Face3){if(q=t[G.a],v=t[G.b],y=t[G.c],!a.Triangle.containsPoint(e,q,v,y))continue}else if(G instanceof a.Face4){if(q=t[G.a],v=t[G.b],y=t[G.c],D=t[G.d],
|
|
|
+!a.Triangle.containsPoint(e,q,v,D)&&!a.Triangle.containsPoint(e,v,y,D))continue}else throw Error("face type not supported");l.push({distance:B,point:j.ray.at(B),face:G,faceIndex:H,object:g})}}}}}},j=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)i(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===
|
|
|
+b&&j(a,this,c);i(a,this,c);c.sort(g);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)i(a[d],this,c),!0===b&&j(a[d],this,c);c.sort(g);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=
|
|
|
!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,applyMatrix:function(){var a=new THREE.Matrix4;return function(b){this.matrix.multiplyMatrices(b,this.matrix);this.position.getPositionFromMatrix(this.matrix);this.scale.getScaleFromMatrix(this.matrix);
|
|
|
a.extractRotation(this.matrix);!0===this.useQuaternion?this.quaternion.setFromRotationMatrix(a):this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder)}}(),rotateOnAxis:function(){var a=new THREE.Quaternion,b=new THREE.Quaternion;return function(c,d){a.setFromAxisAngle(c,d);!0===this.useQuaternion?this.quaternion.multiply(a):(b.setFromEuler(this.rotation,this.eulerOrder),b.multiply(a),this.rotation.setEulerFromQuaternion(b,this.eulerOrder));return this}}(),translateOnAxis:function(){var a=new THREE.Vector3;
|
|
@@ -141,51 +141,51 @@ if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.paren
|
|
|
if(e.name===a||!0===b&&(e=e.getObjectByName(a,b),void 0!==e))return e}},getChildByName:function(a,b){console.warn("DEPRECATED: Object3D's .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a,b)},getDescendants:function(a){void 0===a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){!1===this.useQuaternion?this.matrix.makeFromPositionEulerScale(this.position,
|
|
|
this.rotation,this.eulerOrder,this.scale):this.matrix.makeFromPositionQuaternionScale(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},
|
|
|
clone:function(a){void 0===a&&(a=new THREE.Object3D);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(this.rotation);a.eulerOrder=this.eulerOrder;a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);
|
|
|
-a.useQuaternion=this.useQuaternion;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());return a}};THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(j===n){var a=new THREE.RenderableVertex;l.push(a);n++;j++;return a}return l[j++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
|
-c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,j,l=[],n=0,m,p,t=[],r=0,q,s=[],u=0,w,y,F=[],J=0,B,E,z=[],G=0,I={objects:[],sprites:[],lights:[],elements:[]},O=new THREE.Vector3,C=new THREE.Vector4,H=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),M=new THREE.Box3,A=Array(3),R=Array(4),K=new THREE.Matrix4,fa=new THREE.Matrix4,wa,Ma=new THREE.Matrix4,N=new THREE.Matrix3,W=new THREE.Matrix3,ja=new THREE.Vector3,na=new THREE.Frustum,L=new THREE.Vector4,ea=new THREE.Vector4;
|
|
|
-this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);fa.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(fa)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);fa.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(fa)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,
|
|
|
-c)};this.projectScene=function(g,h,n,Ka){var qa=!1,pa,Y,ga,V,$,la,ha,ia,Qa,kb,oa,Xa,Ra;E=y=q=p=0;I.elements.length=0;!0===g.autoUpdate&&g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();K.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));fa.multiplyMatrices(h.projectionMatrix,K);W.getNormalMatrix(K);na.setFromMatrix(fa);f=0;I.objects.length=0;I.sprites.length=0;I.lights.length=0;var Aa=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof
|
|
|
-THREE.Light)I.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===na.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(O.getPositionFromMatrix(f.matrixWorld),O.applyProjection(fa),e.z=O.z),I.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(O.getPositionFromMatrix(f.matrixWorld),O.applyProjection(fa),e.z=O.z),I.sprites.push(e)):(e=a(),e.object=
|
|
|
-f,null!==f.renderDepth?e.z=f.renderDepth:(O.getPositionFromMatrix(f.matrixWorld),O.applyProjection(fa),e.z=O.z),I.objects.push(e));Aa(f)}}};Aa(g);!0===n&&I.objects.sort(c);g=0;for(n=I.objects.length;g<n;g++)if(ia=I.objects[g].object,wa=ia.matrixWorld,j=0,ia instanceof THREE.Mesh){Qa=ia.geometry;ga=Qa.vertices;kb=Qa.faces;Qa=Qa.faceVertexUvs;N.getNormalMatrix(wa);Xa=ia.material instanceof THREE.MeshFaceMaterial;Ra=!0===Xa?ia.material:null;pa=0;for(Y=ga.length;pa<Y;pa++)i=b(),i.positionWorld.copy(ga[pa]).applyMatrix4(wa),
|
|
|
-i.positionScreen.copy(i.positionWorld).applyMatrix4(fa),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.positionScreen.z/=i.positionScreen.w,i.visible=!(-1>i.positionScreen.x||1<i.positionScreen.x||-1>i.positionScreen.y||1<i.positionScreen.y||-1>i.positionScreen.z||1<i.positionScreen.z);ga=0;for(pa=kb.length;ga<pa;ga++){Y=kb[ga];var Sa=!0===Xa?Ra.materials[Y.materialIndex]:ia.material;if(void 0!==Sa){la=Sa.side;if(Y instanceof THREE.Face3)if(V=l[Y.a],$=l[Y.b],ha=l[Y.c],
|
|
|
-A[0]=V.positionScreen,A[1]=$.positionScreen,A[2]=ha.positionScreen,!0===V.visible||!0===$.visible||!0===ha.visible||H.isIntersectionBox(M.setFromPoints(A)))if(qa=0>(ha.positionScreen.x-V.positionScreen.x)*($.positionScreen.y-V.positionScreen.y)-(ha.positionScreen.y-V.positionScreen.y)*($.positionScreen.x-V.positionScreen.x),la===THREE.DoubleSide||qa===(la===THREE.FrontSide))p===r?(oa=new THREE.RenderableFace3,t.push(oa),r++,p++,m=oa):m=t[p++],m.v1.copy(V),m.v2.copy($),m.v3.copy(ha);else continue;
|
|
|
-else continue;else if(Y instanceof THREE.Face4)if(V=l[Y.a],$=l[Y.b],ha=l[Y.c],oa=l[Y.d],R[0]=V.positionScreen,R[1]=$.positionScreen,R[2]=ha.positionScreen,R[3]=oa.positionScreen,!0===V.visible||!0===$.visible||!0===ha.visible||!0===oa.visible||H.isIntersectionBox(M.setFromPoints(R)))if(qa=0>(oa.positionScreen.x-V.positionScreen.x)*($.positionScreen.y-V.positionScreen.y)-(oa.positionScreen.y-V.positionScreen.y)*($.positionScreen.x-V.positionScreen.x)||0>($.positionScreen.x-ha.positionScreen.x)*(oa.positionScreen.y-
|
|
|
-ha.positionScreen.y)-($.positionScreen.y-ha.positionScreen.y)*(oa.positionScreen.x-ha.positionScreen.x),la===THREE.DoubleSide||qa===(la===THREE.FrontSide)){if(q===u){var tb=new THREE.RenderableFace4;s.push(tb);u++;q++;m=tb}else m=s[q++];m.v1.copy(V);m.v2.copy($);m.v3.copy(ha);m.v4.copy(oa)}else continue;else continue;m.normalModel.copy(Y.normal);!1===qa&&(la===THREE.BackSide||la===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(N).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(W);
|
|
|
-m.centroidModel.copy(Y.centroid).applyMatrix4(wa);ha=Y.vertexNormals;V=0;for($=ha.length;V<$;V++)oa=m.vertexNormalsModel[V],oa.copy(ha[V]),!1===qa&&(la===THREE.BackSide||la===THREE.DoubleSide)&&oa.negate(),oa.applyMatrix3(N).normalize(),m.vertexNormalsModelView[V].copy(oa).applyMatrix3(W);m.vertexNormalsLength=ha.length;V=0;for($=Qa.length;V<$;V++)if(oa=Qa[V][ga],void 0!==oa){la=0;for(ha=oa.length;la<ha;la++)m.uvs[V][la]=oa[la]}m.color=Y.color;m.material=Sa;ja.copy(m.centroidModel).applyProjection(fa);
|
|
|
-m.z=ja.z;I.elements.push(m)}}}else if(ia instanceof THREE.Line){Ma.multiplyMatrices(fa,wa);ga=ia.geometry.vertices;V=b();V.positionScreen.copy(ga[0]).applyMatrix4(Ma);kb=ia.type===THREE.LinePieces?2:1;pa=1;for(Y=ga.length;pa<Y;pa++)V=b(),V.positionScreen.copy(ga[pa]).applyMatrix4(Ma),0<(pa+1)%kb||($=l[j-2],L.copy(V.positionScreen),ea.copy($.positionScreen),!0===d(L,ea)&&(L.multiplyScalar(1/L.w),ea.multiplyScalar(1/ea.w),y===J?(Qa=new THREE.RenderableLine,F.push(Qa),J++,y++,w=Qa):w=F[y++],w.v1.positionScreen.copy(L),
|
|
|
-w.v2.positionScreen.copy(ea),w.z=Math.max(L.z,ea.z),w.material=ia.material,ia.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(ia.geometry.colors[pa]),w.vertexColors[1].copy(ia.geometry.colors[pa-1])),I.elements.push(w)))}g=0;for(n=I.sprites.length;g<n;g++)ia=I.sprites[g].object,wa=ia.matrixWorld,ia instanceof THREE.Particle&&(C.set(wa.elements[12],wa.elements[13],wa.elements[14],1),C.applyMatrix4(fa),C.z/=C.w,0<C.z&&1>C.z&&(E===G?(qa=new THREE.RenderableParticle,z.push(qa),G++,
|
|
|
-E++,B=qa):B=z[E++],B.object=ia,B.x=C.x/C.w,B.y=C.y/C.w,B.z=C.z,B.rotation=ia.rotation.z,B.scale.x=ia.scale.x*Math.abs(B.x-(C.x+h.projectionMatrix.elements[0])/(C.w+h.projectionMatrix.elements[12])),B.scale.y=ia.scale.y*Math.abs(B.y-(C.y+h.projectionMatrix.elements[5])/(C.w+h.projectionMatrix.elements[13])),B.material=ia.material,I.elements.push(B)));!0===Ka&&I.elements.sort(c);return I}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
+a.useQuaternion=this.useQuaternion;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());return a}};THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===m){var a=new THREE.RenderableVertex;j.push(a);m++;i++;return a}return j[i++]}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=0,g,i,j=[],m=0,p,l,r=[],t=0,n,s=[],
|
|
|
+q=0,v,y,D=[],F=0,H,I,G=[],B=0,C={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,J=new THREE.Vector4,N=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),z=new THREE.Box3,L=Array(3),w=Array(4),Z=new THREE.Matrix4,K=new THREE.Matrix4,oa,Pa=new THREE.Matrix4,Va=new THREE.Matrix3,O=new THREE.Matrix3,qa=new THREE.Vector3,Fa=new THREE.Frustum,wa=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);K.multiplyMatrices(b.projectionMatrix,
|
|
|
+b.matrixWorldInverse);return a.applyProjection(K)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);K.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(K)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var V=function(a){if(e===h){var b=new THREE.RenderableObject;f.push(b);h++;e++;d=b}else d=f[e++];
|
|
|
+d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(A.getPositionFromMatrix(a.matrixWorld),A.applyProjection(K),d.z=A.z);return d},ea=function(a){if(!1!==a.visible){a instanceof THREE.Light?C.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===Fa.intersectsObject(a))&&C.objects.push(V(a)):(a instanceof THREE.Sprite||a instanceof THREE.Particle)&&C.sprites.push(V(a));for(var b=0,c=a.children.length;b<c;b++)ea(a.children[b])}};this.projectScene=function(d,f,h,
|
|
|
+m){var V=!1,A,fa,da,T,aa,la,Y,ma,xa,bb,ia,ha,ra;I=y=n=l=0;C.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();Z.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));K.multiplyMatrices(f.projectionMatrix,Z);O.getNormalMatrix(Z);Fa.setFromMatrix(K);e=0;C.objects.length=0;C.sprites.length=0;C.lights.length=0;ea(d);!0===h&&C.objects.sort(b);d=0;for(h=C.objects.length;d<h;d++)if(ma=C.objects[d].object,oa=ma.matrixWorld,i=0,ma instanceof THREE.Mesh){xa=
|
|
|
+ma.geometry;da=xa.vertices;bb=xa.faces;xa=xa.faceVertexUvs;Va.getNormalMatrix(oa);ha=ma.material instanceof THREE.MeshFaceMaterial;ra=!0===ha?ma.material:null;A=0;for(fa=da.length;A<fa;A++)g=a(),g.positionWorld.copy(da[A]).applyMatrix4(oa),g.positionScreen.copy(g.positionWorld).applyMatrix4(K),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.positionScreen.z/=g.positionScreen.w,g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||
|
|
|
+-1>g.positionScreen.z||1<g.positionScreen.z);da=0;for(A=bb.length;da<A;da++){fa=bb[da];var ka=!0===ha?ra.materials[fa.materialIndex]:ma.material;if(void 0!==ka){la=ka.side;if(fa instanceof THREE.Face3)if(T=j[fa.a],aa=j[fa.b],Y=j[fa.c],L[0]=T.positionScreen,L[1]=aa.positionScreen,L[2]=Y.positionScreen,!0===T.visible||!0===aa.visible||!0===Y.visible||N.isIntersectionBox(z.setFromPoints(L)))if(V=0>(Y.positionScreen.x-T.positionScreen.x)*(aa.positionScreen.y-T.positionScreen.y)-(Y.positionScreen.y-T.positionScreen.y)*
|
|
|
+(aa.positionScreen.x-T.positionScreen.x),la===THREE.DoubleSide||V===(la===THREE.FrontSide))l===t?(ia=new THREE.RenderableFace3,r.push(ia),t++,l++,p=ia):p=r[l++],p.v1.copy(T),p.v2.copy(aa),p.v3.copy(Y);else continue;else continue;else if(fa instanceof THREE.Face4)if(T=j[fa.a],aa=j[fa.b],Y=j[fa.c],ia=j[fa.d],w[0]=T.positionScreen,w[1]=aa.positionScreen,w[2]=Y.positionScreen,w[3]=ia.positionScreen,!0===T.visible||!0===aa.visible||!0===Y.visible||!0===ia.visible||N.isIntersectionBox(z.setFromPoints(w)))if(V=
|
|
|
+0>(ia.positionScreen.x-T.positionScreen.x)*(aa.positionScreen.y-T.positionScreen.y)-(ia.positionScreen.y-T.positionScreen.y)*(aa.positionScreen.x-T.positionScreen.x)||0>(aa.positionScreen.x-Y.positionScreen.x)*(ia.positionScreen.y-Y.positionScreen.y)-(aa.positionScreen.y-Y.positionScreen.y)*(ia.positionScreen.x-Y.positionScreen.x),la===THREE.DoubleSide||V===(la===THREE.FrontSide)){if(n===q){var ua=new THREE.RenderableFace4;s.push(ua);q++;n++;p=ua}else p=s[n++];p.v1.copy(T);p.v2.copy(aa);p.v3.copy(Y);
|
|
|
+p.v4.copy(ia)}else continue;else continue;p.normalModel.copy(fa.normal);!1===V&&(la===THREE.BackSide||la===THREE.DoubleSide)&&p.normalModel.negate();p.normalModel.applyMatrix3(Va).normalize();p.normalModelView.copy(p.normalModel).applyMatrix3(O);p.centroidModel.copy(fa.centroid).applyMatrix4(oa);Y=fa.vertexNormals;T=0;for(aa=Y.length;T<aa;T++)ia=p.vertexNormalsModel[T],ia.copy(Y[T]),!1===V&&(la===THREE.BackSide||la===THREE.DoubleSide)&&ia.negate(),ia.applyMatrix3(Va).normalize(),p.vertexNormalsModelView[T].copy(ia).applyMatrix3(O);
|
|
|
+p.vertexNormalsLength=Y.length;T=0;for(aa=xa.length;T<aa;T++)if(ia=xa[T][da],void 0!==ia){la=0;for(Y=ia.length;la<Y;la++)p.uvs[T][la]=ia[la]}p.color=fa.color;p.material=ka;qa.copy(p.centroidModel).applyProjection(K);p.z=qa.z;C.elements.push(p)}}}else if(ma instanceof THREE.Line){Pa.multiplyMatrices(K,oa);da=ma.geometry.vertices;T=a();T.positionScreen.copy(da[0]).applyMatrix4(Pa);bb=ma.type===THREE.LinePieces?2:1;A=1;for(fa=da.length;A<fa;A++)T=a(),T.positionScreen.copy(da[A]).applyMatrix4(Pa),0<(A+
|
|
|
+1)%bb||(aa=j[i-2],wa.copy(T.positionScreen),M.copy(aa.positionScreen),!0===c(wa,M)&&(wa.multiplyScalar(1/wa.w),M.multiplyScalar(1/M.w),y===F?(xa=new THREE.RenderableLine,D.push(xa),F++,y++,v=xa):v=D[y++],v.v1.positionScreen.copy(wa),v.v2.positionScreen.copy(M),v.z=Math.max(wa.z,M.z),v.material=ma.material,ma.material.vertexColors===THREE.VertexColors&&(v.vertexColors[0].copy(ma.geometry.colors[A]),v.vertexColors[1].copy(ma.geometry.colors[A-1])),C.elements.push(v)))}d=0;for(h=C.sprites.length;d<h;d++)ma=
|
|
|
+C.sprites[d].object,oa=ma.matrixWorld,ma instanceof THREE.Particle&&(J.set(oa.elements[12],oa.elements[13],oa.elements[14],1),J.applyMatrix4(K),J.z/=J.w,0<J.z&&1>J.z&&(I===B?(V=new THREE.RenderableParticle,G.push(V),B++,I++,H=V):H=G[I++],H.object=ma,H.x=J.x/J.w,H.y=J.y/J.w,H.z=J.z,H.rotation=ma.rotation.z,H.scale.x=ma.scale.x*Math.abs(H.x-(J.x+f.projectionMatrix.elements[0])/(J.w+f.projectionMatrix.elements[12])),H.scale.y=ma.scale.y*Math.abs(H.y-(J.y+f.projectionMatrix.elements[5])/(J.w+f.projectionMatrix.elements[13])),
|
|
|
+H.material=ma.material,C.elements.push(H)));!0===m&&C.elements.sort(b);return C}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
-return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==g?g:0;this.centroid=new THREE.Vector3};
|
|
|
+return a}};THREE.Face4=function(a,b,c,d,e,f,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==h?h:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.name="";this.vertices=[];this.colors=[];this.normals=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
|
|
|
this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
|
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){var e=
|
|
|
-this.faces[c];e.normal.applyMatrix3(b).normalize();for(var f=0,g=e.vertexNormals.length;f<g;f++)e.vertexNormals[f].applyMatrix3(b).normalize();e.centroid.applyMatrix4(a)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.add(this.vertices[c.a]),
|
|
|
-c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.add(this.vertices[c.d]),c.centroid.divideScalar(4))},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=
|
|
|
-Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]:d instanceof THREE.Face4&&(d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,g,h,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,
|
|
|
-n=new THREE.Vector3,m=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],i.subVectors(g,f),j.subVectors(a,f),i.cross(j),e[d.a].add(i),e[d.b].add(i),e[d.c].add(i)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h=this.vertices[d.d],l.subVectors(h,f),j.subVectors(a,f),l.cross(j),e[d.a].add(l),e[d.b].add(l),e[d.d].add(l),n.subVectors(h,g),m.subVectors(f,
|
|
|
-g),n.cross(m),e[d.b].add(n),e[d.c].add(n),e[d.d].add(n))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)):d instanceof THREE.Face4&&(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal),e[d.d].add(d.normal))}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),
|
|
|
+this.faces[c];e.normal.applyMatrix3(b).normalize();for(var f=0,h=e.vertexNormals.length;f<h;f++)e.vertexNormals[f].applyMatrix3(b).normalize();e.centroid.applyMatrix4(a)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.add(this.vertices[c.a]),
|
|
|
+c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.add(this.vertices[c.d]),c.centroid.divideScalar(4))},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],h=this.vertices[e.b];a.subVectors(this.vertices[e.c],h);b.subVectors(f,h);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=
|
|
|
+Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]:d instanceof THREE.Face4&&(d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,h,g,i=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,
|
|
|
+p=new THREE.Vector3,l=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],h=this.vertices[d.c],i.subVectors(h,f),j.subVectors(a,f),i.cross(j),e[d.a].add(i),e[d.b].add(i),e[d.c].add(i)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],h=this.vertices[d.c],g=this.vertices[d.d],m.subVectors(g,f),j.subVectors(a,f),m.cross(j),e[d.a].add(m),e[d.b].add(m),e[d.d].add(m),p.subVectors(g,h),l.subVectors(f,
|
|
|
+h),p.cross(l),e[d.b].add(p),e[d.c].add(p),e[d.d].add(p))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)):d instanceof THREE.Face4&&(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal),e[d.d].add(d.normal))}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),
|
|
|
d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?
|
|
|
-e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,j=e instanceof THREE.Face3?
|
|
|
-{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(j)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],j=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),
|
|
|
-j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,A){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=g[e];n=g[f];m=g[A];p=i.x-h.x;t=j.x-h.x;r=i.y-h.y;q=j.y-h.y;s=i.z-h.z;u=j.z-h.z;w=n.x-l.x;y=m.x-l.x;F=n.y-l.y;J=m.y-l.y;B=1/(w*J-y*F);I.set((J*p-F*t)*B,(J*r-F*q)*B,(J*s-F*u)*B);O.set((w*
|
|
|
-t-y*p)*B,(w*q-y*r)*B,(w*u-y*s)*B);z[b].add(I);z[c].add(I);z[d].add(I);G[b].add(O);G[c].add(O);G[d].add(O)}var b,c,d,e,f,g,h,i,j,l,n,m,p,t,r,q,s,u,w,y,F,J,B,E,z=[],G=[],I=new THREE.Vector3,O=new THREE.Vector3,C=new THREE.Vector3,H=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)z[b]=new THREE.Vector3,G[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&
|
|
|
-(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var A=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)M.copy(f.vertexNormals[d]),e=f[A[d]],E=z[e],C.copy(E),C.sub(M.multiplyScalar(M.dot(E))).normalize(),H.crossVectors(f.vertexNormals[d],E),e=H.dot(G[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(C.x,C.y,C.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-
|
|
|
-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i,j;this.__tmpVertices=void 0;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],
|
|
|
-d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];h=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(h[i]==h[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];h=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)h[i]==h[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=
|
|
|
-d){h.splice(d,1);var l=new THREE.Face3(h[0],h[1],h[2],a.normal,a.color,a.materialIndex);h=0;for(i=this.faceVertexUvs.length;h<i;h++)(j=this.faceVertexUvs[h][f])&&j.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(l.vertexNormals=a.vertexNormals,l.vertexNormals.splice(d,1));a.vertexColors&&0<a.vertexColors.length&&(l.vertexColors=a.vertexColors,l.vertexColors.splice(d,1));this.faces[f]=l}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);h=0;for(i=this.faceVertexUvs.length;h<i;h++)this.faceVertexUvs[h].splice(f,
|
|
|
-1)}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
|
+e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var h=this.morphNormals[a].faceNormals,g=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,j=e instanceof THREE.Face3?
|
|
|
+{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},h.push(i),g.push(j)}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=h.faceNormals[c],j=h.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),
|
|
|
+j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,z){g=a.vertices[b];i=a.vertices[c];j=a.vertices[d];m=h[e];p=h[f];l=h[z];r=i.x-g.x;t=j.x-g.x;n=i.y-g.y;s=j.y-g.y;q=i.z-g.z;v=j.z-g.z;y=p.x-m.x;D=l.x-m.x;F=p.y-m.y;H=l.y-m.y;I=1/(y*H-D*F);A.set((H*r-F*t)*I,(H*n-F*s)*I,(H*q-F*v)*I);J.set((y*
|
|
|
+t-D*r)*I,(y*s-D*n)*I,(y*v-D*q)*I);B[b].add(A);B[c].add(A);B[d].add(A);C[b].add(J);C[c].add(J);C[d].add(J)}var b,c,d,e,f,h,g,i,j,m,p,l,r,t,n,s,q,v,y,D,F,H,I,G,B=[],C=[],A=new THREE.Vector3,J=new THREE.Vector3,N=new THREE.Vector3,z=new THREE.Vector3,L=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)B[b]=new THREE.Vector3,C[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],h=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&
|
|
|
+(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var w=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)L.copy(f.vertexNormals[d]),e=f[w[d]],G=B[e],N.copy(G),N.sub(L.multiplyScalar(L.dot(G))).normalize(),z.crossVectors(f.vertexNormals[d],G),e=z.dot(C[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(N.x,N.y,N.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-
|
|
|
+1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h,g,i,j;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],
|
|
|
+d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(h=this.faces.length;f<h;f++)if(a=this.faces[f],a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];g=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(g[i]==g[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];g=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)g[i]==g[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=
|
|
|
+d){g.splice(d,1);var m=new THREE.Face3(g[0],g[1],g[2],a.normal,a.color,a.materialIndex);g=0;for(i=this.faceVertexUvs.length;g<i;g++)(j=this.faceVertexUvs[g][f])&&j.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(m.vertexNormals=a.vertexNormals,m.vertexNormals.splice(d,1));a.vertexColors&&0<a.vertexColors.length&&(m.vertexColors=a.vertexColors,m.vertexColors.splice(d,1));this.faces[f]=m}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);g=0;for(i=this.faceVertexUvs.length;g<i;g++)this.faceVertexUvs[g].splice(f,
|
|
|
+1)}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),
|
|
|
-this.verticesNeedUpdate=!0);void 0!==c&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,g=a.length;f<g;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?
|
|
|
-b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,
|
|
|
-b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,j,l,n,m=new THREE.Vector3,p=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var s=this.attributes.index.array,u=this.offsets;
|
|
|
-c=0;for(d=u.length;c<d;++c){b=u[c].start;g=u[c].count;var w=u[c].index;a=b;for(b+=g;a<b;a+=3)g=w+s[a],h=w+s[a+1],i=w+s[a+2],j=e[3*g],l=e[3*g+1],n=e[3*g+2],m.set(j,l,n),j=e[3*h],l=e[3*h+1],n=e[3*h+2],p.set(j,l,n),j=e[3*i],l=e[3*i+1],n=e[3*i+2],t.set(j,l,n),r.subVectors(t,p),q.subVectors(m,p),r.cross(q),f[3*g]+=r.x,f[3*g+1]+=r.y,f[3*g+2]+=r.z,f[3*h]+=r.x,f[3*h+1]+=r.y,f[3*h+2]+=r.z,f[3*i]+=r.x,f[3*i+1]+=r.y,f[3*i+2]+=r.z}}else{a=0;for(b=e.length;a<b;a+=9)j=e[a],l=e[a+1],n=e[a+2],m.set(j,l,n),j=e[a+
|
|
|
-3],l=e[a+4],n=e[a+5],p.set(j,l,n),j=e[a+6],l=e[a+7],n=e[a+8],t.set(j,l,n),r.subVectors(t,p),q.subVectors(m,p),r.cross(q),f[a]=r.x,f[a+1]=r.y,f[a+2]=r.z,f[a+3]=r.x,f[a+4]=r.y,f[a+5]=r.z,f[a+6]=r.x,f[a+7]=r.y,f[a+8]=r.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){wa.x=d[3*a];
|
|
|
-wa.y=d[3*a+1];wa.z=d[3*a+2];Ma.copy(wa);W=i[a];K.copy(W);K.sub(wa.multiplyScalar(wa.dot(W))).normalize();fa.crossVectors(Ma,W);ja=fa.dot(j[a]);N=0>ja?-1:1;h[4*a]=K.x;h[4*a+1]=K.y;h[4*a+2]=K.z;h[4*a+3]=N}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,
|
|
|
-d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],j=[],g=0;g<f;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var l,n,m,p,t,r,q,s,u,w,y,F,J,B,E,f=new THREE.Vector3,g=new THREE.Vector3,z,G,I,O,C,H,M,A=this.offsets;I=0;for(O=A.length;I<O;++I){G=A[I].start;C=A[I].count;var R=A[I].index;z=G;for(G+=C;z<G;z+=3)C=R+b[z],
|
|
|
-H=R+b[z+1],M=R+b[z+2],l=c[3*C],n=c[3*C+1],m=c[3*C+2],p=c[3*H],t=c[3*H+1],r=c[3*H+2],q=c[3*M],s=c[3*M+1],u=c[3*M+2],w=e[2*C],y=e[2*C+1],F=e[2*H],J=e[2*H+1],B=e[2*M],E=e[2*M+1],p-=l,l=q-l,t-=n,n=s-n,r-=m,m=u-m,F-=w,w=B-w,J-=y,y=E-y,E=1/(F*y-w*J),f.set((y*p-J*l)*E,(y*t-J*n)*E,(y*r-J*m)*E),g.set((F*l-w*p)*E,(F*n-w*t)*E,(F*m-w*r)*E),i[C].add(f),i[H].add(f),i[M].add(f),j[C].add(g),j[H].add(g),j[M].add(g)}var K=new THREE.Vector3,fa=new THREE.Vector3,wa=new THREE.Vector3,Ma=new THREE.Vector3,N,W,ja;I=0;for(O=
|
|
|
-A.length;I<O;++I){G=A[I].start;C=A[I].count;R=A[I].index;z=G;for(G+=C;z<G;z+=3)C=R+b[z],H=R+b[z+1],M=R+b[z+2],a(C),a(H),a(M)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);!0===this.useQuaternion?this.quaternion.setFromRotationMatrix(a):this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
+this.verticesNeedUpdate=!0);void 0!==c&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,h=a.length;f<h;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?
|
|
|
+b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,h=a.length;f<h;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,
|
|
|
+b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=this.attributes.position.array,f=this.attributes.normal.array,h,g,i,j,m,p,l=new THREE.Vector3,r=new THREE.Vector3,t=new THREE.Vector3,n=new THREE.Vector3,s=new THREE.Vector3;if(this.attributes.index){var q=this.attributes.index.array,v=this.offsets;
|
|
|
+c=0;for(d=v.length;c<d;++c){b=v[c].start;h=v[c].count;var y=v[c].index;a=b;for(b+=h;a<b;a+=3)h=y+q[a],g=y+q[a+1],i=y+q[a+2],j=e[3*h],m=e[3*h+1],p=e[3*h+2],l.set(j,m,p),j=e[3*g],m=e[3*g+1],p=e[3*g+2],r.set(j,m,p),j=e[3*i],m=e[3*i+1],p=e[3*i+2],t.set(j,m,p),n.subVectors(t,r),s.subVectors(l,r),n.cross(s),f[3*h]+=n.x,f[3*h+1]+=n.y,f[3*h+2]+=n.z,f[3*g]+=n.x,f[3*g+1]+=n.y,f[3*g+2]+=n.z,f[3*i]+=n.x,f[3*i+1]+=n.y,f[3*i+2]+=n.z}}else{a=0;for(b=e.length;a<b;a+=9)j=e[a],m=e[a+1],p=e[a+2],l.set(j,m,p),j=e[a+
|
|
|
+3],m=e[a+4],p=e[a+5],r.set(j,m,p),j=e[a+6],m=e[a+7],p=e[a+8],t.set(j,m,p),n.subVectors(t,r),s.subVectors(l,r),n.cross(s),f[a]=n.x,f[a+1]=n.y,f[a+2]=n.z,f[a+3]=n.x,f[a+4]=n.y,f[a+5]=n.z,f[a+6]=n.x,f[a+7]=n.y,f[a+8]=n.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){Pa.x=d[3*a];
|
|
|
+Pa.y=d[3*a+1];Pa.z=d[3*a+2];Va.copy(Pa);qa=i[a];K.copy(qa);K.sub(Pa.multiplyScalar(Pa.dot(qa))).normalize();oa.crossVectors(Va,qa);Fa=oa.dot(j[a]);O=0>Fa?-1:1;g[4*a]=K.x;g[4*a+1]=K.y;g[4*a+2]=K.z;g[4*a+3]=O}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,
|
|
|
+d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var h=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(h),numItems:h}}for(var g=this.attributes.tangent.array,i=[],j=[],h=0;h<f;h++)i[h]=new THREE.Vector3,j[h]=new THREE.Vector3;var m,p,l,r,t,n,s,q,v,y,D,F,H,I,G,f=new THREE.Vector3,h=new THREE.Vector3,B,C,A,J,N,z,L,w=this.offsets;A=0;for(J=w.length;A<J;++A){C=w[A].start;N=w[A].count;var Z=w[A].index;B=C;for(C+=N;B<C;B+=3)N=Z+b[B],
|
|
|
+z=Z+b[B+1],L=Z+b[B+2],m=c[3*N],p=c[3*N+1],l=c[3*N+2],r=c[3*z],t=c[3*z+1],n=c[3*z+2],s=c[3*L],q=c[3*L+1],v=c[3*L+2],y=e[2*N],D=e[2*N+1],F=e[2*z],H=e[2*z+1],I=e[2*L],G=e[2*L+1],r-=m,m=s-m,t-=p,p=q-p,n-=l,l=v-l,F-=y,y=I-y,H-=D,D=G-D,G=1/(F*D-y*H),f.set((D*r-H*m)*G,(D*t-H*p)*G,(D*n-H*l)*G),h.set((F*m-y*r)*G,(F*p-y*t)*G,(F*l-y*n)*G),i[N].add(f),i[z].add(f),i[L].add(f),j[N].add(h),j[z].add(h),j[L].add(h)}var K=new THREE.Vector3,oa=new THREE.Vector3,Pa=new THREE.Vector3,Va=new THREE.Vector3,O,qa,Fa;A=0;
|
|
|
+for(J=w.length;A<J;++A){C=w[A].start;N=w[A].count;Z=w[A].index;B=C;for(C+=N;B<C;B+=3)N=Z+b[B],z=Z+b[B+1],L=Z+b[B+2],a(N),a(z),a(L)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);!0===this.useQuaternion?this.quaternion.setFromRotationMatrix(a):this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.clone=function(){var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a};THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=new THREE.Vector3(0,
|
|
|
0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);
|
|
@@ -193,22 +193,22 @@ THREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLig
|
|
|
this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
-a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,j,q){var s=/\.dds$/i.test(f),u=b+"/"+f;if(s){var w=THREE.ImageUtils.loadCompressedTexture(u);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
|
|
|
-f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]&&(a[e].wrapT=f[j[1]]));q&&(a[e].anisotropy=q);if(!s){var y=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);y.image.width=a;y.image.height=b;y.image.getContext("2d").drawImage(this,0,0,a,b)}else y.image=this;y.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
-lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?h="MeshPhongMaterial":"basic"===j&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
|
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,j,s){var q=/\.dds$/i.test(f),v=b+"/"+f;if(q){var y=THREE.ImageUtils.loadCompressedTexture(v);a[e]=y}else y=document.createElement("canvas"),a[e]=new THREE.Texture(y);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
|
|
|
+f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]&&(a[e].wrapT=f[j[1]]));s&&(a[e].anisotropy=s);if(!q){var D=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);D.image.width=a;D.image.height=b;D.image.getContext("2d").drawImage(this,0,0,a,b)}else D.image=this;D.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=v}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
+lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?g="MeshPhongMaterial":"basic"===j&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
|
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
|
|
|
b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
|
|
|
-a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(h=THREE.ShaderLib.normalmap,j=THREE.UniformsUtils.clone(h.uniforms),j.tNormal.value=i.normalMap,a.mapNormalFactor&&j.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(j.tDiffuse.value=i.map,j.enableDiffuse.value=!0),i.specularMap&&(j.tSpecular.value=i.specularMap,j.enableSpecular.value=!0),i.lightMap&&(j.tAO.value=i.lightMap,j.enableAO.value=!0),j.uDiffuseColor.value.setHex(i.color),
|
|
|
-j.uSpecularColor.value.setHex(i.specular),j.uAmbientColor.value.setHex(i.ambient),j.uShininess.value=i.shininess,void 0!==i.opacity&&(j.uOpacity.value=i.opacity),h=new THREE.ShaderMaterial({fragmentShader:h.fragmentShader,vertexShader:h.vertexShader,uniforms:j,lights:!0,fog:!0}),i.transparent&&(h.transparent=!0)):h=new THREE[h](i);void 0!==a.DbgName&&(h.name=a.DbgName);return h}};THREE.ImageLoader=function(){this.crossOrigin=null};
|
|
|
+a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(g=THREE.ShaderLib.normalmap,j=THREE.UniformsUtils.clone(g.uniforms),j.tNormal.value=i.normalMap,a.mapNormalFactor&&j.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(j.tDiffuse.value=i.map,j.enableDiffuse.value=!0),i.specularMap&&(j.tSpecular.value=i.specularMap,j.enableSpecular.value=!0),i.lightMap&&(j.tAO.value=i.lightMap,j.enableAO.value=!0),j.uDiffuseColor.value.setHex(i.color),
|
|
|
+j.uSpecularColor.value.setHex(i.specular),j.uAmbientColor.value.setHex(i.ambient),j.uShininess.value=i.shininess,void 0!==i.opacity&&(j.uOpacity.value=i.opacity),g=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:j,lights:!0,fog:!0}),i.transparent&&(g.transparent=!0)):g=new THREE[g](i);void 0!==a.DbgName&&(g.name=a.DbgName);return g}};THREE.ImageLoader=function(){this.crossOrigin=null};
|
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",
|
|
|
message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText),h=a.parse(h,d);c(h.geometry,h.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&&
|
|
|
-(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,g,h,i,j,l,n,m,p,t,r,q,s,u,w=a.faces;p=a.vertices;var y=a.normals,F=a.colors,J=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&J++;for(e=0;e<J;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[];h=0;for(i=p.length;h<i;)j=new THREE.Vector3,j.x=p[h++]*d,j.y=p[h++]*d,j.z=p[h++]*d,c.vertices.push(j);h=0;for(i=w.length;h<i;){p=w[h++];j=p&1;g=p&2;e=p&4;f=p&8;n=p&16;l=p&32;t=p&64;p&=128;j?(r=new THREE.Face4,r.a=
|
|
|
-w[h++],r.b=w[h++],r.c=w[h++],r.d=w[h++],j=4):(r=new THREE.Face3,r.a=w[h++],r.b=w[h++],r.c=w[h++],j=3);g&&(g=w[h++],r.materialIndex=g);g=c.faces.length;if(e)for(e=0;e<J;e++)q=a.uvs[e],m=w[h++],u=q[2*m],m=q[2*m+1],c.faceUvs[e][g]=new THREE.Vector2(u,m);if(f)for(e=0;e<J;e++){q=a.uvs[e];s=[];for(f=0;f<j;f++)m=w[h++],u=q[2*m],m=q[2*m+1],s[f]=new THREE.Vector2(u,m);c.faceVertexUvs[e][g]=s}n&&(n=3*w[h++],f=new THREE.Vector3,f.x=y[n++],f.y=y[n++],f.z=y[n],r.normal=f);if(l)for(e=0;e<j;e++)n=3*w[h++],f=new THREE.Vector3,
|
|
|
-f.x=y[n++],f.y=y[n++],f.z=y[n],r.vertexNormals.push(f);t&&(l=w[h++],l=new THREE.Color(F[l]),r.color=l);if(p)for(e=0;e<j;e++)l=w[h++],l=new THREE.Color(F[l]),r.vertexColors.push(l);c.faces.push(r)}if(a.skinWeights){h=0;for(i=a.skinWeights.length;h<i;h+=2)w=a.skinWeights[h],y=a.skinWeights[h+1],c.skinWeights.push(new THREE.Vector4(w,y,0,0))}if(a.skinIndices){h=0;for(i=a.skinIndices.length;h<i;h+=2)w=a.skinIndices[h],y=a.skinIndices[h+1],c.skinIndices.push(new THREE.Vector4(w,y,0,0))}c.bones=a.bones;
|
|
|
-c.animation=a.animation;if(void 0!==a.morphTargets){h=0;for(i=a.morphTargets.length;h<i;h++){c.morphTargets[h]={};c.morphTargets[h].name=a.morphTargets[h].name;c.morphTargets[h].vertices=[];F=c.morphTargets[h].vertices;J=a.morphTargets[h].vertices;w=0;for(y=J.length;w<y;w+=3)p=new THREE.Vector3,p.x=J[w]*d,p.y=J[w+1]*d,p.z=J[w+2]*d,F.push(p)}}if(void 0!==a.morphColors){h=0;for(i=a.morphColors.length;h<i;h++){c.morphColors[h]={};c.morphColors[h].name=a.morphColors[h].name;c.morphColors[h].colors=[];
|
|
|
-y=c.morphColors[h].colors;F=a.morphColors[h].colors;d=0;for(w=F.length;d<w;d+=3)J=new THREE.Color(16755200),J.setRGB(F[d],F[d+1],F[d+2]),y.push(J)}}c.computeCentroids();c.computeFaceNormals();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingMonitor=function(){var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.LoadingMonitor.prototype={constructor:THREE.LoadingMonitor,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent};THREE.GeometryLoader=function(){};
|
|
|
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var g=JSON.parse(f.responseText),g=a.parse(g,d);c(g.geometry,g.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===h&&
|
|
|
+(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,j,m,p,l,r,t,n,s,q,v,y=a.faces;r=a.vertices;var D=a.normals,F=a.colors,H=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&H++;for(e=0;e<H;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[];g=0;for(i=r.length;g<i;)j=new THREE.Vector3,j.x=r[g++]*d,j.y=r[g++]*d,j.z=r[g++]*d,c.vertices.push(j);g=0;for(i=y.length;g<i;){r=y[g++];j=r&1;h=r&2;e=r&4;f=r&8;p=r&16;m=r&32;t=r&64;r&=128;j?(n=new THREE.Face4,n.a=
|
|
|
+y[g++],n.b=y[g++],n.c=y[g++],n.d=y[g++],j=4):(n=new THREE.Face3,n.a=y[g++],n.b=y[g++],n.c=y[g++],j=3);h&&(h=y[g++],n.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<H;e++)s=a.uvs[e],l=y[g++],v=s[2*l],l=s[2*l+1],c.faceUvs[e][h]=new THREE.Vector2(v,l);if(f)for(e=0;e<H;e++){s=a.uvs[e];q=[];for(f=0;f<j;f++)l=y[g++],v=s[2*l],l=s[2*l+1],q[f]=new THREE.Vector2(v,l);c.faceVertexUvs[e][h]=q}p&&(p=3*y[g++],f=new THREE.Vector3,f.x=D[p++],f.y=D[p++],f.z=D[p],n.normal=f);if(m)for(e=0;e<j;e++)p=3*y[g++],f=new THREE.Vector3,
|
|
|
+f.x=D[p++],f.y=D[p++],f.z=D[p],n.vertexNormals.push(f);t&&(m=y[g++],m=new THREE.Color(F[m]),n.color=m);if(r)for(e=0;e<j;e++)m=y[g++],m=new THREE.Color(F[m]),n.vertexColors.push(m);c.faces.push(n)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)y=a.skinWeights[g],D=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(y,D,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<i;g+=2)y=a.skinIndices[g],D=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(y,D,0,0))}c.bones=a.bones;
|
|
|
+c.animation=a.animation;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];F=c.morphTargets[g].vertices;H=a.morphTargets[g].vertices;y=0;for(D=H.length;y<D;y+=3)r=new THREE.Vector3,r.x=H[y]*d,r.y=H[y+1]*d,r.z=H[y+2]*d,F.push(r)}}if(void 0!==a.morphColors){g=0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=[];
|
|
|
+D=c.morphColors[g].colors;F=a.morphColors[g].colors;d=0;for(y=F.length;d<y;d+=3)H=new THREE.Color(16755200),H.setRGB(F[d],F[d+1],F[d+2]),D.push(H)}}c.computeCentroids();c.computeFaceNormals();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingMonitor=function(){var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.LoadingMonitor.prototype={constructor:THREE.LoadingMonitor,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent};THREE.GeometryLoader=function(){};
|
|
|
THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,load:function(a){var b=this,c=new XMLHttpRequest;c.addEventListener("load",function(a){a=b.parse(JSON.parse(a.target.responseText));b.dispatchEvent({type:"load",content:a})},
|
|
|
!1);c.addEventListener("progress",function(a){b.dispatchEvent({type:"progress",loaded:a.loaded,total:a.total})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.open("GET",a,!0);c.send(null)},parse:function(){}};THREE.MaterialLoader=function(){};
|
|
|
THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,load:function(a){var b=this,c=new XMLHttpRequest;c.addEventListener("load",function(a){a=b.parse(JSON.parse(a.target.responseText));b.dispatchEvent({type:"load",content:a})},
|
|
@@ -217,27 +217,27 @@ ambient:a.ambient,emissive:a.emissive,opacity:a.opacity,transparent:a.transparen
|
|
|
transparent:a.transparent,wireframe:a.wireframe})}return b}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState)if(200===d.status||0===d.status){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
|
|
|
THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
|
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:m+"/"+a}function e(){f(z.scene,I.objects)}function f(a,b){var c,e,g,i,j,l,m;for(m in b){var q=z.objects[m],s=b[m];if(void 0===q){if(s.type&&s.type in n.hierarchyHandlerMap){if(void 0===s.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var A in s)A in e||(g[A]=s[A]);t=z.materials[s.material];s.loading=!0;e=
|
|
|
-n.hierarchyHandlerMap[s.type].loaderObject;e.options?e.load(d(s.url,I.urlBaseType),h(m,a,t,s)):e.load(d(s.url,I.urlBaseType),h(m,a,t,s),g)}}else if(void 0!==s.geometry){if(p=z.geometries[s.geometry]){q=!1;t=z.materials[s.material];q=t instanceof THREE.ShaderMaterial;g=s.position;i=s.rotation;j=s.scale;c=s.matrix;l=s.quaternion;s.material||(t=new THREE.MeshFaceMaterial(z.face_materials[s.geometry]));t instanceof THREE.MeshFaceMaterial&&0===t.materials.length&&(t=new THREE.MeshFaceMaterial(z.face_materials[s.geometry]));
|
|
|
-if(t instanceof THREE.MeshFaceMaterial)for(e=0;e<t.materials.length;e++)q=q||t.materials[e]instanceof THREE.ShaderMaterial;q&&p.computeTangents();s.skin?q=new THREE.SkinnedMesh(p,t):s.morph?(q=new THREE.MorphAnimMesh(p,t),void 0!==s.duration&&(q.duration=s.duration),void 0!==s.time&&(q.time=s.time),void 0!==s.mirroredLoop&&(q.mirroredLoop=s.mirroredLoop),t.morphNormals&&p.computeMorphNormals()):q=new THREE.Mesh(p,t);q.name=m;c?(q.matrixAutoUpdate=!1,q.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],
|
|
|
-c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(q.position.fromArray(g),l?(q.quaternion.fromArray(l),q.useQuaternion=!0):q.rotation.fromArray(i),q.scale.fromArray(j));q.visible=s.visible;q.castShadow=s.castShadow;q.receiveShadow=s.receiveShadow;a.add(q);z.objects[m]=q}}else"DirectionalLight"===s.type||"PointLight"===s.type||"AmbientLight"===s.type?(w=void 0!==s.color?s.color:16777215,y=void 0!==s.intensity?s.intensity:1,"DirectionalLight"===s.type?(g=s.direction,u=new THREE.DirectionalLight(w,
|
|
|
-y),u.position.fromArray(g),s.target&&(G.push({object:u,targetName:s.target}),u.target=null)):"PointLight"===s.type?(g=s.position,e=s.distance,u=new THREE.PointLight(w,y,e),u.position.fromArray(g)):"AmbientLight"===s.type&&(u=new THREE.AmbientLight(w)),a.add(u),u.name=m,z.lights[m]=u,z.objects[m]=u):"PerspectiveCamera"===s.type||"OrthographicCamera"===s.type?(g=s.position,i=s.rotation,l=s.quaternion,"PerspectiveCamera"===s.type?r=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):"OrthographicCamera"===
|
|
|
-s.type&&(r=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),r.name=m,r.position.fromArray(g),void 0!==l?(r.quaternion.fromArray(l),r.useQuaternion=!0):void 0!==i&&r.rotation.fromArray(i),a.add(r),z.cameras[m]=r,z.objects[m]=r):(g=s.position,i=s.rotation,j=s.scale,l=s.quaternion,q=new THREE.Object3D,q.name=m,q.position.fromArray(g),l?(q.quaternion.fromArray(l),q.useQuaternion=!0):q.rotation.fromArray(i),q.scale.fromArray(j),q.visible=void 0!==s.visible?s.visible:!1,a.add(q),
|
|
|
-z.objects[m]=q,z.empties[m]=q);if(q){if(void 0!==s.userData)for(var F in s.userData)q.userData[F]=s.userData[F];if(void 0!==s.groups)for(e=0;e<s.groups.length;e++)g=s.groups[e],void 0===z.groups[g]&&(z.groups[g]=[]),z.groups[g].push(m)}}void 0!==q&&void 0!==s.children&&f(q,s.children)}}function g(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c;e();F-=1;n.onLoadComplete();j()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.rotation,h=d.quaternion,
|
|
|
-i=d.scale;f.position.fromArray(d.position);h?(f.quaternion.fromArray(h),f.useQuaternion=!0):f.rotation.fromArray(g);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;z.objects[a]=f;e();F-=1;n.onLoadComplete();j()}}function i(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c}}function j(){n.callbackProgress({totalModels:B,totalTextures:E,loadedModels:B-F,loadedTextures:E-
|
|
|
-J},z);n.onLoadProgress();if(0===F&&0===J){for(var a=0;a<G.length;a++){var c=G[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,z.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(z)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var n=this,m=THREE.Loader.prototype.extractUrlBase(c),p,t,r,q,s,u,w,y,F,J,B,E,z,G=[],I=a,O;for(O in this.geometryHandlerMap)a=this.geometryHandlerMap[O].loaderClass,this.geometryHandlerMap[O].loaderObject=
|
|
|
-new a;for(O in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[O].loaderClass,this.hierarchyHandlerMap[O].loaderObject=new a;J=F=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(I.transform&&(O=I.transform.position,a=I.transform.rotation,c=I.transform.scale,O&&z.scene.position.fromArray(O),a&&z.scene.rotation.fromArray(a),c&&z.scene.scale.fromArray(c),O||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();
|
|
|
-O=function(a){return function(){J-=a;j();n.onLoadComplete()}};for(var C in I.fogs)a=I.fogs[C],"linear"===a.type?q=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(q=new THREE.FogExp2(0,a.density)),a=a.color,q.color.setRGB(a[0],a[1],a[2]),z.fogs[C]=q;for(var H in I.geometries)q=I.geometries[H],q.type in this.geometryHandlerMap&&(F+=1,n.onLoadStart());for(var M in I.objects)l(I.objects[M],function(a){a.type&&a.type in n.hierarchyHandlerMap&&(F+=1,n.onLoadStart())});B=F;for(H in I.geometries)if(q=I.geometries[H],
|
|
|
-"cube"===q.type)p=new THREE.CubeGeometry(q.width,q.height,q.depth,q.widthSegments,q.heightSegments,q.depthSegments),p.name=H,z.geometries[H]=p;else if("plane"===q.type)p=new THREE.PlaneGeometry(q.width,q.height,q.widthSegments,q.heightSegments),p.name=H,z.geometries[H]=p;else if("sphere"===q.type)p=new THREE.SphereGeometry(q.radius,q.widthSegments,q.heightSegments),p.name=H,z.geometries[H]=p;else if("cylinder"===q.type)p=new THREE.CylinderGeometry(q.topRad,q.botRad,q.height,q.radSegs,q.heightSegs),
|
|
|
-p.name=H,z.geometries[H]=p;else if("torus"===q.type)p=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT),p.name=H,z.geometries[H]=p;else if("icosahedron"===q.type)p=new THREE.IcosahedronGeometry(q.radius,q.subdivisions),p.name=H,z.geometries[H]=p;else if(q.type in this.geometryHandlerMap){M={};for(s in q)"type"!==s&&"url"!==s&&(M[s]=q[s]);this.geometryHandlerMap[q.type].loaderObject.load(d(q.url,I.urlBaseType),g(H),M)}else"embedded"===q.type&&(M=I.embeds[q.id],M.metadata=I.metadata,
|
|
|
-M&&(M=this.geometryHandlerMap.ascii.loaderObject.parse(M,""),i(H)(M.geometry,M.materials)));for(var A in I.textures)if(H=I.textures[A],H.url instanceof Array){J+=H.url.length;for(s=0;s<H.url.length;s++)n.onLoadStart()}else J+=1,n.onLoadStart();E=J;for(A in I.textures){H=I.textures[A];void 0!==H.mapping&&void 0!==THREE[H.mapping]&&(H.mapping=new THREE[H.mapping]);if(H.url instanceof Array){M=H.url.length;q=[];for(s=0;s<M;s++)q[s]=d(H.url[s],I.urlBaseType);s=(s=/\.dds$/i.test(q[0]))?THREE.ImageUtils.loadCompressedTextureCube(q,
|
|
|
-H.mapping,O(M)):THREE.ImageUtils.loadTextureCube(q,H.mapping,O(M))}else s=/\.dds$/i.test(H.url),M=d(H.url,I.urlBaseType),q=O(1),s=s?THREE.ImageUtils.loadCompressedTexture(M,H.mapping,q):THREE.ImageUtils.loadTexture(M,H.mapping,q),void 0!==THREE[H.minFilter]&&(s.minFilter=THREE[H.minFilter]),void 0!==THREE[H.magFilter]&&(s.magFilter=THREE[H.magFilter]),H.anisotropy&&(s.anisotropy=H.anisotropy),H.repeat&&(s.repeat.set(H.repeat[0],H.repeat[1]),1!==H.repeat[0]&&(s.wrapS=THREE.RepeatWrapping),1!==H.repeat[1]&&
|
|
|
-(s.wrapT=THREE.RepeatWrapping)),H.offset&&s.offset.set(H.offset[0],H.offset[1]),H.wrap&&(M={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==M[H.wrap[0]]&&(s.wrapS=M[H.wrap[0]]),void 0!==M[H.wrap[1]]&&(s.wrapT=M[H.wrap[1]]));z.textures[A]=s}var R,K;for(R in I.materials){A=I.materials[R];for(K in A.parameters)"envMap"===K||"map"===K||"lightMap"===K||"bumpMap"===K?A.parameters[K]=z.textures[A.parameters[K]]:"shading"===K?A.parameters[K]="flat"===A.parameters[K]?THREE.FlatShading:
|
|
|
-THREE.SmoothShading:"side"===K?A.parameters[K]="double"==A.parameters[K]?THREE.DoubleSide:"back"==A.parameters[K]?THREE.BackSide:THREE.FrontSide:"blending"===K?A.parameters[K]=A.parameters[K]in THREE?THREE[A.parameters[K]]:THREE.NormalBlending:"combine"===K?A.parameters[K]=A.parameters[K]in THREE?THREE[A.parameters[K]]:THREE.MultiplyOperation:"vertexColors"===K?"face"==A.parameters[K]?A.parameters[K]=THREE.FaceColors:A.parameters[K]&&(A.parameters[K]=THREE.VertexColors):"wrapRGB"===K&&(O=A.parameters[K],
|
|
|
-A.parameters[K]=new THREE.Vector3(O[0],O[1],O[2]));void 0!==A.parameters.opacity&&1>A.parameters.opacity&&(A.parameters.transparent=!0);A.parameters.normalMap?(O=THREE.ShaderLib.normalmap,H=THREE.UniformsUtils.clone(O.uniforms),s=A.parameters.color,M=A.parameters.specular,q=A.parameters.ambient,C=A.parameters.shininess,H.tNormal.value=z.textures[A.parameters.normalMap],A.parameters.normalScale&&H.uNormalScale.value.set(A.parameters.normalScale[0],A.parameters.normalScale[1]),A.parameters.map&&(H.tDiffuse.value=
|
|
|
-A.parameters.map,H.enableDiffuse.value=!0),A.parameters.envMap&&(H.tCube.value=A.parameters.envMap,H.enableReflection.value=!0,H.uReflectivity.value=A.parameters.reflectivity),A.parameters.lightMap&&(H.tAO.value=A.parameters.lightMap,H.enableAO.value=!0),A.parameters.specularMap&&(H.tSpecular.value=z.textures[A.parameters.specularMap],H.enableSpecular.value=!0),A.parameters.displacementMap&&(H.tDisplacement.value=z.textures[A.parameters.displacementMap],H.enableDisplacement.value=!0,H.uDisplacementBias.value=
|
|
|
-A.parameters.displacementBias,H.uDisplacementScale.value=A.parameters.displacementScale),H.uDiffuseColor.value.setHex(s),H.uSpecularColor.value.setHex(M),H.uAmbientColor.value.setHex(q),H.uShininess.value=C,A.parameters.opacity&&(H.uOpacity.value=A.parameters.opacity),t=new THREE.ShaderMaterial({fragmentShader:O.fragmentShader,vertexShader:O.vertexShader,uniforms:H,lights:!0,fog:!0})):t=new THREE[A.type](A.parameters);t.name=R;z.materials[R]=t}for(R in I.materials)if(A=I.materials[R],A.parameters.materials){K=
|
|
|
-[];for(s=0;s<A.parameters.materials.length;s++)K.push(z.materials[A.parameters.materials[s]]);z.materials[R].materials=K}e();z.cameras&&I.defaults.camera&&(z.currentCamera=z.cameras[I.defaults.camera]);z.fogs&&I.defaults.fog&&(z.scene.fog=z.fogs[I.defaults.fog]);n.callbackSync(z);j()};THREE.TextureLoader=function(){this.crossOrigin=null};
|
|
|
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:l+"/"+a}function e(){f(B.scene,A.objects)}function f(a,b){var c,e,h,i,j,m,l;for(l in b){var s=B.objects[l],q=b[l];if(void 0===s){if(q.type&&q.type in p.hierarchyHandlerMap){if(void 0===q.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};h={};for(var z in q)z in e||(h[z]=q[z]);t=B.materials[q.material];q.loading=!0;e=
|
|
|
+p.hierarchyHandlerMap[q.type].loaderObject;e.options?e.load(d(q.url,A.urlBaseType),g(l,a,t,q)):e.load(d(q.url,A.urlBaseType),g(l,a,t,q),h)}}else if(void 0!==q.geometry){if(r=B.geometries[q.geometry]){s=!1;t=B.materials[q.material];s=t instanceof THREE.ShaderMaterial;h=q.position;i=q.rotation;j=q.scale;c=q.matrix;m=q.quaternion;q.material||(t=new THREE.MeshFaceMaterial(B.face_materials[q.geometry]));t instanceof THREE.MeshFaceMaterial&&0===t.materials.length&&(t=new THREE.MeshFaceMaterial(B.face_materials[q.geometry]));
|
|
|
+if(t instanceof THREE.MeshFaceMaterial)for(e=0;e<t.materials.length;e++)s=s||t.materials[e]instanceof THREE.ShaderMaterial;s&&r.computeTangents();q.skin?s=new THREE.SkinnedMesh(r,t):q.morph?(s=new THREE.MorphAnimMesh(r,t),void 0!==q.duration&&(s.duration=q.duration),void 0!==q.time&&(s.time=q.time),void 0!==q.mirroredLoop&&(s.mirroredLoop=q.mirroredLoop),t.morphNormals&&r.computeMorphNormals()):s=new THREE.Mesh(r,t);s.name=l;c?(s.matrixAutoUpdate=!1,s.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],
|
|
|
+c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(s.position.fromArray(h),m?(s.quaternion.fromArray(m),s.useQuaternion=!0):s.rotation.fromArray(i),s.scale.fromArray(j));s.visible=q.visible;s.castShadow=q.castShadow;s.receiveShadow=q.receiveShadow;a.add(s);B.objects[l]=s}}else"DirectionalLight"===q.type||"PointLight"===q.type||"AmbientLight"===q.type?(y=void 0!==q.color?q.color:16777215,D=void 0!==q.intensity?q.intensity:1,"DirectionalLight"===q.type?(h=q.direction,v=new THREE.DirectionalLight(y,
|
|
|
+D),v.position.fromArray(h),q.target&&(C.push({object:v,targetName:q.target}),v.target=null)):"PointLight"===q.type?(h=q.position,e=q.distance,v=new THREE.PointLight(y,D,e),v.position.fromArray(h)):"AmbientLight"===q.type&&(v=new THREE.AmbientLight(y)),a.add(v),v.name=l,B.lights[l]=v,B.objects[l]=v):"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?(h=q.position,i=q.rotation,m=q.quaternion,"PerspectiveCamera"===q.type?n=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===
|
|
|
+q.type&&(n=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),n.name=l,n.position.fromArray(h),void 0!==m?(n.quaternion.fromArray(m),n.useQuaternion=!0):void 0!==i&&n.rotation.fromArray(i),a.add(n),B.cameras[l]=n,B.objects[l]=n):(h=q.position,i=q.rotation,j=q.scale,m=q.quaternion,s=new THREE.Object3D,s.name=l,s.position.fromArray(h),m?(s.quaternion.fromArray(m),s.useQuaternion=!0):s.rotation.fromArray(i),s.scale.fromArray(j),s.visible=void 0!==q.visible?q.visible:!1,a.add(s),
|
|
|
+B.objects[l]=s,B.empties[l]=s);if(s){if(void 0!==q.userData)for(var F in q.userData)s.userData[F]=q.userData[F];if(void 0!==q.groups)for(e=0;e<q.groups.length;e++)h=q.groups[e],void 0===B.groups[h]&&(B.groups[h]=[]),B.groups[h].push(l)}}void 0!==s&&void 0!==q.children&&f(s,q.children)}}function h(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c;e();F-=1;p.onLoadComplete();j()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,
|
|
|
+i=d.scale;f.position.fromArray(d.position);g?(f.quaternion.fromArray(g),f.useQuaternion=!0):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var m=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=m});b.add(f);f.name=a;B.objects[a]=f;e();F-=1;p.onLoadComplete();j()}}function i(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c}}function j(){p.callbackProgress({totalModels:I,totalTextures:G,loadedModels:I-F,loadedTextures:G-
|
|
|
+H},B);p.onLoadProgress();if(0===F&&0===H){for(var a=0;a<C.length;a++){var c=C[a],d=B.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,B.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(B)}}function m(a,b){b(a);if(void 0!==a.children)for(var c in a.children)m(a.children[c],b)}var p=this,l=THREE.Loader.prototype.extractUrlBase(c),r,t,n,s,q,v,y,D,F,H,I,G,B,C=[],A=a,J;for(J in this.geometryHandlerMap)a=this.geometryHandlerMap[J].loaderClass,this.geometryHandlerMap[J].loaderObject=
|
|
|
+new a;for(J in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[J].loaderClass,this.hierarchyHandlerMap[J].loaderObject=new a;H=F=0;B={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(A.transform&&(J=A.transform.position,a=A.transform.rotation,c=A.transform.scale,J&&B.scene.position.fromArray(J),a&&B.scene.rotation.fromArray(a),c&&B.scene.scale.fromArray(c),J||a||c))B.scene.updateMatrix(),B.scene.updateMatrixWorld();
|
|
|
+J=function(a){return function(){H-=a;j();p.onLoadComplete()}};for(var N in A.fogs)a=A.fogs[N],"linear"===a.type?s=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(s=new THREE.FogExp2(0,a.density)),a=a.color,s.color.setRGB(a[0],a[1],a[2]),B.fogs[N]=s;for(var z in A.geometries)s=A.geometries[z],s.type in this.geometryHandlerMap&&(F+=1,p.onLoadStart());for(var L in A.objects)m(A.objects[L],function(a){a.type&&a.type in p.hierarchyHandlerMap&&(F+=1,p.onLoadStart())});I=F;for(z in A.geometries)if(s=A.geometries[z],
|
|
|
+"cube"===s.type)r=new THREE.CubeGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments),r.name=z,B.geometries[z]=r;else if("plane"===s.type)r=new THREE.PlaneGeometry(s.width,s.height,s.widthSegments,s.heightSegments),r.name=z,B.geometries[z]=r;else if("sphere"===s.type)r=new THREE.SphereGeometry(s.radius,s.widthSegments,s.heightSegments),r.name=z,B.geometries[z]=r;else if("cylinder"===s.type)r=new THREE.CylinderGeometry(s.topRad,s.botRad,s.height,s.radSegs,s.heightSegs),
|
|
|
+r.name=z,B.geometries[z]=r;else if("torus"===s.type)r=new THREE.TorusGeometry(s.radius,s.tube,s.segmentsR,s.segmentsT),r.name=z,B.geometries[z]=r;else if("icosahedron"===s.type)r=new THREE.IcosahedronGeometry(s.radius,s.subdivisions),r.name=z,B.geometries[z]=r;else if(s.type in this.geometryHandlerMap){L={};for(q in s)"type"!==q&&"url"!==q&&(L[q]=s[q]);this.geometryHandlerMap[s.type].loaderObject.load(d(s.url,A.urlBaseType),h(z),L)}else"embedded"===s.type&&(L=A.embeds[s.id],L.metadata=A.metadata,
|
|
|
+L&&(L=this.geometryHandlerMap.ascii.loaderObject.parse(L,""),i(z)(L.geometry,L.materials)));for(var w in A.textures)if(z=A.textures[w],z.url instanceof Array){H+=z.url.length;for(q=0;q<z.url.length;q++)p.onLoadStart()}else H+=1,p.onLoadStart();G=H;for(w in A.textures){z=A.textures[w];void 0!==z.mapping&&void 0!==THREE[z.mapping]&&(z.mapping=new THREE[z.mapping]);if(z.url instanceof Array){L=z.url.length;s=[];for(q=0;q<L;q++)s[q]=d(z.url[q],A.urlBaseType);q=(q=/\.dds$/i.test(s[0]))?THREE.ImageUtils.loadCompressedTextureCube(s,
|
|
|
+z.mapping,J(L)):THREE.ImageUtils.loadTextureCube(s,z.mapping,J(L))}else q=/\.dds$/i.test(z.url),L=d(z.url,A.urlBaseType),s=J(1),q=q?THREE.ImageUtils.loadCompressedTexture(L,z.mapping,s):THREE.ImageUtils.loadTexture(L,z.mapping,s),void 0!==THREE[z.minFilter]&&(q.minFilter=THREE[z.minFilter]),void 0!==THREE[z.magFilter]&&(q.magFilter=THREE[z.magFilter]),z.anisotropy&&(q.anisotropy=z.anisotropy),z.repeat&&(q.repeat.set(z.repeat[0],z.repeat[1]),1!==z.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==z.repeat[1]&&
|
|
|
+(q.wrapT=THREE.RepeatWrapping)),z.offset&&q.offset.set(z.offset[0],z.offset[1]),z.wrap&&(L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==L[z.wrap[0]]&&(q.wrapS=L[z.wrap[0]]),void 0!==L[z.wrap[1]]&&(q.wrapT=L[z.wrap[1]]));B.textures[w]=q}var Z,K;for(Z in A.materials){w=A.materials[Z];for(K in w.parameters)"envMap"===K||"map"===K||"lightMap"===K||"bumpMap"===K?w.parameters[K]=B.textures[w.parameters[K]]:"shading"===K?w.parameters[K]="flat"===w.parameters[K]?THREE.FlatShading:
|
|
|
+THREE.SmoothShading:"side"===K?w.parameters[K]="double"==w.parameters[K]?THREE.DoubleSide:"back"==w.parameters[K]?THREE.BackSide:THREE.FrontSide:"blending"===K?w.parameters[K]=w.parameters[K]in THREE?THREE[w.parameters[K]]:THREE.NormalBlending:"combine"===K?w.parameters[K]=w.parameters[K]in THREE?THREE[w.parameters[K]]:THREE.MultiplyOperation:"vertexColors"===K?"face"==w.parameters[K]?w.parameters[K]=THREE.FaceColors:w.parameters[K]&&(w.parameters[K]=THREE.VertexColors):"wrapRGB"===K&&(J=w.parameters[K],
|
|
|
+w.parameters[K]=new THREE.Vector3(J[0],J[1],J[2]));void 0!==w.parameters.opacity&&1>w.parameters.opacity&&(w.parameters.transparent=!0);w.parameters.normalMap?(J=THREE.ShaderLib.normalmap,z=THREE.UniformsUtils.clone(J.uniforms),q=w.parameters.color,L=w.parameters.specular,s=w.parameters.ambient,N=w.parameters.shininess,z.tNormal.value=B.textures[w.parameters.normalMap],w.parameters.normalScale&&z.uNormalScale.value.set(w.parameters.normalScale[0],w.parameters.normalScale[1]),w.parameters.map&&(z.tDiffuse.value=
|
|
|
+w.parameters.map,z.enableDiffuse.value=!0),w.parameters.envMap&&(z.tCube.value=w.parameters.envMap,z.enableReflection.value=!0,z.uReflectivity.value=w.parameters.reflectivity),w.parameters.lightMap&&(z.tAO.value=w.parameters.lightMap,z.enableAO.value=!0),w.parameters.specularMap&&(z.tSpecular.value=B.textures[w.parameters.specularMap],z.enableSpecular.value=!0),w.parameters.displacementMap&&(z.tDisplacement.value=B.textures[w.parameters.displacementMap],z.enableDisplacement.value=!0,z.uDisplacementBias.value=
|
|
|
+w.parameters.displacementBias,z.uDisplacementScale.value=w.parameters.displacementScale),z.uDiffuseColor.value.setHex(q),z.uSpecularColor.value.setHex(L),z.uAmbientColor.value.setHex(s),z.uShininess.value=N,w.parameters.opacity&&(z.uOpacity.value=w.parameters.opacity),t=new THREE.ShaderMaterial({fragmentShader:J.fragmentShader,vertexShader:J.vertexShader,uniforms:z,lights:!0,fog:!0})):t=new THREE[w.type](w.parameters);t.name=Z;B.materials[Z]=t}for(Z in A.materials)if(w=A.materials[Z],w.parameters.materials){K=
|
|
|
+[];for(q=0;q<w.parameters.materials.length;q++)K.push(B.materials[w.parameters.materials[q]]);B.materials[Z].materials=K}e();B.cameras&&A.defaults.camera&&(B.currentCamera=B.cameras[A.defaults.camera]);B.fogs&&A.defaults.fog&&(B.scene.fog=B.fogs[A.defaults.fog]);p.callbackSync(B);j()};THREE.TextureLoader=function(){this.crossOrigin=null};
|
|
|
THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",
|
|
|
function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
|
|
|
THREE.Material.prototype={constructor:THREE.Material,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof
|
|
@@ -259,10 +259,10 @@ THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;T
|
|
|
this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=new THREE.Texture;this.useScreenCoordinates=!0;this.depthTest=!this.useScreenCoordinates;this.sizeAttenuation=!this.useScreenCoordinates;this.scaleByViewport=!this.sizeAttenuation;this.alignment=THREE.SpriteAlignment.center.clone();this.fog=!1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1);this.setValues(a);a=a||{};void 0===a.depthTest&&(this.depthTest=!this.useScreenCoordinates);
|
|
|
void 0===a.sizeAttenuation&&(this.sizeAttenuation=!this.useScreenCoordinates);void 0===a.scaleByViewport&&(this.scaleByViewport=!this.sizeAttenuation)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
|
THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.useScreenCoordinates=this.useScreenCoordinates;a.sizeAttenuation=this.sizeAttenuation;a.scaleByViewport=this.scaleByViewport;a.alignment.copy(this.alignment);a.uvOffset.copy(this.uvOffset);a.uvScale.copy(this.uvScale);a.fog=this.fog;return a};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
|
|
|
-THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Texture=function(a,b,c,d,e,f,g,h,i){this.id=THREE.TextureIdCount++;this.name="";this.image=a;this.mipmaps=[];this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==i?i:1;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,
|
|
|
+THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Texture=function(a,b,c,d,e,f,h,g,i){this.id=THREE.TextureIdCount++;this.name="";this.image=a;this.mipmaps=[];this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==i?i:1;this.format=void 0!==h?h:THREE.RGBAFormat;this.type=void 0!==g?g:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,
|
|
|
0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.needsUpdate=!1;this.onUpdate=null};
|
|
|
THREE.Texture.prototype={constructor:THREE.Texture,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;
|
|
|
-a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,g,h,i,j,l){THREE.Texture.call(this,null,f,g,h,i,j,d,e,l);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,j,l){THREE.Texture.call(this,null,f,g,h,i,j,d,e,l);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.Particle.prototype.clone=function(a){void 0===a&&(a=new THREE.Particle(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;this.geometry&&null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere();this.frustumCulled=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
+a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,h,g,i,j,m){THREE.Texture.call(this,null,f,h,g,i,j,d,e,m);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,h,g,i,j,m){THREE.Texture.call(this,null,f,h,g,i,j,d,e,m);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.Particle.prototype.clone=function(a){void 0===a&&(a=new THREE.Particle(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;this.geometry&&null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere();this.frustumCulled=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.ParticleSystem.prototype.clone=function(a){void 0===a&&(a=new THREE.ParticleSystem(this.geometry,this.material));a.sortParticles=this.sortParticles;THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.type));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.material=this.geometry=null;this.setGeometry(a);this.setMaterial(b)};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.setGeometry=function(a){void 0!==a&&(this.geometry=a,null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere(),this.updateMorphTargets())};THREE.Mesh.prototype.setMaterial=function(a){this.material=void 0!==a?a:new THREE.MeshBasicMaterial({color:16777215*Math.random(),wireframe:!0})};
|
|
|
THREE.Mesh.prototype.updateMorphTargets=function(){if(0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
|
|
@@ -273,7 +273,7 @@ THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&
|
|
|
b;a++)c=new THREE.Matrix4,c.getInverse(this.bones[a].skinMatrix),this.boneInverses.push(c)}a=0;for(b=this.bones.length;a<b;a++)THREE.SkinnedMesh.offsetMatrix.multiplyMatrices(this.bones[a].skinMatrix,this.boneInverses[a]),THREE.SkinnedMesh.offsetMatrix.flattenToArrayOffset(this.boneMatrices,16*a);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)};
|
|
|
THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a=0;a<this.geometry.skinIndices.length;a++){var b=this.geometry.skinWeights[a],c=1/b.lengthManhattan();Infinity!==c?b.multiplyScalar(c):b.set(1)}};THREE.SkinnedMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture));THREE.Mesh.prototype.clone.call(this,a);return a};THREE.SkinnedMesh.offsetMatrix=new THREE.Matrix4;THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};
|
|
|
THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=!0};
|
|
|
-THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)(\d+)/,e=0,f=a.morphTargets.length;e<f;e++){var g=a.morphTargets[e].name.match(d);if(g&&1<g.length){g=g[1];c[g]||(c[g]={start:Infinity,end:-Infinity});var h=c[g];e<h.start&&(h.start=e);e>h.end&&(h.end=e);b||(b=g)}}a.firstAnimation=b};
|
|
|
+THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)(\d+)/,e=0,f=a.morphTargets.length;e<f;e++){var h=a.morphTargets[e].name.match(d);if(h&&1<h.length){h=h[1];c[h]||(c[h]={start:Infinity,end:-Infinity});var g=c[h];e<g.start&&(g.start=e);e>g.end&&(g.end=e);b||(b=h)}}a.firstAnimation=b};
|
|
|
THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={});this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=1E3*((c.end-c.start)/b),this.time=0):console.warn("animation["+a+"] undefined")};
|
|
|
THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||0>this.time)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)}else this.time%=this.duration,0>this.time&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);a!==this.currentKeyframe&&
|
|
|
(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};
|
|
@@ -281,37 +281,37 @@ THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAn
|
|
|
THREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){if(1<this.objects.length){a.getPositionFromMatrix(c.matrixWorld);b.getPositionFromMatrix(this.matrixWorld);c=a.distanceTo(b);this.objects[0].object.visible=!0;for(var d=1,e=this.objects.length;d<e;d++)if(c>=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;d<e;d++)this.objects[d].object.visible=!1}}}();THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial;this.rotation3d=this.rotation;this.rotation=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.rotation3d.set(0,0,this.rotation);this.quaternion.setFromEuler(this.rotation3d,this.eulerOrder);this.matrix.makeFromPositionQuaternionScale(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0};
|
|
|
THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
-THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){B!==a&&(B=y.globalAlpha=a)}function c(a){E!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(y.globalCompositeOperation="darker"),E=a)}function d(a){I!==a&&(I=y.lineWidth=a)}function e(a){O!==a&&(O=y.lineCap=a)}function f(a){C!==a&&(C=y.lineJoin=a)}function g(a){z!==a&&(z=y.strokeStyle=a)}function h(a){G!==a&&(G=y.fillStyle=a)}function i(a,
|
|
|
-b){if(H!==a||M!==b)y.setLineDash([a,b]),H=a,M=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var j=THREE.Math.smoothstep,a=a||{},l=this,n,m,p,t=new THREE.Projector,r=void 0!==a.canvas?a.canvas:document.createElement("canvas"),q,s,u,w,y=r.getContext("2d"),F=new THREE.Color(0),J=0,B=1,E=0,z=null,G=null,I=null,O=null,C=null,H=null,M=0,A,R,K,fa,wa=new THREE.RenderableVertex,Ma=new THREE.RenderableVertex,N,W,ja,na,L,ea,Wa,ab,fb,Ka,qa,pa,Y=new THREE.Color,ga=new THREE.Color,V=new THREE.Color,$=new THREE.Color,
|
|
|
-la=new THREE.Color,ha=new THREE.Color,ia=new THREE.Color,Qa=new THREE.Color,kb={},oa={},Xa,Ra,Aa,Sa,tb,Nb,Kb,Ob,Tb,Ub,Ta=new THREE.Box2,ua=new THREE.Box2,Ja=new THREE.Box2,ub=new THREE.Color,Na=new THREE.Color,ra=new THREE.Color,bb=new THREE.Vector3,Ab,k,Bb,Ua,lb,Va,Cb=16;Ab=document.createElement("canvas");Ab.width=Ab.height=2;k=Ab.getContext("2d");k.fillStyle="rgba(0,0,0,1)";k.fillRect(0,0,2,2);Bb=k.getImageData(0,0,2,2);Ua=Bb.data;lb=document.createElement("canvas");lb.width=lb.height=Cb;Va=lb.getContext("2d");
|
|
|
-Va.translate(-Cb/2,-Cb/2);Va.scale(Cb,Cb);Cb--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});this.domElement=r;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){q=
|
|
|
-a*this.devicePixelRatio;s=b*this.devicePixelRatio;u=Math.floor(q/2);w=Math.floor(s/2);r.width=q;r.height=s;1!==this.devicePixelRatio&&!1!==c&&(r.style.width=a+"px",r.style.height=b+"px");Ta.set(new THREE.Vector2(-u,-w),new THREE.Vector2(u,w));ua.set(new THREE.Vector2(-u,-w),new THREE.Vector2(u,w));B=1;E=0;C=O=I=G=z=null};this.setClearColor=function(a,b){F.set(a);J=void 0!==b?b:1;ua.set(new THREE.Vector2(-u,-w),new THREE.Vector2(u,w))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");
|
|
|
-this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){y.setTransform(1,0,0,-1,u,w);!1===ua.empty()&&(ua.intersect(Ta),ua.expandByScalar(2),1>J&&y.clearRect(ua.min.x|0,ua.min.y|0,ua.max.x-ua.min.x|0,ua.max.y-ua.min.y|0),0<J&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*F.r)+","+Math.floor(255*F.g)+","+Math.floor(255*F.b)+","+J+")"),y.fillRect(ua.min.x|0,ua.min.y|0,ua.max.x-ua.min.x|0,ua.max.y-ua.min.y|0)),ua.makeEmpty())};this.render=function(a,r){function q(a,
|
|
|
-b,c){for(var d=0,e=p.length;d<e;d++){var f=p[d];Qa.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=bb.getPositionFromMatrix(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(Qa.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=bb.getPositionFromMatrix(f.matrixWorld),h=b.dot(bb.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Qa.multiplyScalar(h)))))}}function s(a,d,e,f,g,h,k,i){l.info.render.vertices+=
|
|
|
-3;l.info.render.faces++;b(i.opacity);c(i.blending);N=a.positionScreen.x;W=a.positionScreen.y;ja=d.positionScreen.x;na=d.positionScreen.y;L=e.positionScreen.x;ea=e.positionScreen.y;z(N,W,ja,na,L,ea);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(ha.copy(i.color),ia.copy(i.emissive),i.vertexColors===THREE.FaceColors&&ha.multiply(k.color),!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==k.vertexNormalsLength?(ga.copy(ub),V.copy(ub),$.copy(ub),q(k.v1.positionWorld,
|
|
|
-k.vertexNormalsModel[0],ga),q(k.v2.positionWorld,k.vertexNormalsModel[1],V),q(k.v3.positionWorld,k.vertexNormalsModel[2],$),ga.multiply(ha).add(ia),V.multiply(ha).add(ia),$.multiply(ha).add(ia),la.addColors(V,$).multiplyScalar(0.5),Aa=I(ga,V,$,la),H(N,W,ja,na,L,ea,0,0,1,0,0,1,Aa)):(Y.copy(ub),q(k.centroidModel,k.normalModel,Y),Y.multiply(ha).add(ia),!0===i.wireframe?E(Y,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):B(Y))):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||
|
|
|
-i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Sa=k.uvs[0],J(N,W,ja,na,L,ea,Sa[f].x,Sa[f].y,Sa[g].x,Sa[g].y,Sa[h].x,Sa[h].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(bb.copy(k.vertexNormalsModelView[f]),tb=0.5*bb.x+0.5,Nb=0.5*bb.y+0.5,bb.copy(k.vertexNormalsModelView[g]),Kb=0.5*bb.x+0.5,Ob=0.5*bb.y+0.5,bb.copy(k.vertexNormalsModelView[h]),Tb=0.5*bb.x+0.5,Ub=0.5*bb.y+0.5,J(N,W,ja,na,L,ea,tb,Nb,Kb,Ob,Tb,Ub,i.envMap)):
|
|
|
-(Y.copy(i.color),i.vertexColors===THREE.FaceColors&&Y.multiply(k.color),!0===i.wireframe?E(Y,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):B(Y)):i instanceof THREE.MeshDepthMaterial?(Xa=r.near,Ra=r.far,ga.r=ga.g=ga.b=1-j(a.positionScreen.z*a.positionScreen.w,Xa,Ra),V.r=V.g=V.b=1-j(d.positionScreen.z*d.positionScreen.w,Xa,Ra),$.r=$.g=$.b=1-j(e.positionScreen.z*e.positionScreen.w,Xa,Ra),la.addColors(V,$).multiplyScalar(0.5),Aa=I(ga,V,$,la),H(N,W,ja,na,L,ea,0,0,1,0,0,1,Aa)):i instanceof
|
|
|
-THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(a=k.normalModelView,Y.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?E(Y,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):B(Y)):i.shading==THREE.SmoothShading&&(a=k.vertexNormalsModelView[f],ga.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=k.vertexNormalsModelView[g],V.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=k.vertexNormalsModelView[h],$.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
-la.addColors(V,$).multiplyScalar(0.5),Aa=I(ga,V,$,la),H(N,W,ja,na,L,ea,0,0,1,0,0,1,Aa)))}function z(a,b,c,d,e,f){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.closePath()}function F(a,b,c,d,e,f,g,h){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.lineTo(g,h);y.closePath()}function E(a,b,c,h){d(b);e(c);f(h);g(a.getStyle());y.stroke();Ja.expandByScalar(2*b)}function B(a){h(a.getStyle());y.fill()}function J(a,b,c,d,e,f,g,k,i,xa,j,l,m){if(!(m instanceof THREE.DataTexture||void 0===
|
|
|
-m.image||0==m.image.width)){if(!0===m.needsUpdate){var n=m.wrapS==THREE.RepeatWrapping,Ya=m.wrapT==THREE.RepeatWrapping;kb[m.id]=y.createPattern(m.image,!0===n&&!0===Ya?"repeat":!0===n&&!1===Ya?"repeat-x":!1===n&&!0===Ya?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===kb[m.id]?h("rgba(0,0,0,1)"):h(kb[m.id]);var n=m.offset.x/m.repeat.x,Ya=m.offset.y/m.repeat.y,ob=m.image.width*m.repeat.x,p=m.image.height*m.repeat.y,g=(g+n)*ob,k=(1-k+Ya)*p,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+n)*ob-g,xa=(1-xa+Ya)*p-k,j=(j+
|
|
|
-n)*ob-g,l=(1-l+Ya)*p-k,n=i*l-j*xa;0===n?(void 0===oa[m.id]&&(b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),oa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=oa[m.id],g=4*(Math.floor(g)+Math.floor(k)*m.image.width),Y.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),B(Y)):(n=1/n,m=(l*c-xa*e)*n,xa=(l*d-xa*f)*n,c=(i*e-j*c)*n,d=(i*f-j*d)*n,a=a-m*g-c*k,g=b-xa*g-d*k,y.save(),y.transform(m,xa,c,d,a,g),y.fill(),y.restore())}}
|
|
|
-function H(a,b,c,d,e,f,g,h,k,i,xa,j,m){var l,n;l=m.width-1;n=m.height-1;g*=l;h*=n;c-=a;d-=b;e-=a;f-=b;k=k*l-g;i=i*n-h;xa=xa*l-g;j=j*n-h;n=1/(k*j-xa*i);l=(j*c-i*e)*n;i=(j*d-i*f)*n;c=(k*e-xa*c)*n;d=(k*f-xa*d)*n;a=a-l*g-c*h;b=b-i*g-d*h;y.save();y.transform(l,i,c,d,a,b);y.clip();y.drawImage(m,0,0);y.restore()}function I(a,b,c,d){Ua[0]=255*a.r|0;Ua[1]=255*a.g|0;Ua[2]=255*a.b|0;Ua[4]=255*b.r|0;Ua[5]=255*b.g|0;Ua[6]=255*b.b|0;Ua[8]=255*c.r|0;Ua[9]=255*c.g|0;Ua[10]=255*c.b|0;Ua[12]=255*d.r|0;Ua[13]=255*d.g|
|
|
|
-0;Ua[14]=255*d.b|0;k.putImageData(Bb,0,0);Va.drawImage(Ab,0,0);return lb}function M(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===r instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,u,w);l.info.render.vertices=0;l.info.render.faces=0;n=t.projectScene(a,r,this.sortObjects,this.sortElements);m=n.elements;p=n.lights;
|
|
|
-ub.setRGB(0,0,0);Na.setRGB(0,0,0);ra.setRGB(0,0,0);for(var C=0,O=p.length;C<O;C++){var P=p[C],G=P.color;P instanceof THREE.AmbientLight?ub.add(G):P instanceof THREE.DirectionalLight?Na.add(G):P instanceof THREE.PointLight&&ra.add(G)}C=0;for(O=m.length;C<O;C++){var X=m[C],P=X.material;if(!(void 0===P||!1===P.visible)){Ja.makeEmpty();if(X instanceof THREE.RenderableParticle){A=X;A.x*=u;A.y*=w;G=A;b(P.opacity);c(P.blending);var xa=void 0,mb=void 0,Ya=void 0,ob=void 0,Pb=void 0,Oc=void 0,Pc=void 0;P instanceof
|
|
|
-THREE.ParticleBasicMaterial?null===P.map?(Ya=X.object.scale.x,ob=X.object.scale.y,Ya*=X.scale.x*u,ob*=X.scale.y*w,Ja.min.set(G.x-Ya,G.y-ob),Ja.max.set(G.x+Ya,G.y+ob),!1===Ta.isIntersectionBox(Ja)?Ja.makeEmpty():(h(P.color.getStyle()),y.save(),y.translate(G.x,G.y),y.rotate(-X.rotation),y.scale(Ya,ob),y.fillRect(-1,-1,2,2),y.restore())):(Pb=P.map.image,Oc=Pb.width>>1,Pc=Pb.height>>1,Ya=X.scale.x*u,ob=X.scale.y*w,xa=Ya*Oc,mb=ob*Pc,Ja.min.set(G.x-xa,G.y-mb),Ja.max.set(G.x+xa,G.y+mb),!1===Ta.isIntersectionBox(Ja)?
|
|
|
-Ja.makeEmpty():(y.save(),y.translate(G.x,G.y),y.rotate(-X.rotation),y.scale(Ya,-ob),y.translate(-Oc,-Pc),y.drawImage(Pb,0,0),y.restore())):P instanceof THREE.ParticleCanvasMaterial&&(xa=X.scale.x*u,mb=X.scale.y*w,Ja.min.set(G.x-xa,G.y-mb),Ja.max.set(G.x+xa,G.y+mb),!1===Ta.isIntersectionBox(Ja)?Ja.makeEmpty():(g(P.color.getStyle()),h(P.color.getStyle()),y.save(),y.translate(G.x,G.y),y.rotate(-X.rotation),y.scale(xa,mb),P.program(y),y.restore()))}else if(X instanceof THREE.RenderableLine){if(A=X.v1,
|
|
|
-R=X.v2,A.positionScreen.x*=u,A.positionScreen.y*=w,R.positionScreen.x*=u,R.positionScreen.y*=w,Ja.setFromPoints([A.positionScreen,R.positionScreen]),!0===Ta.isIntersectionBox(Ja))if(G=A,xa=R,b(P.opacity),c(P.blending),y.beginPath(),y.moveTo(G.positionScreen.x,G.positionScreen.y),y.lineTo(xa.positionScreen.x,xa.positionScreen.y),P instanceof THREE.LineBasicMaterial){d(P.linewidth);e(P.linecap);f(P.linejoin);if(P.vertexColors!==THREE.VertexColors)g(P.color.getStyle());else if(mb=X.vertexColors[0].getStyle(),
|
|
|
-X=X.vertexColors[1].getStyle(),mb===X)g(mb);else{try{var qc=y.createLinearGradient(G.positionScreen.x,G.positionScreen.y,xa.positionScreen.x,xa.positionScreen.y);qc.addColorStop(0,mb);qc.addColorStop(1,X)}catch(ed){qc=mb}g(qc)}y.stroke();Ja.expandByScalar(2*P.linewidth)}else P instanceof THREE.LineDashedMaterial&&(d(P.linewidth),e(P.linecap),f(P.linejoin),g(P.color.getStyle()),i(P.dashSize,P.gapSize),y.stroke(),Ja.expandByScalar(2*P.linewidth),i(null,null))}else if(X instanceof THREE.RenderableFace3){A=
|
|
|
-X.v1;R=X.v2;K=X.v3;if(-1>A.positionScreen.z||1<A.positionScreen.z)continue;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;A.positionScreen.x*=u;A.positionScreen.y*=w;R.positionScreen.x*=u;R.positionScreen.y*=w;K.positionScreen.x*=u;K.positionScreen.y*=w;!0===P.overdraw&&(M(A.positionScreen,R.positionScreen),M(R.positionScreen,K.positionScreen),M(K.positionScreen,A.positionScreen));Ja.setFromPoints([A.positionScreen,R.positionScreen,
|
|
|
-K.positionScreen]);!0===Ta.isIntersectionBox(Ja)&&s(A,R,K,0,1,2,X,P)}else if(X instanceof THREE.RenderableFace4){A=X.v1;R=X.v2;K=X.v3;fa=X.v4;if(-1>A.positionScreen.z||1<A.positionScreen.z)continue;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>fa.positionScreen.z||1<fa.positionScreen.z)continue;A.positionScreen.x*=u;A.positionScreen.y*=w;R.positionScreen.x*=u;R.positionScreen.y*=w;K.positionScreen.x*=u;K.positionScreen.y*=w;fa.positionScreen.x*=
|
|
|
-u;fa.positionScreen.y*=w;wa.positionScreen.copy(R.positionScreen);Ma.positionScreen.copy(fa.positionScreen);!0===P.overdraw&&(M(A.positionScreen,R.positionScreen),M(R.positionScreen,fa.positionScreen),M(fa.positionScreen,A.positionScreen),M(K.positionScreen,wa.positionScreen),M(K.positionScreen,Ma.positionScreen));Ja.setFromPoints([A.positionScreen,R.positionScreen,K.positionScreen,fa.positionScreen]);!0===Ta.isIntersectionBox(Ja)&&(G=A,xa=R,mb=K,Ya=fa,ob=wa,Pb=Ma,l.info.render.vertices+=4,l.info.render.faces++,
|
|
|
-b(P.opacity),c(P.blending),void 0!==P.map&&null!==P.map||void 0!==P.envMap&&null!==P.envMap?(s(G,xa,Ya,0,1,3,X,P),s(ob,mb,Pb,1,2,3,X,P)):(N=G.positionScreen.x,W=G.positionScreen.y,ja=xa.positionScreen.x,na=xa.positionScreen.y,L=mb.positionScreen.x,ea=mb.positionScreen.y,Wa=Ya.positionScreen.x,ab=Ya.positionScreen.y,fb=ob.positionScreen.x,Ka=ob.positionScreen.y,qa=Pb.positionScreen.x,pa=Pb.positionScreen.y,P instanceof THREE.MeshLambertMaterial||P instanceof THREE.MeshPhongMaterial?(ha.copy(P.color),
|
|
|
-ia.copy(P.emissive),P.vertexColors===THREE.FaceColors&&ha.multiply(X.color),!1===P.wireframe&&P.shading==THREE.SmoothShading&&4==X.vertexNormalsLength?(ga.copy(ub),V.copy(ub),$.copy(ub),la.copy(ub),q(X.v1.positionWorld,X.vertexNormalsModel[0],ga),q(X.v2.positionWorld,X.vertexNormalsModel[1],V),q(X.v4.positionWorld,X.vertexNormalsModel[3],$),q(X.v3.positionWorld,X.vertexNormalsModel[2],la),ga.multiply(ha).add(ia),V.multiply(ha).add(ia),$.multiply(ha).add(ia),la.multiply(ha).add(ia),Aa=I(ga,V,$,la),
|
|
|
-z(N,W,ja,na,Wa,ab),H(N,W,ja,na,Wa,ab,0,0,1,0,0,1,Aa),z(fb,Ka,L,ea,qa,pa),H(fb,Ka,L,ea,qa,pa,1,0,1,1,0,1,Aa)):(Y.copy(ub),q(X.centroidModel,X.normalModel,Y),Y.multiply(ha).add(ia),F(N,W,ja,na,L,ea,Wa,ab),!0===P.wireframe?E(Y,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):B(Y))):P instanceof THREE.MeshBasicMaterial?(Y.copy(P.color),P.vertexColors===THREE.FaceColors&&Y.multiply(X.color),F(N,W,ja,na,L,ea,Wa,ab),!0===P.wireframe?E(Y,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):
|
|
|
-B(Y)):P instanceof THREE.MeshNormalMaterial?(G=void 0,P.shading==THREE.FlatShading?(G=X.normalModelView,Y.setRGB(G.x,G.y,G.z).multiplyScalar(0.5).addScalar(0.5),F(N,W,ja,na,L,ea,Wa,ab),!0===P.wireframe?E(Y,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):B(Y)):P.shading==THREE.SmoothShading&&(G=X.vertexNormalsModelView[0],ga.setRGB(G.x,G.y,G.z).multiplyScalar(0.5).addScalar(0.5),G=X.vertexNormalsModelView[1],V.setRGB(G.x,G.y,G.z).multiplyScalar(0.5).addScalar(0.5),G=X.vertexNormalsModelView[3],
|
|
|
-$.setRGB(G.x,G.y,G.z).multiplyScalar(0.5).addScalar(0.5),G=X.vertexNormalsModelView[2],la.setRGB(G.x,G.y,G.z).multiplyScalar(0.5).addScalar(0.5),Aa=I(ga,V,$,la),z(N,W,ja,na,Wa,ab),H(N,W,ja,na,Wa,ab,0,0,1,0,0,1,Aa),z(fb,Ka,L,ea,qa,pa),H(fb,Ka,L,ea,qa,pa,1,0,1,1,0,1,Aa))):P instanceof THREE.MeshDepthMaterial&&(Xa=r.near,Ra=r.far,ga.r=ga.g=ga.b=1-j(G.positionScreen.z*G.positionScreen.w,Xa,Ra),V.r=V.g=V.b=1-j(xa.positionScreen.z*xa.positionScreen.w,Xa,Ra),$.r=$.g=$.b=1-j(Ya.positionScreen.z*Ya.positionScreen.w,
|
|
|
-Xa,Ra),la.r=la.g=la.b=1-j(mb.positionScreen.z*mb.positionScreen.w,Xa,Ra),Aa=I(ga,V,$,la),z(N,W,ja,na,Wa,ab),H(N,W,ja,na,Wa,ab,0,0,1,0,0,1,Aa),z(fb,Ka,L,ea,qa,pa),H(fb,Ka,L,ea,qa,pa,1,0,1,1,0,1,Aa))))}ua.union(Ja)}}y.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
+THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=I.length;d<e;d++){var f=I[d];Xb.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=Xa.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Xb.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=Xa.getPositionFromMatrix(f.matrixWorld),g=b.dot(Xa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Xb.multiplyScalar(g)))))}}
|
|
|
+function c(a,c,e,m,r,s,U,n){D.info.render.vertices+=3;D.info.render.faces++;p(n.opacity);l(n.blending);ya=a.positionScreen.x;Ha=a.positionScreen.y;fa=c.positionScreen.x;da=c.positionScreen.y;T=e.positionScreen.x;aa=e.positionScreen.y;d(ya,Ha,fa,da,T,aa);(n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial)&&null===n.map?(Qa.copy(n.color),Ya.copy(n.emissive),n.vertexColors===THREE.FaceColors&&Qa.multiply(U.color),!1===n.wireframe&&n.shading==THREE.SmoothShading&&3==U.vertexNormalsLength?
|
|
|
+(ra.copy(ib),ka.copy(ib),ua.copy(ib),b(U.v1.positionWorld,U.vertexNormalsModel[0],ra),b(U.v2.positionWorld,U.vertexNormalsModel[1],ka),b(U.v3.positionWorld,U.vertexNormalsModel[2],ua),ra.multiply(Qa).add(Ya),ka.multiply(Qa).add(Ya),ua.multiply(Qa).add(Ya),Ra.addColors(ka,ua).multiplyScalar(0.5),lb=j(ra,ka,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):(ha.copy(ib),b(U.centroidModel,U.normalModel,ha),ha.multiply(Qa).add(Ya),!0===n.wireframe?f(ha,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):
|
|
|
+h(ha))):n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial?null!==n.map?n.map.mapping instanceof THREE.UVMapping&&(Ga=U.uvs[0],g(ya,Ha,fa,da,T,aa,Ga[m].x,Ga[m].y,Ga[r].x,Ga[r].y,Ga[s].x,Ga[s].y,n.map)):null!==n.envMap?n.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(Xa.copy(U.vertexNormalsModelView[m]),Ca=0.5*Xa.x+0.5,yb=0.5*Xa.y+0.5,Xa.copy(U.vertexNormalsModelView[r]),Ib=0.5*Xa.x+0.5,k=0.5*Xa.y+0.5,Xa.copy(U.vertexNormalsModelView[s]),
|
|
|
+Rb=0.5*Xa.x+0.5,Yb=0.5*Xa.y+0.5,g(ya,Ha,fa,da,T,aa,Ca,yb,Ib,k,Rb,Yb,n.envMap)):(ha.copy(n.color),n.vertexColors===THREE.FaceColors&&ha.multiply(U.color),!0===n.wireframe?f(ha,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):h(ha)):n instanceof THREE.MeshDepthMaterial?(Sa=M.near,xb=M.far,ra.r=ra.g=ra.b=1-y(a.positionScreen.z*a.positionScreen.w,Sa,xb),ka.r=ka.g=ka.b=1-y(c.positionScreen.z*c.positionScreen.w,Sa,xb),ua.r=ua.g=ua.b=1-y(e.positionScreen.z*e.positionScreen.w,Sa,xb),Ra.addColors(ka,
|
|
|
+ua).multiplyScalar(0.5),lb=j(ra,ka,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):n instanceof THREE.MeshNormalMaterial&&(n.shading==THREE.FlatShading?(a=U.normalModelView,ha.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===n.wireframe?f(ha,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):h(ha)):n.shading==THREE.SmoothShading&&(a=U.vertexNormalsModelView[m],ra.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=U.vertexNormalsModelView[r],ka.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
+a=U.vertexNormalsModelView[s],ua.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),Ra.addColors(ka,ua).multiplyScalar(0.5),lb=j(ra,ka,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)))}function d(a,b,c,d,e,f){z.beginPath();z.moveTo(a,b);z.lineTo(c,d);z.lineTo(e,f);z.closePath()}function e(a,b,c,d,e,f,h,g){z.beginPath();z.moveTo(a,b);z.lineTo(c,d);z.lineTo(e,f);z.lineTo(h,g);z.closePath()}function f(a,b,c,d){r(b);t(c);n(d);s(a.getStyle());z.stroke();va.expandByScalar(2*b)}function h(a){q(a.getStyle());
|
|
|
+z.fill()}function g(a,b,c,d,e,f,g,k,i,j,p,m,l){if(!(l instanceof THREE.DataTexture||void 0===l.image||0==l.image.width)){if(!0===l.needsUpdate){var n=l.wrapS==THREE.RepeatWrapping,r=l.wrapT==THREE.RepeatWrapping;Jb[l.id]=z.createPattern(l.image,!0===n&&!0===r?"repeat":!0===n&&!1===r?"repeat-x":!1===n&&!0===r?"repeat-y":"no-repeat");l.needsUpdate=!1}void 0===Jb[l.id]?q("rgba(0,0,0,1)"):q(Jb[l.id]);var n=l.offset.x/l.repeat.x,r=l.offset.y/l.repeat.y,s=l.image.width*l.repeat.x,t=l.image.height*l.repeat.y,
|
|
|
+g=(g+n)*s,k=(1-k+r)*t,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+n)*s-g,j=(1-j+r)*t-k,p=(p+n)*s-g,m=(1-m+r)*t-k,n=i*m-p*j;0===n?(void 0===Ab[l.id]&&(b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,b=b.getContext("2d"),b.drawImage(l.image,0,0),Ab[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data),b=Ab[l.id],g=4*(Math.floor(g)+Math.floor(k)*l.image.width),ha.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),h(ha)):(n=1/n,l=(m*c-j*e)*n,j=(m*d-j*f)*n,c=(i*e-p*c)*n,d=(i*f-p*d)*n,a=a-
|
|
|
+l*g-c*k,g=b-j*g-d*k,z.save(),z.transform(l,j,c,d,a,g),z.fill(),z.restore())}}function i(a,b,c,d,e,f,h,g,k,i,j,p,l){var m,n;m=l.width-1;n=l.height-1;h*=m;g*=n;c-=a;d-=b;e-=a;f-=b;k=k*m-h;i=i*n-g;j=j*m-h;p=p*n-g;n=1/(k*p-j*i);m=(p*c-i*e)*n;i=(p*d-i*f)*n;c=(k*e-j*c)*n;d=(k*f-j*d)*n;a=a-m*h-c*g;b=b-i*h-d*g;z.save();z.transform(m,i,c,d,a,b);z.clip();z.drawImage(l,0,0);z.restore()}function j(a,b,c,d){Ka[0]=255*a.r|0;Ka[1]=255*a.g|0;Ka[2]=255*a.b|0;Ka[4]=255*b.r|0;Ka[5]=255*b.g|0;Ka[6]=255*b.b|0;Ka[8]=255*
|
|
|
+c.r|0;Ka[9]=255*c.g|0;Ka[10]=255*c.b|0;Ka[12]=255*d.r|0;Ka[13]=255*d.g|0;Ka[14]=255*d.b|0;Bb.putImageData(Kb,0,0);Lb.drawImage(Gb,0,0);return Sb}function m(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}function p(a){Z!==a&&(Z=z.globalAlpha=a)}function l(a){K!==a&&(a===THREE.NormalBlending?z.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?z.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(z.globalCompositeOperation=
|
|
|
+"darker"),K=a)}function r(a){Va!==a&&(Va=z.lineWidth=a)}function t(a){O!==a&&(O=z.lineCap=a)}function n(a){qa!==a&&(qa=z.lineJoin=a)}function s(a){oa!==a&&(oa=z.strokeStyle=a)}function q(a){Pa!==a&&(Pa=z.fillStyle=a)}function v(a,b){if(Fa!==a||wa!==b)z.setLineDash([a,b]),Fa=a,wa=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var y=THREE.Math.smoothstep,a=a||{},D=this,F,H,I,G=new THREE.Projector,B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C,A,J,N,z=B.getContext("2d"),L=new THREE.Color(0),
|
|
|
+w=0,Z=1,K=0,oa=null,Pa=null,Va=null,O=null,qa=null,Fa=null,wa=0,M,V,ea,pa,Ua,pb=new THREE.RenderableVertex,ub=new THREE.RenderableVertex,ya,Ha,fa,da,T,aa,la,Y,ma,xa,bb,ia,ha=new THREE.Color,ra=new THREE.Color,ka=new THREE.Color,ua=new THREE.Color,Ra=new THREE.Color,Qa=new THREE.Color,Ya=new THREE.Color,Xb=new THREE.Color,Jb={},Ab={},Sa,xb,lb,Ga,Ca,yb,Ib,k,Rb,Yb,fb=new THREE.Box2,na=new THREE.Box2,va=new THREE.Box2,ib=new THREE.Color,Tb=new THREE.Color,Ub=new THREE.Color,Xa=new THREE.Vector3,Gb,Bb,
|
|
|
+Kb,Ka,Sb,Lb,Hb=16;Gb=document.createElement("canvas");Gb.width=Gb.height=2;Bb=Gb.getContext("2d");Bb.fillStyle="rgba(0,0,0,1)";Bb.fillRect(0,0,2,2);Kb=Bb.getImageData(0,0,2,2);Ka=Kb.data;Sb=document.createElement("canvas");Sb.width=Sb.height=Hb;Lb=Sb.getContext("2d");Lb.translate(-Hb/2,-Hb/2);Lb.scale(Hb,Hb);Hb--;void 0===z.setLineDash&&(z.setLineDash=void 0!==z.mozDash?function(a){z.mozDash=null!==a[0]?a:null}:function(){});this.domElement=B;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:
|
|
|
+void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){C=a*this.devicePixelRatio;A=b*this.devicePixelRatio;J=Math.floor(C/2);N=Math.floor(A/2);B.width=C;B.height=A;1!==this.devicePixelRatio&&!1!==c&&(B.style.width=a+"px",B.style.height=b+"px");fb.set(new THREE.Vector2(-J,-N),new THREE.Vector2(J,N));na.set(new THREE.Vector2(-J,
|
|
|
+-N),new THREE.Vector2(J,N));Z=1;K=0;qa=O=Va=Pa=oa=null};this.setClearColor=function(a,b){L.set(a);w=void 0!==b?b:1;na.set(new THREE.Vector2(-J,-N),new THREE.Vector2(J,N))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){z.setTransform(1,0,0,-1,J,N);!1===na.empty()&&(na.intersect(fb),na.expandByScalar(2),1>w&&z.clearRect(na.min.x|
|
|
|
+0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<w&&(l(THREE.NormalBlending),p(1),q("rgba("+Math.floor(255*L.r)+","+Math.floor(255*L.g)+","+Math.floor(255*L.b)+","+w+")"),z.fillRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0)),na.makeEmpty())};this.render=function(a,g){if(!1===g instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();z.setTransform(1,0,0,-1,J,N);D.info.render.vertices=
|
|
|
+0;D.info.render.faces=0;F=G.projectScene(a,g,this.sortObjects,this.sortElements);H=F.elements;I=F.lights;M=g;ib.setRGB(0,0,0);Tb.setRGB(0,0,0);Ub.setRGB(0,0,0);for(var k=0,B=I.length;k<B;k++){var w=I[k],A=w.color;w instanceof THREE.AmbientLight?ib.add(A):w instanceof THREE.DirectionalLight?Tb.add(A):w instanceof THREE.PointLight&&Ub.add(A)}k=0;for(B=H.length;k<B;k++){var U=H[k],w=U.material;if(!(void 0===w||!1===w.visible)){va.makeEmpty();if(U instanceof THREE.RenderableParticle){V=U;V.x*=J;V.y*=
|
|
|
+N;A=V;p(w.opacity);l(w.blending);var mb=void 0,nb=void 0,vb=void 0,zb=void 0,Zb=void 0,Jc=void 0,Kc=void 0;w instanceof THREE.ParticleBasicMaterial?null===w.map?(vb=U.object.scale.x,zb=U.object.scale.y,vb*=U.scale.x*J,zb*=U.scale.y*N,va.min.set(A.x-vb,A.y-zb),va.max.set(A.x+vb,A.y+zb),!1===fb.isIntersectionBox(va)?va.makeEmpty():(q(w.color.getStyle()),z.save(),z.translate(A.x,A.y),z.rotate(-U.rotation),z.scale(vb,zb),z.fillRect(-1,-1,2,2),z.restore())):(Zb=w.map.image,Jc=Zb.width>>1,Kc=Zb.height>>
|
|
|
+1,vb=U.scale.x*J,zb=U.scale.y*N,mb=vb*Jc,nb=zb*Kc,va.min.set(A.x-mb,A.y-nb),va.max.set(A.x+mb,A.y+nb),!1===fb.isIntersectionBox(va)?va.makeEmpty():(z.save(),z.translate(A.x,A.y),z.rotate(-U.rotation),z.scale(vb,-zb),z.translate(-Jc,-Kc),z.drawImage(Zb,0,0),z.restore())):w instanceof THREE.ParticleCanvasMaterial&&(mb=U.scale.x*J,nb=U.scale.y*N,va.min.set(A.x-mb,A.y-nb),va.max.set(A.x+mb,A.y+nb),!1===fb.isIntersectionBox(va)?va.makeEmpty():(s(w.color.getStyle()),q(w.color.getStyle()),z.save(),z.translate(A.x,
|
|
|
+A.y),z.rotate(-U.rotation),z.scale(mb,nb),w.program(z),z.restore()))}else if(U instanceof THREE.RenderableLine){if(V=U.v1,ea=U.v2,V.positionScreen.x*=J,V.positionScreen.y*=N,ea.positionScreen.x*=J,ea.positionScreen.y*=N,va.setFromPoints([V.positionScreen,ea.positionScreen]),!0===fb.isIntersectionBox(va))if(A=V,mb=ea,p(w.opacity),l(w.blending),z.beginPath(),z.moveTo(A.positionScreen.x,A.positionScreen.y),z.lineTo(mb.positionScreen.x,mb.positionScreen.y),w instanceof THREE.LineBasicMaterial){r(w.linewidth);
|
|
|
+t(w.linecap);n(w.linejoin);if(w.vertexColors!==THREE.VertexColors)s(w.color.getStyle());else if(nb=U.vertexColors[0].getStyle(),U=U.vertexColors[1].getStyle(),nb===U)s(nb);else{try{var wc=z.createLinearGradient(A.positionScreen.x,A.positionScreen.y,mb.positionScreen.x,mb.positionScreen.y);wc.addColorStop(0,nb);wc.addColorStop(1,U)}catch(fd){wc=nb}s(wc)}z.stroke();va.expandByScalar(2*w.linewidth)}else w instanceof THREE.LineDashedMaterial&&(r(w.linewidth),t(w.linecap),n(w.linejoin),s(w.color.getStyle()),
|
|
|
+v(w.dashSize,w.gapSize),z.stroke(),va.expandByScalar(2*w.linewidth),v(null,null))}else if(U instanceof THREE.RenderableFace3){V=U.v1;ea=U.v2;pa=U.v3;if(-1>V.positionScreen.z||1<V.positionScreen.z)continue;if(-1>ea.positionScreen.z||1<ea.positionScreen.z)continue;if(-1>pa.positionScreen.z||1<pa.positionScreen.z)continue;V.positionScreen.x*=J;V.positionScreen.y*=N;ea.positionScreen.x*=J;ea.positionScreen.y*=N;pa.positionScreen.x*=J;pa.positionScreen.y*=N;!0===w.overdraw&&(m(V.positionScreen,ea.positionScreen),
|
|
|
+m(ea.positionScreen,pa.positionScreen),m(pa.positionScreen,V.positionScreen));va.setFromPoints([V.positionScreen,ea.positionScreen,pa.positionScreen]);!0===fb.isIntersectionBox(va)&&c(V,ea,pa,0,1,2,U,w)}else if(U instanceof THREE.RenderableFace4){V=U.v1;ea=U.v2;pa=U.v3;Ua=U.v4;if(-1>V.positionScreen.z||1<V.positionScreen.z)continue;if(-1>ea.positionScreen.z||1<ea.positionScreen.z)continue;if(-1>pa.positionScreen.z||1<pa.positionScreen.z)continue;if(-1>Ua.positionScreen.z||1<Ua.positionScreen.z)continue;
|
|
|
+V.positionScreen.x*=J;V.positionScreen.y*=N;ea.positionScreen.x*=J;ea.positionScreen.y*=N;pa.positionScreen.x*=J;pa.positionScreen.y*=N;Ua.positionScreen.x*=J;Ua.positionScreen.y*=N;pb.positionScreen.copy(ea.positionScreen);ub.positionScreen.copy(Ua.positionScreen);!0===w.overdraw&&(m(V.positionScreen,ea.positionScreen),m(ea.positionScreen,Ua.positionScreen),m(Ua.positionScreen,V.positionScreen),m(pa.positionScreen,pb.positionScreen),m(pa.positionScreen,ub.positionScreen));va.setFromPoints([V.positionScreen,
|
|
|
+ea.positionScreen,pa.positionScreen,Ua.positionScreen]);!0===fb.isIntersectionBox(va)&&(A=V,mb=ea,nb=pa,vb=Ua,zb=pb,Zb=ub,D.info.render.vertices+=4,D.info.render.faces++,p(w.opacity),l(w.blending),void 0!==w.map&&null!==w.map||void 0!==w.envMap&&null!==w.envMap?(c(A,mb,vb,0,1,3,U,w),c(zb,nb,Zb,1,2,3,U,w)):(ya=A.positionScreen.x,Ha=A.positionScreen.y,fa=mb.positionScreen.x,da=mb.positionScreen.y,T=nb.positionScreen.x,aa=nb.positionScreen.y,la=vb.positionScreen.x,Y=vb.positionScreen.y,ma=zb.positionScreen.x,
|
|
|
+xa=zb.positionScreen.y,bb=Zb.positionScreen.x,ia=Zb.positionScreen.y,w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial?(Qa.copy(w.color),Ya.copy(w.emissive),w.vertexColors===THREE.FaceColors&&Qa.multiply(U.color),!1===w.wireframe&&w.shading==THREE.SmoothShading&&4==U.vertexNormalsLength?(ra.copy(ib),ka.copy(ib),ua.copy(ib),Ra.copy(ib),b(U.v1.positionWorld,U.vertexNormalsModel[0],ra),b(U.v2.positionWorld,U.vertexNormalsModel[1],ka),b(U.v4.positionWorld,U.vertexNormalsModel[3],
|
|
|
+ua),b(U.v3.positionWorld,U.vertexNormalsModel[2],Ra),ra.multiply(Qa).add(Ya),ka.multiply(Qa).add(Ya),ua.multiply(Qa).add(Ya),Ra.multiply(Qa).add(Ya),lb=j(ra,ka,ua,Ra),d(ya,Ha,fa,da,la,Y),i(ya,Ha,fa,da,la,Y,0,0,1,0,0,1,lb),d(ma,xa,T,aa,bb,ia),i(ma,xa,T,aa,bb,ia,1,0,1,1,0,1,lb)):(ha.copy(ib),b(U.centroidModel,U.normalModel,ha),ha.multiply(Qa).add(Ya),e(ya,Ha,fa,da,T,aa,la,Y),!0===w.wireframe?f(ha,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):h(ha))):w instanceof THREE.MeshBasicMaterial?
|
|
|
+(ha.copy(w.color),w.vertexColors===THREE.FaceColors&&ha.multiply(U.color),e(ya,Ha,fa,da,T,aa,la,Y),!0===w.wireframe?f(ha,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):h(ha)):w instanceof THREE.MeshNormalMaterial?(A=void 0,w.shading==THREE.FlatShading?(A=U.normalModelView,ha.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),e(ya,Ha,fa,da,T,aa,la,Y),!0===w.wireframe?f(ha,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):h(ha)):w.shading==THREE.SmoothShading&&(A=U.vertexNormalsModelView[0],
|
|
|
+ra.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),A=U.vertexNormalsModelView[1],ka.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),A=U.vertexNormalsModelView[3],ua.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),A=U.vertexNormalsModelView[2],Ra.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),lb=j(ra,ka,ua,Ra),d(ya,Ha,fa,da,la,Y),i(ya,Ha,fa,da,la,Y,0,0,1,0,0,1,lb),d(ma,xa,T,aa,bb,ia),i(ma,xa,T,aa,bb,ia,1,0,1,1,0,1,lb))):w instanceof THREE.MeshDepthMaterial&&(Sa=M.near,
|
|
|
+xb=M.far,ra.r=ra.g=ra.b=1-y(A.positionScreen.z*A.positionScreen.w,Sa,xb),ka.r=ka.g=ka.b=1-y(mb.positionScreen.z*mb.positionScreen.w,Sa,xb),ua.r=ua.g=ua.b=1-y(vb.positionScreen.z*vb.positionScreen.w,Sa,xb),Ra.r=Ra.g=Ra.b=1-y(nb.positionScreen.z*nb.positionScreen.w,Sa,xb),lb=j(ra,ka,ua,Ra),d(ya,Ha,fa,da,la,Y),i(ya,Ha,fa,da,la,Y,0,0,1,0,0,1,lb),d(ma,xa,T,aa,bb,ia),i(ma,xa,T,aa,bb,ia,1,0,1,1,0,1,lb))))}na.union(va)}}z.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -361,297 +361,296 @@ THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"v
|
|
|
THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
|
|
|
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)k.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=k.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,j=1*d.length+2*h.length,h=3*d.length+4*h.length,d=e(b,a),m=g(d),n=f(d),l=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);n&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));l&&
|
|
|
-(a.__colorArray=new Float32Array(3*i));if(m){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*j);a.__lineArray=new Uint16Array(2*h);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<
|
|
|
-m;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*i))}a.__webglFaceCount=3*j;a.__webglLineCount=2*h;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in d.attributes){var j=d.attributes[p],c={},q;for(q in j)c[q]=j[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=k.createBuffer(),c.buffer.belongsToAttribute=p,j.needsUpdate=!0,c.__original=j;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){Ta[a]||(k.enableVertexAttribArray(a),Ta[a]=!0)}function i(){for(var a in Ta)Ta[a]&&(k.disableVertexAttribArray(a),Ta[a]=!1)}function j(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function l(a,b){return b[0]-a[0]}function n(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)pa=ab=null,Ka=qa=$=V=oa=kb=la=-1,bb=!0,a[d].render(b,
|
|
|
-c,Tb,Ub),pa=ab=null,Ka=qa=$=V=oa=kb=la=-1,bb=!0}function m(a,b,c,d,e,f,g,h){var i,k,j,m;b?(k=a.length-1,m=b=-1):(k=0,b=a.length,m=1);for(var n=k;n!==b;n+=m)if(i=a[n],i.render){k=i.object;j=i.buffer;if(h)i=h;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);G(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}L.setMaterialFaces(i);j instanceof THREE.BufferGeometry?L.renderBufferDirect(d,e,
|
|
|
-f,i,j,k):L.renderBuffer(d,e,f,i,j,k)}}function p(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++)if(h=a[k],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&L.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);L.setDepthTest(h.depthTest);L.setDepthWrite(h.depthWrite);G(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,h,i)}}function t(a,b){var e,f,g,h;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=
|
|
|
-new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",gc)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,j;for(i in f.attributes)j="index"===i?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER,h=f.attributes[i],h.buffer=k.createBuffer(),k.bindBuffer(j,h.buffer),k.bufferData(j,h.array,k.STATIC_DRAW)}else if(a instanceof THREE.Mesh){g=a.material;if(void 0===f.geometryGroups){i=f;var m,n,l,p,q;j={};var s=i.morphTargets.length,
|
|
|
-t=i.morphNormals.length,u=g instanceof THREE.MeshFaceMaterial;i.geometryGroups={};g=0;for(m=i.faces.length;g<m;g++)n=i.faces[g],l=u?n.materialIndex:0,void 0===j[l]&&(j[l]={hash:l,counter:0}),q=j[l].hash+"_"+j[l].counter,void 0===i.geometryGroups[q]&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:l,vertices:0,numMorphTargets:s,numMorphNormals:t}),p=n instanceof THREE.Face3?3:4,65535<i.geometryGroups[q].vertices+p&&(j[l].counter+=1,q=j[l].hash+"_"+j[l].counter,void 0===i.geometryGroups[q]&&
|
|
|
-(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:l,vertices:0,numMorphTargets:s,numMorphNormals:t})),n instanceof THREE.Face3?i.geometryGroups[q].faces3.push(g):i.geometryGroups[q].faces4.push(g),i.geometryGroups[q].vertices+=p;i.geometryGroupsList=[];for(h in i.geometryGroups)i.geometryGroups[h].id=Y++,i.geometryGroupsList.push(i.geometryGroups[h])}for(e in f.geometryGroups)if(h=f.geometryGroups[e],!h.__webglVertexBuffer){i=h;i.__webglVertexBuffer=k.createBuffer();i.__webglNormalBuffer=k.createBuffer();
|
|
|
-i.__webglTangentBuffer=k.createBuffer();i.__webglColorBuffer=k.createBuffer();i.__webglUVBuffer=k.createBuffer();i.__webglUV2Buffer=k.createBuffer();i.__webglSkinIndicesBuffer=k.createBuffer();i.__webglSkinWeightsBuffer=k.createBuffer();i.__webglFaceBuffer=k.createBuffer();i.__webglLineBuffer=k.createBuffer();s=j=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];j=0;for(s=i.numMorphTargets;j<s;j++)i.__webglMorphTargetsBuffers.push(k.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=
|
|
|
-[];j=0;for(s=i.numMorphNormals;j<s;j++)i.__webglMorphNormalsBuffers.push(k.createBuffer())}L.info.memory.geometries++;d(h,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(h=f,h.__webglVertexBuffer=k.createBuffer(),h.__webglColorBuffer=k.createBuffer(),h.__webglNormalBuffer=k.createBuffer(),L.info.memory.geometries++,h=f,i=h.vertices.length,
|
|
|
-h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*i),h.__normalArray=new Float32Array(3*i),h.__webglVertexCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(h=f,h.__webglVertexBuffer=k.createBuffer(),h.__webglColorBuffer=k.createBuffer(),h.__webglLineDistanceBuffer=k.createBuffer(),L.info.memory.geometries++,h=f,i=h.vertices.length,h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*
|
|
|
-i),h.__lineDistanceArray=new Float32Array(1*i),h.__webglLineCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(h=f,h.__webglVertexBuffer=k.createBuffer(),h.__webglColorBuffer=k.createBuffer(),L.info.memory.geometries++,h=f,i=h.vertices.length,h.__vertexArray=new Float32Array(3*i),h.__colorArray=new Float32Array(3*i),h.__sortArray=[],h.__webglParticleCount=i,c(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=
|
|
|
-!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)r(b.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)h=f.geometryGroups[e],r(b.__webglObjects,h,a)}else a instanceof THREE.Ribbon||a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,r(b.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?b.__webglObjectsImmediate.push({object:a,opaque:null,transparent:null}):
|
|
|
-a instanceof THREE.Sprite?b.__webglSprites.push(a):a instanceof THREE.LensFlare&&b.__webglFlares.push(a);a.__webglActive=!0}}function r(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Ribbon||a instanceof THREE.Line?w(b.__webglObjects,
|
|
|
-a):a instanceof THREE.Sprite?y(b.__webglSprites,a):a instanceof THREE.LensFlare?y(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&w(b.__webglObjectsImmediate,a);delete a.__webglActive}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function y(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function F(a,b,c,d,e){ga=0;d.needsUpdate&&(d.program&&X(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!==ab&&(k.useProgram(g),ab=g,f=!0);d.id!==Ka&&(Ka=d.id,f=!0);if(f||a!==pa)k.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==pa&&(pa=a);if(d.skinning)if(Vb&&e.useVertexTexture){if(null!==h.boneTexture){var j=J();k.uniform1i(h.boneTexture,j);L.setTexture(e.boneTexture,j)}}else null!==h.boneGlobalMatrices&&k.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(bb){for(var m,l=j=0,n=0,p,q,r,s=Ab,t=s.directional.colors,u=s.directional.positions,w=s.point.colors,y=s.point.positions,z=s.point.distances,F=s.spot.colors,H=s.spot.positions,G=s.spot.distances,D=s.spot.directions,I=s.spot.anglesCos,K=
|
|
|
-s.spot.exponents,M=s.hemi.skyColors,N=s.hemi.groundColors,O=s.hemi.positions,P=0,ea=0,V=0,Y=0,$=0,T=0,U=0,Q=0,ca=m=0,c=r=ca=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,r=m.distance,m instanceof THREE.AmbientLight?m.visible&&(L.gammaInput?(j+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(j+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?($+=1,m.visible&&(ra.getPositionFromMatrix(m.matrixWorld),Na.getPositionFromMatrix(m.target.matrixWorld),ra.sub(Na),ra.normalize(),0===ra.x&&0===
|
|
|
-ra.y&&0===ra.z||(m=3*P,u[m]=ra.x,u[m+1]=ra.y,u[m+2]=ra.z,L.gammaInput?B(t,m,p,q*q):E(t,m,p,q),P+=1))):m instanceof THREE.PointLight?(T+=1,m.visible&&(ca=3*ea,L.gammaInput?B(w,ca,p,q*q):E(w,ca,p,q),Na.getPositionFromMatrix(m.matrixWorld),y[ca]=Na.x,y[ca+1]=Na.y,y[ca+2]=Na.z,z[ea]=r,ea+=1)):m instanceof THREE.SpotLight?(U+=1,m.visible&&(ca=3*V,L.gammaInput?B(F,ca,p,q*q):E(F,ca,p,q),Na.getPositionFromMatrix(m.matrixWorld),H[ca]=Na.x,H[ca+1]=Na.y,H[ca+2]=Na.z,G[V]=r,ra.copy(Na),Na.getPositionFromMatrix(m.target.matrixWorld),
|
|
|
-ra.sub(Na),ra.normalize(),D[ca]=ra.x,D[ca+1]=ra.y,D[ca+2]=ra.z,I[V]=Math.cos(m.angle),K[V]=m.exponent,V+=1)):m instanceof THREE.HemisphereLight&&(Q+=1,m.visible&&(ra.getPositionFromMatrix(m.matrixWorld),ra.normalize(),0===ra.x&&0===ra.y&&0===ra.z||(r=3*Y,O[r]=ra.x,O[r+1]=ra.y,O[r+2]=ra.z,p=m.color,m=m.groundColor,L.gammaInput?(q*=q,B(M,r,p,q),B(N,r,m,q)):(E(M,r,p,q),E(N,r,m,q)),Y+=1))));c=3*P;for(f=Math.max(t.length,3*$);c<f;c++)t[c]=0;c=3*ea;for(f=Math.max(w.length,3*T);c<f;c++)w[c]=0;c=3*V;for(f=
|
|
|
-Math.max(F.length,3*U);c<f;c++)F[c]=0;c=3*Y;for(f=Math.max(M.length,3*Q);c<f;c++)M[c]=0;c=3*Y;for(f=Math.max(N.length,3*Q);c<f;c++)N[c]=0;s.directional.length=P;s.point.length=ea;s.spot.length=V;s.hemi.length=Y;s.ambient[0]=j;s.ambient[1]=l;s.ambient[2]=n;bb=!1}c=Ab;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=
|
|
|
+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)k.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 h=1;"v2"===f.type?h=2:"v3"===f.type?h=3:"v4"===f.type?
|
|
|
+h=4:"c"===f.type&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=k.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}function d(a,b){var c=b.geometry,d=a.faces3,g=a.faces4,i=3*d.length+4*g.length,j=1*d.length+2*g.length,g=3*d.length+4*g.length,d=e(b,a),p=h(d),m=f(d),l=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));l&&
|
|
|
+(a.__colorArray=new Float32Array(3*i));if(p){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*j);a.__lineArray=new Uint16Array(2*g);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(p=a.numMorphTargets;c<
|
|
|
+p;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(p=a.numMorphNormals;c<p;c++)a.__morphNormalsArrays.push(new Float32Array(3*i))}a.__webglFaceCount=3*j;a.__webglLineCount=2*g;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var n in d.attributes){var j=d.attributes[n],c={},r;for(r in j)c[r]=j[r];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,g=1,"v2"===c.type?g=2:
|
|
|
+"v3"===c.type?g=3:"v4"===c.type?g=4:"c"===c.type&&(g=3),c.size=g,c.array=new Float32Array(i*g),c.buffer=k.createBuffer(),c.buffer.belongsToAttribute=n,j.needsUpdate=!0,c.__original=j;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 h(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a){Ab[a]||(k.enableVertexAttribArray(a),Ab[a]=!0)}function i(){for(var a in Ab)Ab[a]&&(k.disableVertexAttribArray(a),Ab[a]=!1)}function j(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function m(a,b){return b[0]-a[0]}function p(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ya=pa=null,pb=ub=T=da=bb=xa=aa=-1,yb=!0,a[d].render(b,
|
|
|
+c,Xb,Jb),ya=pa=null,pb=ub=T=da=bb=xa=aa=-1,yb=!0}function l(a,b,c,d,e,f,h,g){var k,i,j,p;b?(i=a.length-1,p=b=-1):(i=0,b=a.length,p=1);for(var m=i;m!==b;m+=p)if(k=a[m],k.render){i=k.object;j=k.buffer;if(g)k=g;else{k=k[c];if(!k)continue;h&&M.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);M.setDepthTest(k.depthTest);M.setDepthWrite(k.depthWrite);C(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}M.setMaterialFaces(k);j instanceof THREE.BufferGeometry?M.renderBufferDirect(d,
|
|
|
+e,f,k,j,i):M.renderBuffer(d,e,f,k,j,i)}}function r(a,b,c,d,e,f,h){for(var g,k,i=0,j=a.length;i<j;i++)if(g=a[i],k=g.object,k.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&M.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);M.setDepthTest(g.depthTest);M.setDepthWrite(g.depthWrite);C(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}M.renderImmediateObject(c,d,e,g,k)}}function t(a,b){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,
|
|
|
+a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",kc)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,j;for(i in f.attributes)j="index"===i?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER,g=f.attributes[i],g.buffer=k.createBuffer(),k.bindBuffer(j,g.buffer),k.bufferData(j,g.array,k.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var p,m,l,r,
|
|
|
+s;j={};var q=i.morphTargets.length,t=i.morphNormals.length,v=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(p=i.faces.length;h<p;h++)m=i.faces[h],l=v?m.materialIndex:0,void 0===j[l]&&(j[l]={hash:l,counter:0}),s=j[l].hash+"_"+j[l].counter,void 0===i.geometryGroups[s]&&(i.geometryGroups[s]={faces3:[],faces4:[],materialIndex:l,vertices:0,numMorphTargets:q,numMorphNormals:t}),r=m instanceof THREE.Face3?3:4,65535<i.geometryGroups[s].vertices+r&&(j[l].counter+=1,s=j[l].hash+"_"+j[l].counter,
|
|
|
+void 0===i.geometryGroups[s]&&(i.geometryGroups[s]={faces3:[],faces4:[],materialIndex:l,vertices:0,numMorphTargets:q,numMorphNormals:t})),m instanceof THREE.Face3?i.geometryGroups[s].faces3.push(h):i.geometryGroups[s].faces4.push(h),i.geometryGroups[s].vertices+=r;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=Ha++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=k.createBuffer();
|
|
|
+i.__webglNormalBuffer=k.createBuffer();i.__webglTangentBuffer=k.createBuffer();i.__webglColorBuffer=k.createBuffer();i.__webglUVBuffer=k.createBuffer();i.__webglUV2Buffer=k.createBuffer();i.__webglSkinIndicesBuffer=k.createBuffer();i.__webglSkinWeightsBuffer=k.createBuffer();i.__webglFaceBuffer=k.createBuffer();i.__webglLineBuffer=k.createBuffer();q=j=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];j=0;for(q=i.numMorphTargets;j<q;j++)i.__webglMorphTargetsBuffers.push(k.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=
|
|
|
+[];j=0;for(q=i.numMorphNormals;j<q;j++)i.__webglMorphNormalsBuffers.push(k.createBuffer())}M.info.memory.geometries++;d(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=k.createBuffer(),g.__webglColorBuffer=k.createBuffer(),g.__webglNormalBuffer=k.createBuffer(),M.info.memory.geometries++,g=f,i=g.vertices.length,
|
|
|
+g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__normalArray=new Float32Array(3*i),g.__webglVertexCount=i,c(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=k.createBuffer(),g.__webglColorBuffer=k.createBuffer(),g.__webglLineDistanceBuffer=k.createBuffer(),M.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*
|
|
|
+i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,c(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=k.createBuffer(),g.__webglColorBuffer=k.createBuffer(),M.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,c(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=
|
|
|
+!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)n(b.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],n(b.__webglObjects,g,a)}else a instanceof THREE.Ribbon||a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,n(b.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?b.__webglObjectsImmediate.push({object:a,opaque:null,transparent:null}):
|
|
|
+a instanceof THREE.Sprite?b.__webglSprites.push(a):a instanceof THREE.LensFlare&&b.__webglFlares.push(a);a.__webglActive=!0}}function n(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function s(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function q(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Ribbon||a instanceof THREE.Line?y(b.__webglObjects,
|
|
|
+a):a instanceof THREE.Sprite?D(b.__webglSprites,a):a instanceof THREE.LensFlare?D(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&y(b.__webglObjectsImmediate,a);delete a.__webglActive}function y(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function D(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function F(a,b,c,d,e){fa=0;d.needsUpdate&&(d.program&&vc(d),M.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&
|
|
|
+(e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets));var f=!1,h=d.program,g=h.uniforms,i=d.uniforms;h!==pa&&(k.useProgram(h),pa=h,f=!0);d.id!==pb&&(pb=d.id,f=!0);if(f||a!==ya)k.uniformMatrix4fv(g.projectionMatrix,!1,a.projectionMatrix.elements),a!==ya&&(ya=a);if(d.skinning)if(Bb&&e.useVertexTexture){if(null!==g.boneTexture){var j=H();k.uniform1i(g.boneTexture,j);M.setTexture(e.boneTexture,j)}}else null!==g.boneGlobalMatrices&&k.uniformMatrix4fv(g.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(yb){for(var p,l=j=0,m=0,n,r,s,q=Ib,t=q.directional.colors,v=q.directional.positions,y=q.point.colors,z=q.point.positions,A=q.point.distances,B=q.spot.colors,F=q.spot.positions,D=q.spot.distances,E=q.spot.directions,J=q.spot.anglesCos,K=
|
|
|
+q.spot.exponents,V=q.hemi.skyColors,L=q.hemi.groundColors,C=q.hemi.positions,O=0,ea=0,T=0,aa=0,da=0,R=0,S=0,P=0,ba=p=0,c=s=ba=0,f=b.length;c<f;c++)p=b[c],p.onlyShadow||(n=p.color,r=p.intensity,s=p.distance,p instanceof THREE.AmbientLight?p.visible&&(M.gammaInput?(j+=n.r*n.r,l+=n.g*n.g,m+=n.b*n.b):(j+=n.r,l+=n.g,m+=n.b)):p instanceof THREE.DirectionalLight?(da+=1,p.visible&&(Ca.getPositionFromMatrix(p.matrixWorld),Ga.getPositionFromMatrix(p.target.matrixWorld),Ca.sub(Ga),Ca.normalize(),0===Ca.x&&0===
|
|
|
+Ca.y&&0===Ca.z||(p=3*O,v[p]=Ca.x,v[p+1]=Ca.y,v[p+2]=Ca.z,M.gammaInput?I(t,p,n,r*r):G(t,p,n,r),O+=1))):p instanceof THREE.PointLight?(R+=1,p.visible&&(ba=3*ea,M.gammaInput?I(y,ba,n,r*r):G(y,ba,n,r),Ga.getPositionFromMatrix(p.matrixWorld),z[ba]=Ga.x,z[ba+1]=Ga.y,z[ba+2]=Ga.z,A[ea]=s,ea+=1)):p instanceof THREE.SpotLight?(S+=1,p.visible&&(ba=3*T,M.gammaInput?I(B,ba,n,r*r):G(B,ba,n,r),Ga.getPositionFromMatrix(p.matrixWorld),F[ba]=Ga.x,F[ba+1]=Ga.y,F[ba+2]=Ga.z,D[T]=s,Ca.copy(Ga),Ga.getPositionFromMatrix(p.target.matrixWorld),
|
|
|
+Ca.sub(Ga),Ca.normalize(),E[ba]=Ca.x,E[ba+1]=Ca.y,E[ba+2]=Ca.z,J[T]=Math.cos(p.angle),K[T]=p.exponent,T+=1)):p instanceof THREE.HemisphereLight&&(P+=1,p.visible&&(Ca.getPositionFromMatrix(p.matrixWorld),Ca.normalize(),0===Ca.x&&0===Ca.y&&0===Ca.z||(s=3*aa,C[s]=Ca.x,C[s+1]=Ca.y,C[s+2]=Ca.z,n=p.color,p=p.groundColor,M.gammaInput?(r*=r,I(V,s,n,r),I(L,s,p,r)):(G(V,s,n,r),G(L,s,p,r)),aa+=1))));c=3*O;for(f=Math.max(t.length,3*da);c<f;c++)t[c]=0;c=3*ea;for(f=Math.max(y.length,3*R);c<f;c++)y[c]=0;c=3*T;for(f=
|
|
|
+Math.max(B.length,3*S);c<f;c++)B[c]=0;c=3*aa;for(f=Math.max(V.length,3*P);c<f;c++)V[c]=0;c=3*aa;for(f=Math.max(L.length,3*P);c<f;c++)L[c]=0;q.directional.length=O;q.point.length=ea;q.spot.length=T;q.hemi.length=aa;q.ambient[0]=j;q.ambient[1]=l;q.ambient[2]=m;yb=!1}c=Ib;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 W;d.map?W=d.map:d.specularMap?W=d.specularMap:d.normalMap?W=d.normalMap:d.bumpMap&&(W=d.bumpMap);void 0!==W&&(c=W.offset,
|
|
|
-W=W.repeat,i.offsetRepeat.value.set(c.x,c.y,W.x,W.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=R.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=W=0;for(f=b.length;c<f;c++)if(j=b[c],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.value[W]=j.shadowMap,i.shadowMapSize.value[W]=j.shadowMapSize,i.shadowMatrix.value[W]=j.shadowMatrix,i.shadowDarkness.value[W]=j.shadowDarkness,i.shadowBias.value[W]=j.shadowBias,W++}b=d.uniformsList;i=0;for(W=b.length;i<W;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,j=c.value,"i"===
|
|
|
-l)k.uniform1i(f,j);else if("f"===l)k.uniform1f(f,j);else if("v2"===l)k.uniform2f(f,j.x,j.y);else if("v3"===l)k.uniform3f(f,j.x,j.y,j.z);else if("v4"===l)k.uniform4f(f,j.x,j.y,j.z,j.w);else if("c"===l)k.uniform3f(f,j.r,j.g,j.b);else if("iv1"===l)k.uniform1iv(f,j);else if("iv"===l)k.uniform3iv(f,j);else if("fv1"===l)k.uniform1fv(f,j);else if("fv"===l)k.uniform3fv(f,j);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*j.length));l=0;for(n=j.length;l<n;l++)s=2*l,c._array[s]=j[l].x,c._array[s+
|
|
|
-1]=j[l].y;k.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*j.length));l=0;for(n=j.length;l<n;l++)s=3*l,c._array[s]=j[l].x,c._array[s+1]=j[l].y,c._array[s+2]=j[l].z;k.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*j.length));l=0;for(n=j.length;l<n;l++)s=4*l,c._array[s]=j[l].x,c._array[s+1]=j[l].y,c._array[s+2]=j[l].z,c._array[s+3]=j[l].w;k.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),
|
|
|
-j.flattenToArray(c._array),k.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(n=j.length;l<n;l++)j[l].flattenToArrayOffset(c._array,16*l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(s=j,j=J(),k.uniform1i(f,j),s)if(s.image instanceof Array&&6===s.image.length){if(c=s,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=k.createTexture(),L.info.memory.textures++);k.activeTexture(k.TEXTURE0+
|
|
|
-f);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;j=[];for(l=0;6>l;l++)L.autoScaleCubemaps&&!f?(n=j,s=l,t=c.image[l],w=Ic,t.width<=w&&t.height<=w||(y=Math.max(t.width,t.height),u=Math.floor(t.width*w/y),w=Math.floor(t.height*w/y),y=document.createElement("canvas"),y.width=u,y.height=w,y.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,w),t=y),n[s]=t):j[l]=c.image[l];l=j[0];n=0===(l.width&l.width-
|
|
|
-1)&&0===(l.height&l.height-1);s=A(c.format);t=A(c.type);C(k.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){w=j[l].mipmaps;y=0;for(z=w.length;y<z;y++)u=w[y],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,y,s,u.width,u.height,0,u.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,s,s,t,j[l]);c.generateMipmaps&&n&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else s instanceof
|
|
|
-THREE.WebGLRenderTargetCube?(c=s,k.activeTexture(k.TEXTURE0+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):L.setTexture(s,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=J();k.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)s=c.value[l],j=c._array[l],s&&L.setTexture(s,j)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)Na.getPositionFromMatrix(a.matrixWorld),k.uniform3f(h.cameraPosition,
|
|
|
-Na.x,Na.y,Na.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&k.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}k.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function J(){var a=ga;a>=cc&&console.warn("WebGLRenderer: trying to use "+
|
|
|
-a+" texture units while this GPU supports only "+cc);ga+=1;return a}function B(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function E(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function z(a){a!==Sa&&(k.lineWidth(a),Sa=a)}function G(a,b,c){Xa!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),Xa=a);if(a&&(Ra!==b||Aa!==c))k.polygonOffset(b,c),Ra=b,Aa=c}function I(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 O(a,
|
|
|
-b){var c;"fragment"===a?c=k.createShader(k.FRAGMENT_SHADER):"vertex"===a&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);return!k.getShaderParameter(c,k.COMPILE_STATUS)?(console.error(k.getShaderInfoLog(c)),console.error(I(b)),null):c}function C(a,b,c){c?(k.texParameteri(a,k.TEXTURE_WRAP_S,A(b.wrapS)),k.texParameteri(a,k.TEXTURE_WRAP_T,A(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,A(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,A(b.minFilter))):(k.texParameteri(a,
|
|
|
-k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,M(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,M(b.minFilter)));if(lb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))k.texParameterf(a,lb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,dc)),b.__oldAnisotropy=b.anisotropy}function H(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,
|
|
|
-b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function M(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function A(a){if(a===
|
|
|
+d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;M.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=Z.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,M.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?(M.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(j=b[c],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.value[Y]=j.shadowMap,i.shadowMapSize.value[Y]=j.shadowMapSize,i.shadowMatrix.value[Y]=j.shadowMatrix,i.shadowDarkness.value[Y]=j.shadowDarkness,i.shadowBias.value[Y]=j.shadowBias,Y++}b=d.uniformsList;i=0;for(Y=b.length;i<Y;i++)if(f=h.uniforms[b[i][1]])if(c=b[i][0],l=c.type,j=c.value,"i"===
|
|
|
+l)k.uniform1i(f,j);else if("f"===l)k.uniform1f(f,j);else if("v2"===l)k.uniform2f(f,j.x,j.y);else if("v3"===l)k.uniform3f(f,j.x,j.y,j.z);else if("v4"===l)k.uniform4f(f,j.x,j.y,j.z,j.w);else if("c"===l)k.uniform3f(f,j.r,j.g,j.b);else if("iv1"===l)k.uniform1iv(f,j);else if("iv"===l)k.uniform3iv(f,j);else if("fv1"===l)k.uniform1fv(f,j);else if("fv"===l)k.uniform3fv(f,j);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*j.length));l=0;for(m=j.length;l<m;l++)q=2*l,c._array[q]=j[l].x,c._array[q+
|
|
|
+1]=j[l].y;k.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*j.length));l=0;for(m=j.length;l<m;l++)q=3*l,c._array[q]=j[l].x,c._array[q+1]=j[l].y,c._array[q+2]=j[l].z;k.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*j.length));l=0;for(m=j.length;l<m;l++)q=4*l,c._array[q]=j[l].x,c._array[q+1]=j[l].y,c._array[q+2]=j[l].z,c._array[q+3]=j[l].w;k.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),
|
|
|
+j.flattenToArray(c._array),k.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(m=j.length;l<m;l++)j[l].flattenToArrayOffset(c._array,16*l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(q=j,j=H(),k.uniform1i(f,j),q)if(q.image instanceof Array&&6===q.image.length){if(c=q,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=k.createTexture(),M.info.memory.textures++);k.activeTexture(k.TEXTURE0+
|
|
|
+f);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;j=[];for(l=0;6>l;l++)M.autoScaleCubemaps&&!f?(m=j,q=l,t=c.image[l],y=Ub,t.width<=y&&t.height<=y||(z=Math.max(t.width,t.height),v=Math.floor(t.width*y/z),y=Math.floor(t.height*y/z),z=document.createElement("canvas"),z.width=v,z.height=y,z.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,y),t=z),m[q]=t):j[l]=c.image[l];l=j[0];m=0===(l.width&l.width-
|
|
|
+1)&&0===(l.height&l.height-1);q=w(c.format);t=w(c.type);N(k.TEXTURE_CUBE_MAP,c,m);for(l=0;6>l;l++)if(f){y=j[l].mipmaps;z=0;for(A=y.length;z<A;z++)v=y[z],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,z,q,v.width,v.height,0,v.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,q,q,t,j[l]);c.generateMipmaps&&m&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else q instanceof
|
|
|
+THREE.WebGLRenderTargetCube?(c=q,k.activeTexture(k.TEXTURE0+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):M.setTexture(q,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(m=c.value.length;l<m;l++)c._array[l]=H();k.uniform1iv(f,c._array);l=0;for(m=c.value.length;l<m;l++)q=c.value[l],j=c._array[l],q&&M.setTexture(q,j)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)Ga.getPositionFromMatrix(a.matrixWorld),k.uniform3f(g.cameraPosition,
|
|
|
+Ga.x,Ga.y,Ga.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&k.uniformMatrix4fv(g.viewMatrix,!1,a.matrixWorldInverse.elements)}k.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrix.elements);g.normalMatrix&&k.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrix.elements);null!==g.modelMatrix&&k.uniformMatrix4fv(g.modelMatrix,!1,e.matrixWorld.elements);return h}function H(){var a=fa;a>=ib&&console.warn("WebGLRenderer: trying to use "+
|
|
|
+a+" texture units while this GPU supports only "+ib);fa+=1;return a}function I(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 G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function B(a){a!==ka&&(k.lineWidth(a),ka=a)}function C(a,b,c){ia!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),ia=a);if(a&&(ha!==b||ra!==c))k.polygonOffset(b,c),ha=b,ra=c}function A(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 J(a,
|
|
|
+b){var c;"fragment"===a?c=k.createShader(k.FRAGMENT_SHADER):"vertex"===a&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);return!k.getShaderParameter(c,k.COMPILE_STATUS)?(console.error(k.getShaderInfoLog(c)),console.error(A(b)),null):c}function N(a,b,c){c?(k.texParameteri(a,k.TEXTURE_WRAP_S,w(b.wrapS)),k.texParameteri(a,k.TEXTURE_WRAP_T,w(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,w(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,w(b.minFilter))):(k.texParameteri(a,
|
|
|
+k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,L(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,L(b.minFilter)));if(fb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))k.texParameterf(a,fb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Xa)),b.__oldAnisotropy=b.anisotropy}function z(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,
|
|
|
+b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function L(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function w(a){if(a===
|
|
|
THREE.RepeatWrapping)return k.REPEAT;if(a===THREE.ClampToEdgeWrapping)return k.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return k.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return k.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return k.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return k.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return k.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return k.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return k.LINEAR_MIPMAP_LINEAR;
|
|
|
if(a===THREE.UnsignedByteType)return k.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return k.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return k.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return k.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return k.BYTE;if(a===THREE.ShortType)return k.SHORT;if(a===THREE.UnsignedShortType)return k.UNSIGNED_SHORT;if(a===THREE.IntType)return k.INT;if(a===THREE.UnsignedIntType)return k.UNSIGNED_INT;if(a===THREE.FloatType)return k.FLOAT;
|
|
|
if(a===THREE.AlphaFormat)return k.ALPHA;if(a===THREE.RGBFormat)return k.RGB;if(a===THREE.RGBAFormat)return k.RGBA;if(a===THREE.LuminanceFormat)return k.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return k.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return k.FUNC_ADD;if(a===THREE.SubtractEquation)return k.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return k.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return k.ZERO;if(a===THREE.OneFactor)return k.ONE;if(a===THREE.SrcColorFactor)return k.SRC_COLOR;
|
|
|
-if(a===THREE.OneMinusSrcColorFactor)return k.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return k.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return k.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return k.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return k.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return k.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return k.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return k.SRC_ALPHA_SATURATE;if(void 0!==Va){if(a===THREE.RGB_S3TC_DXT1_Format)return Va.COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
|
-if(a===THREE.RGBA_S3TC_DXT1_Format)return Va.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Va.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Va.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},R=void 0!==a.canvas?a.canvas:document.createElement("canvas"),K=void 0!==a.precision?a.precision:"highp",fa=void 0!==a.alpha?a.alpha:!0,wa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Ma=void 0!==
|
|
|
-a.antialias?a.antialias:!1,N=void 0!==a.stencil?a.stencil:!0,W=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ja=new THREE.Color(0),na=0;void 0!==a.clearColor&&(console.warn("DEPRECATED: clearColor in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),ja.setHex(a.clearColor));void 0!==a.clearAlpha&&(console.warn("DEPRECATED: clearAlpha in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),na=a.clearAlpha);this.domElement=
|
|
|
-R;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=
|
|
|
-!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var L=this,ea=[],Wa=0,ab=null,fb=null,Ka=-1,qa=null,pa=null,Y=0,ga=0,V=-1,$=-1,la=-1,ha=-1,ia=-1,Qa=-1,kb=-1,oa=-1,Xa=null,Ra=null,Aa=null,Sa=null,tb=0,Nb=0,Kb=0,Ob=0,Tb=0,Ub=0,Ta={},ua=new THREE.Frustum,Ja=new THREE.Matrix4,ub=new THREE.Matrix4,Na=new THREE.Vector3,ra=new THREE.Vector3,
|
|
|
-bb=!0,Ab={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,Bb,Ua,lb,Va;try{if(!(k=R.getContext("experimental-webgl",{alpha:fa,premultipliedAlpha:wa,antialias:Ma,stencil:N,preserveDrawingBuffer:W})))throw"Error creating WebGL context.";}catch(Cb){console.error(Cb)}Bb=k.getExtension("OES_texture_float");
|
|
|
-Ua=k.getExtension("OES_standard_derivatives");lb=k.getExtension("EXT_texture_filter_anisotropic")||k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Va=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Bb||console.log("THREE.WebGLRenderer: Float textures not supported.");Ua||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
|
|
|
-lb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Va||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===k.getShaderPrecisionFormat&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,
|
|
|
-k.ONE_MINUS_SRC_ALPHA);k.clearColor(ja.r,ja.g,ja.b,na);this.context=k;var cc=k.getParameter(k.MAX_TEXTURE_IMAGE_UNITS),Hc=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Ic=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),dc=lb?k.getParameter(lb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,ec=0<Hc,Vb=ec&&Bb;Va&&k.getParameter(k.COMPRESSED_TEXTURE_FORMATS);var Lc=k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.HIGH_FLOAT),Mc=k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.MEDIUM_FLOAT);
|
|
|
-k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.LOW_FLOAT);var Nc=k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.HIGH_FLOAT),Kc=k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.MEDIUM_FLOAT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.LOW_FLOAT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.HIGH_INT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.MEDIUM_INT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.LOW_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.HIGH_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,
|
|
|
-k.MEDIUM_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.LOW_INT);var Jc=0<Lc.precision&&0<Nc.precision,fc=0<Mc.precision&&0<Kc.precision;"highp"===K&&!Jc&&(fc?(K="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(K="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===K&&!fc&&(K="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return k};this.supportsVertexTextures=function(){return ec};
|
|
|
-this.supportsFloatTextures=function(){return Bb};this.supportsStandardDerivatives=function(){return Ua};this.supportsCompressedTextureS3TC=function(){return Va};this.getMaxAnisotropy=function(){return dc};this.getPrecision=function(){return K};this.setSize=function(a,b,c){R.width=a*this.devicePixelRatio;R.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(R.style.width=a+"px",R.style.height=b+"px");this.setViewport(0,0,R.width,R.height)};this.setViewport=function(a,b,c,d){tb=void 0!==
|
|
|
-a?a:0;Nb=void 0!==b?b:0;Kb=void 0!==c?c:R.width;Ob=void 0!==d?d:R.height;k.viewport(tb,Nb,Kb,Ob)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColor=function(a,b){ja.set(a);na=void 0!==b?b:1;k.clearColor(ja.r,ja.g,ja.b,na)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=
|
|
|
-function(){return ja};this.getClearAlpha=function(){return na};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=k.COLOR_BUFFER_BIT;if(void 0===b||b)d|=k.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){ab=null;Ka=
|
|
|
-qa=oa=kb=la=-1;bb=!0;$=V=-1;this.shadowMapPlugin.update(a,b)};var gc=function(a){a=a.target;a.removeEventListener("dispose",gc);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&k.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&k.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&k.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&k.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&k.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&
|
|
|
-k.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&k.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&k.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&k.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&k.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&k.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==
|
|
|
-d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)k.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)k.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);L.info.memory.geometries--},oc=function(a){a=a.target;a.removeEventListener("dispose",oc);a.image&&a.image.__webglTextureCube?k.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,k.deleteTexture(a.__webglTexture));L.info.memory.textures--},P=function(a){a=
|
|
|
-a.target;a.removeEventListener("dispose",P);if(a&&a.__webglTexture)if(k.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)k.deleteFramebuffer(a.__webglFramebuffer[b]),k.deleteRenderbuffer(a.__webglRenderbuffer[b]);else k.deleteFramebuffer(a.__webglFramebuffer),k.deleteRenderbuffer(a.__webglRenderbuffer);L.info.memory.textures--},pc=function(a){a=a.target;a.removeEventListener("dispose",pc);X(a)},X=function(a){var b=a.program;if(void 0!==b){a.program=void 0;
|
|
|
-var c,d,e=!1,a=0;for(c=ea.length;a<c;a++)if(d=ea[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=ea.length;a<c;a++)d=ea[a],d.program!==b&&e.push(d);ea=e;k.deleteProgram(b);L.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=k.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=k.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=k.createBuffer());
|
|
|
-a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=k.createBuffer());a.hasPositions&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,!1,0,0));if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,j,l,m,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],l=n[p+5],h=n[p+6],j=n[p+7],m=n[p+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+l+m)/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}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer),k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.uv),
|
|
|
-k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.color),k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,!1,0,0));k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var g,j,l;g=F(a,b,c,d,f);a=g.attributes;b=e.attributes;c=!1;g=16777215*e.id+
|
|
|
-2*g.id+(d.wireframe?1:0);g!==qa&&(qa=g,c=!0);c&&i();if(f instanceof THREE.Mesh)if(d=b.index){e=e.offsets;1<e.length&&(c=!0);for(var m=0,n=e.length;m<n;m++){var p=e[m].index;if(c){for(j in b)"index"!==j&&(g=a[j],f=b[j],l=f.itemSize,0<=g&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),h(g),k.vertexAttribPointer(g,l,k.FLOAT,!1,0,4*p*l)));k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,d.buffer)}k.drawElements(k.TRIANGLES,e[m].count,k.UNSIGNED_SHORT,2*e[m].start);L.info.render.calls++;L.info.render.vertices+=e[m].count;
|
|
|
-L.info.render.faces+=e[m].count/3}}else{if(c)for(j in b)"index"!==j&&(g=a[j],f=b[j],l=f.itemSize,0<=g&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),h(g),k.vertexAttribPointer(g,l,k.FLOAT,!1,0,0)));j=e.attributes.position;k.drawArrays(k.TRIANGLES,0,j.numItems/3);L.info.render.calls++;L.info.render.vertices+=j.numItems/3;L.info.render.faces+=j.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(j in b)g=a[j],f=b[j],l=f.itemSize,0<=g&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),h(g),k.vertexAttribPointer(g,
|
|
|
-l,k.FLOAT,!1,0,0));j=b.position;k.drawArrays(k.POINTS,0,j.numItems/3);L.info.render.calls++;L.info.render.points+=j.numItems/3}}else if(f instanceof THREE.Line&&c){for(j in b)g=a[j],f=b[j],l=f.itemSize,0<=g&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),h(g),k.vertexAttribPointer(g,l,k.FLOAT,!1,0,0));z(d.linewidth);j=b.position;k.drawArrays(k.LINE_STRIP,0,j.numItems/3);L.info.render.calls++;L.info.render.points+=j.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,j,c=F(a,b,c,d,
|
|
|
-f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==qa&&(qa=c,b=!0);b&&i();if(!d.morphTargets&&0<=a.position)b&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),k.vertexAttribPointer(a.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):0<=c.position&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
-e.__webglVertexBuffer),h(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;j=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<j.length;)0<=c["morphTarget"+m]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[m]]),h(c["morphTarget"+m]),k.vertexAttribPointer(c["morphTarget"+m],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[m]]),
|
|
|
-h(c["morphNormal"+m]),k.vertexAttribPointer(c["morphNormal"+m],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=g[j[m]],m++}else{j=[];g=f.morphTargetInfluences;var n,p=g.length;for(n=0;n<p;n++)m=g[n],0<m&&j.push([m,n]);j.length>d.numSupportedMorphTargets?(j.sort(l),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(l):0===j.length&&j.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)j[m]?(n=j[m][1],0<=c["morphTarget"+m]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),
|
|
|
-h(c["morphTarget"+m]),k.vertexAttribPointer(c["morphTarget"+m],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),h(c["morphNormal"+m]),k.vertexAttribPointer(c["morphNormal"+m],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=g[n]):f.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){g=
|
|
|
-0;for(j=e.__webglCustomAttributesList.length;g<j;g++)c=e.__webglCustomAttributesList[g],0<=a[c.buffer.belongsToAttribute]&&(k.bindBuffer(k.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),k.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,k.FLOAT,!1,0,0))}0<=a.color&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),k.vertexAttribPointer(a.color,3,k.FLOAT,!1,0,0));0<=a.normal&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),k.vertexAttribPointer(a.normal,
|
|
|
-3,k.FLOAT,!1,0,0));0<=a.tangent&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),k.vertexAttribPointer(a.tangent,4,k.FLOAT,!1,0,0));0<=a.uv&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),k.vertexAttribPointer(a.uv,2,k.FLOAT,!1,0,0));0<=a.uv2&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),k.vertexAttribPointer(a.uv2,2,k.FLOAT,!1,0,0));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),k.vertexAttribPointer(a.skinIndex,
|
|
|
-4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),k.vertexAttribPointer(a.skinWeight,4,k.FLOAT,!1,0,0));0<=a.lineDistance&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),k.vertexAttribPointer(a.lineDistance,1,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(z(d.wireframeLinewidth),b&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)):(b&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
|
|
|
-e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.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?k.LINE_STRIP:k.LINES,z(d.linewidth),k.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount):f instanceof
|
|
|
-THREE.Ribbon&&(k.drawArrays(k.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,l=a.fog;Ka=-1;bb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ja.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);ua.setFromMatrix(Ja);
|
|
|
-this.autoUpdateObjects&&this.initWebGLObjects(a);n(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.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ua.intersectsObject(g))){var q=g;
|
|
|
-q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,s=q.buffer,r=void 0,t=r=void 0,t=q.object.material;if(t instanceof THREE.MeshFaceMaterial)r=s.materialIndex,r=t.materials[r],r.transparent?(q.transparent=r,q.opaque=null):(q.opaque=r,q.transparent=null);else if(r=t)r.transparent?(q.transparent=r,q.opaque=null):(q.opaque=r,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(Na.getPositionFromMatrix(g.matrixWorld),
|
|
|
-Na.applyProjection(Ja),f.z=Na.z))}this.sortObjects&&h.sort(j);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),
|
|
|
-this.setDepthWrite(d.depthWrite),G(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,i,l,!0,d),p(a.__webglObjectsImmediate,"",b,i,l,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(a.__webglObjects,!0,"opaque",b,i,l,!1,d),p(a.__webglObjectsImmediate,"opaque",b,i,l,!1,d),m(a.__webglObjects,!1,"transparent",b,i,l,!0,d),p(a.__webglObjectsImmediate,"transparent",b,i,l,!0,d));n(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&
|
|
|
-c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=F(a,b,c,d,e);qa=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,
|
|
|
-k,ua):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;)t(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)u(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,c=a.__webglObjects.length;b<c;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&
|
|
|
-u(h,a),t(h,a));var i=h,j=i.geometry,m=void 0,n=void 0,p=void 0;if(j instanceof THREE.BufferGeometry){var r=k.DYNAMIC_DRAW,w=!j.dynamic,y=j.attributes,A=void 0,z=void 0;for(A in y)z=y[A],z.needsUpdate&&("index"===A?(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,z.buffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,z.array,r)):(k.bindBuffer(k.ARRAY_BUFFER,z.buffer),k.bufferData(k.ARRAY_BUFFER,z.array,r)),z.needsUpdate=!1),w&&!z.dynamic&&delete z.array}else if(i instanceof THREE.Mesh){for(var F=0,E=j.geometryGroupsList.length;F<
|
|
|
-E;F++)if(m=j.geometryGroupsList[F],p=e(i,m),j.buffersNeedUpdate&&d(m,i),n=p.attributes&&q(p),j.verticesNeedUpdate||j.morphTargetsNeedUpdate||j.elementsNeedUpdate||j.uvsNeedUpdate||j.normalsNeedUpdate||j.colorsNeedUpdate||j.tangentsNeedUpdate||n){var B=m,H=i,G=k.DYNAMIC_DRAW,I=!j.dynamic,J=p;if(B.__inittedArrays){var K=f(J),L=J.vertexColors?J.vertexColors:!1,M=g(J),N=K===THREE.SmoothShading,D=void 0,C=void 0,O=void 0,S=void 0,P=void 0,R=void 0,ea=void 0,V=void 0,Y=void 0,W=void 0,$=void 0,T=void 0,
|
|
|
-U=void 0,Q=void 0,ca=void 0,X=void 0,ga=void 0,pa=void 0,ab=void 0,fa=void 0,ha=void 0,ia=void 0,la=void 0,Wa=void 0,ja=void 0,qa=void 0,na=void 0,oa=void 0,Ka=void 0,fb=void 0,wa=void 0,ra=void 0,ua=void 0,Aa=void 0,Qa=void 0,va=void 0,bb=void 0,Ma=void 0,Ua=void 0,Xa=void 0,cb=void 0,kb=void 0,Za=void 0,$a=void 0,Ra=void 0,Sa=void 0,La=0,Pa=0,Ta=0,Va=0,wb=0,ib=0,Ba=0,nb=0,Oa=0,aa=0,ka=0,x=0,ya=void 0,db=B.__vertexArray,lb=B.__uvArray,tb=B.__uv2Array,xb=B.__normalArray,Fa=B.__tangentArray,eb=B.__colorArray,
|
|
|
-Ga=B.__skinIndexArray,Ha=B.__skinWeightArray,Ab=B.__morphTargetsArrays,Bb=B.__morphNormalsArrays,Cb=B.__webglCustomAttributesList,v=void 0,Fb=B.__faceArray,vb=B.__lineArray,pb=H.geometry,Nb=pb.elementsNeedUpdate,Kb=pb.uvsNeedUpdate,Ob=pb.normalsNeedUpdate,Tb=pb.tangentsNeedUpdate,Ub=pb.colorsNeedUpdate,ec=pb.morphTargetsNeedUpdate,Wb=pb.vertices,sa=B.faces3,ta=B.faces4,jb=pb.faces,Vb=pb.faceVertexUvs[0],Qc=pb.faceVertexUvs[1],Xb=pb.skinIndices,Qb=pb.skinWeights,Rb=pb.morphTargets,rc=pb.morphNormals;
|
|
|
-if(pb.verticesNeedUpdate){D=0;for(C=sa.length;D<C;D++)S=jb[sa[D]],T=Wb[S.a],U=Wb[S.b],Q=Wb[S.c],db[Pa]=T.x,db[Pa+1]=T.y,db[Pa+2]=T.z,db[Pa+3]=U.x,db[Pa+4]=U.y,db[Pa+5]=U.z,db[Pa+6]=Q.x,db[Pa+7]=Q.y,db[Pa+8]=Q.z,Pa+=9;D=0;for(C=ta.length;D<C;D++)S=jb[ta[D]],T=Wb[S.a],U=Wb[S.b],Q=Wb[S.c],ca=Wb[S.d],db[Pa]=T.x,db[Pa+1]=T.y,db[Pa+2]=T.z,db[Pa+3]=U.x,db[Pa+4]=U.y,db[Pa+5]=U.z,db[Pa+6]=Q.x,db[Pa+7]=Q.y,db[Pa+8]=Q.z,db[Pa+9]=ca.x,db[Pa+10]=ca.y,db[Pa+11]=ca.z,Pa+=12;k.bindBuffer(k.ARRAY_BUFFER,B.__webglVertexBuffer);
|
|
|
-k.bufferData(k.ARRAY_BUFFER,db,G)}if(ec){cb=0;for(kb=Rb.length;cb<kb;cb++){D=ka=0;for(C=sa.length;D<C;D++)Ra=sa[D],S=jb[Ra],T=Rb[cb].vertices[S.a],U=Rb[cb].vertices[S.b],Q=Rb[cb].vertices[S.c],Za=Ab[cb],Za[ka]=T.x,Za[ka+1]=T.y,Za[ka+2]=T.z,Za[ka+3]=U.x,Za[ka+4]=U.y,Za[ka+5]=U.z,Za[ka+6]=Q.x,Za[ka+7]=Q.y,Za[ka+8]=Q.z,J.morphNormals&&(N?(Sa=rc[cb].vertexNormals[Ra],fa=Sa.a,ha=Sa.b,ia=Sa.c):ia=ha=fa=rc[cb].faceNormals[Ra],$a=Bb[cb],$a[ka]=fa.x,$a[ka+1]=fa.y,$a[ka+2]=fa.z,$a[ka+3]=ha.x,$a[ka+4]=ha.y,
|
|
|
-$a[ka+5]=ha.z,$a[ka+6]=ia.x,$a[ka+7]=ia.y,$a[ka+8]=ia.z),ka+=9;D=0;for(C=ta.length;D<C;D++)Ra=ta[D],S=jb[Ra],T=Rb[cb].vertices[S.a],U=Rb[cb].vertices[S.b],Q=Rb[cb].vertices[S.c],ca=Rb[cb].vertices[S.d],Za=Ab[cb],Za[ka]=T.x,Za[ka+1]=T.y,Za[ka+2]=T.z,Za[ka+3]=U.x,Za[ka+4]=U.y,Za[ka+5]=U.z,Za[ka+6]=Q.x,Za[ka+7]=Q.y,Za[ka+8]=Q.z,Za[ka+9]=ca.x,Za[ka+10]=ca.y,Za[ka+11]=ca.z,J.morphNormals&&(N?(Sa=rc[cb].vertexNormals[Ra],fa=Sa.a,ha=Sa.b,ia=Sa.c,la=Sa.d):la=ia=ha=fa=rc[cb].faceNormals[Ra],$a=Bb[cb],$a[ka]=
|
|
|
-fa.x,$a[ka+1]=fa.y,$a[ka+2]=fa.z,$a[ka+3]=ha.x,$a[ka+4]=ha.y,$a[ka+5]=ha.z,$a[ka+6]=ia.x,$a[ka+7]=ia.y,$a[ka+8]=ia.z,$a[ka+9]=la.x,$a[ka+10]=la.y,$a[ka+11]=la.z),ka+=12;k.bindBuffer(k.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[cb]);k.bufferData(k.ARRAY_BUFFER,Ab[cb],G);J.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,B.__webglMorphNormalsBuffers[cb]),k.bufferData(k.ARRAY_BUFFER,Bb[cb],G))}}if(Qb.length){D=0;for(C=sa.length;D<C;D++)S=jb[sa[D]],oa=Qb[S.a],Ka=Qb[S.b],fb=Qb[S.c],Ha[aa]=oa.x,Ha[aa+1]=oa.y,
|
|
|
-Ha[aa+2]=oa.z,Ha[aa+3]=oa.w,Ha[aa+4]=Ka.x,Ha[aa+5]=Ka.y,Ha[aa+6]=Ka.z,Ha[aa+7]=Ka.w,Ha[aa+8]=fb.x,Ha[aa+9]=fb.y,Ha[aa+10]=fb.z,Ha[aa+11]=fb.w,ra=Xb[S.a],ua=Xb[S.b],Aa=Xb[S.c],Ga[aa]=ra.x,Ga[aa+1]=ra.y,Ga[aa+2]=ra.z,Ga[aa+3]=ra.w,Ga[aa+4]=ua.x,Ga[aa+5]=ua.y,Ga[aa+6]=ua.z,Ga[aa+7]=ua.w,Ga[aa+8]=Aa.x,Ga[aa+9]=Aa.y,Ga[aa+10]=Aa.z,Ga[aa+11]=Aa.w,aa+=12;D=0;for(C=ta.length;D<C;D++)S=jb[ta[D]],oa=Qb[S.a],Ka=Qb[S.b],fb=Qb[S.c],wa=Qb[S.d],Ha[aa]=oa.x,Ha[aa+1]=oa.y,Ha[aa+2]=oa.z,Ha[aa+3]=oa.w,Ha[aa+4]=Ka.x,
|
|
|
-Ha[aa+5]=Ka.y,Ha[aa+6]=Ka.z,Ha[aa+7]=Ka.w,Ha[aa+8]=fb.x,Ha[aa+9]=fb.y,Ha[aa+10]=fb.z,Ha[aa+11]=fb.w,Ha[aa+12]=wa.x,Ha[aa+13]=wa.y,Ha[aa+14]=wa.z,Ha[aa+15]=wa.w,ra=Xb[S.a],ua=Xb[S.b],Aa=Xb[S.c],Qa=Xb[S.d],Ga[aa]=ra.x,Ga[aa+1]=ra.y,Ga[aa+2]=ra.z,Ga[aa+3]=ra.w,Ga[aa+4]=ua.x,Ga[aa+5]=ua.y,Ga[aa+6]=ua.z,Ga[aa+7]=ua.w,Ga[aa+8]=Aa.x,Ga[aa+9]=Aa.y,Ga[aa+10]=Aa.z,Ga[aa+11]=Aa.w,Ga[aa+12]=Qa.x,Ga[aa+13]=Qa.y,Ga[aa+14]=Qa.z,Ga[aa+15]=Qa.w,aa+=16;0<aa&&(k.bindBuffer(k.ARRAY_BUFFER,B.__webglSkinIndicesBuffer),
|
|
|
-k.bufferData(k.ARRAY_BUFFER,Ga,G),k.bindBuffer(k.ARRAY_BUFFER,B.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Ha,G))}if(Ub&&L){D=0;for(C=sa.length;D<C;D++)S=jb[sa[D]],ea=S.vertexColors,V=S.color,3===ea.length&&L===THREE.VertexColors?(Wa=ea[0],ja=ea[1],qa=ea[2]):qa=ja=Wa=V,eb[Oa]=Wa.r,eb[Oa+1]=Wa.g,eb[Oa+2]=Wa.b,eb[Oa+3]=ja.r,eb[Oa+4]=ja.g,eb[Oa+5]=ja.b,eb[Oa+6]=qa.r,eb[Oa+7]=qa.g,eb[Oa+8]=qa.b,Oa+=9;D=0;for(C=ta.length;D<C;D++)S=jb[ta[D]],ea=S.vertexColors,V=S.color,4===ea.length&&L===THREE.VertexColors?
|
|
|
-(Wa=ea[0],ja=ea[1],qa=ea[2],na=ea[3]):na=qa=ja=Wa=V,eb[Oa]=Wa.r,eb[Oa+1]=Wa.g,eb[Oa+2]=Wa.b,eb[Oa+3]=ja.r,eb[Oa+4]=ja.g,eb[Oa+5]=ja.b,eb[Oa+6]=qa.r,eb[Oa+7]=qa.g,eb[Oa+8]=qa.b,eb[Oa+9]=na.r,eb[Oa+10]=na.g,eb[Oa+11]=na.b,Oa+=12;0<Oa&&(k.bindBuffer(k.ARRAY_BUFFER,B.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,eb,G))}if(Tb&&pb.hasTangents){D=0;for(C=sa.length;D<C;D++)S=jb[sa[D]],Y=S.vertexTangents,X=Y[0],ga=Y[1],pa=Y[2],Fa[Ba]=X.x,Fa[Ba+1]=X.y,Fa[Ba+2]=X.z,Fa[Ba+3]=X.w,Fa[Ba+4]=ga.x,Fa[Ba+5]=ga.y,
|
|
|
-Fa[Ba+6]=ga.z,Fa[Ba+7]=ga.w,Fa[Ba+8]=pa.x,Fa[Ba+9]=pa.y,Fa[Ba+10]=pa.z,Fa[Ba+11]=pa.w,Ba+=12;D=0;for(C=ta.length;D<C;D++)S=jb[ta[D]],Y=S.vertexTangents,X=Y[0],ga=Y[1],pa=Y[2],ab=Y[3],Fa[Ba]=X.x,Fa[Ba+1]=X.y,Fa[Ba+2]=X.z,Fa[Ba+3]=X.w,Fa[Ba+4]=ga.x,Fa[Ba+5]=ga.y,Fa[Ba+6]=ga.z,Fa[Ba+7]=ga.w,Fa[Ba+8]=pa.x,Fa[Ba+9]=pa.y,Fa[Ba+10]=pa.z,Fa[Ba+11]=pa.w,Fa[Ba+12]=ab.x,Fa[Ba+13]=ab.y,Fa[Ba+14]=ab.z,Fa[Ba+15]=ab.w,Ba+=16;k.bindBuffer(k.ARRAY_BUFFER,B.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,Fa,G)}if(Ob&&
|
|
|
-K){D=0;for(C=sa.length;D<C;D++)if(S=jb[sa[D]],P=S.vertexNormals,R=S.normal,3===P.length&&N)for(va=0;3>va;va++)Ma=P[va],xb[ib]=Ma.x,xb[ib+1]=Ma.y,xb[ib+2]=Ma.z,ib+=3;else for(va=0;3>va;va++)xb[ib]=R.x,xb[ib+1]=R.y,xb[ib+2]=R.z,ib+=3;D=0;for(C=ta.length;D<C;D++)if(S=jb[ta[D]],P=S.vertexNormals,R=S.normal,4===P.length&&N)for(va=0;4>va;va++)Ma=P[va],xb[ib]=Ma.x,xb[ib+1]=Ma.y,xb[ib+2]=Ma.z,ib+=3;else for(va=0;4>va;va++)xb[ib]=R.x,xb[ib+1]=R.y,xb[ib+2]=R.z,ib+=3;k.bindBuffer(k.ARRAY_BUFFER,B.__webglNormalBuffer);
|
|
|
-k.bufferData(k.ARRAY_BUFFER,xb,G)}if(Kb&&Vb&&M){D=0;for(C=sa.length;D<C;D++)if(O=sa[D],W=Vb[O],void 0!==W)for(va=0;3>va;va++)Ua=W[va],lb[Ta]=Ua.x,lb[Ta+1]=Ua.y,Ta+=2;D=0;for(C=ta.length;D<C;D++)if(O=ta[D],W=Vb[O],void 0!==W)for(va=0;4>va;va++)Ua=W[va],lb[Ta]=Ua.x,lb[Ta+1]=Ua.y,Ta+=2;0<Ta&&(k.bindBuffer(k.ARRAY_BUFFER,B.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,lb,G))}if(Kb&&Qc&&M){D=0;for(C=sa.length;D<C;D++)if(O=sa[D],$=Qc[O],void 0!==$)for(va=0;3>va;va++)Xa=$[va],tb[Va]=Xa.x,tb[Va+1]=Xa.y,Va+=
|
|
|
-2;D=0;for(C=ta.length;D<C;D++)if(O=ta[D],$=Qc[O],void 0!==$)for(va=0;4>va;va++)Xa=$[va],tb[Va]=Xa.x,tb[Va+1]=Xa.y,Va+=2;0<Va&&(k.bindBuffer(k.ARRAY_BUFFER,B.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,tb,G))}if(Nb){D=0;for(C=sa.length;D<C;D++)Fb[wb]=La,Fb[wb+1]=La+1,Fb[wb+2]=La+2,wb+=3,vb[nb]=La,vb[nb+1]=La+1,vb[nb+2]=La,vb[nb+3]=La+2,vb[nb+4]=La+1,vb[nb+5]=La+2,nb+=6,La+=3;D=0;for(C=ta.length;D<C;D++)Fb[wb]=La,Fb[wb+1]=La+1,Fb[wb+2]=La+3,Fb[wb+3]=La+1,Fb[wb+4]=La+2,Fb[wb+5]=La+3,wb+=6,vb[nb]=La,
|
|
|
-vb[nb+1]=La+1,vb[nb+2]=La,vb[nb+3]=La+3,vb[nb+4]=La+1,vb[nb+5]=La+2,vb[nb+6]=La+2,vb[nb+7]=La+3,nb+=8,La+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,B.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Fb,G);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,B.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,vb,G)}if(Cb){va=0;for(bb=Cb.length;va<bb;va++)if(v=Cb[va],v.__original.needsUpdate){x=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){D=0;for(C=sa.length;D<C;D++)S=jb[sa[D]],v.array[x]=v.value[S.a],
|
|
|
-v.array[x+1]=v.value[S.b],v.array[x+2]=v.value[S.c],x+=3;D=0;for(C=ta.length;D<C;D++)S=jb[ta[D]],v.array[x]=v.value[S.a],v.array[x+1]=v.value[S.b],v.array[x+2]=v.value[S.c],v.array[x+3]=v.value[S.d],x+=4}else{if("faces"===v.boundTo){D=0;for(C=sa.length;D<C;D++)ya=v.value[sa[D]],v.array[x]=ya,v.array[x+1]=ya,v.array[x+2]=ya,x+=3;D=0;for(C=ta.length;D<C;D++)ya=v.value[ta[D]],v.array[x]=ya,v.array[x+1]=ya,v.array[x+2]=ya,v.array[x+3]=ya,x+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){D=
|
|
|
-0;for(C=sa.length;D<C;D++)S=jb[sa[D]],T=v.value[S.a],U=v.value[S.b],Q=v.value[S.c],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=Q.x,v.array[x+5]=Q.y,x+=6;D=0;for(C=ta.length;D<C;D++)S=jb[ta[D]],T=v.value[S.a],U=v.value[S.b],Q=v.value[S.c],ca=v.value[S.d],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=Q.x,v.array[x+5]=Q.y,v.array[x+6]=ca.x,v.array[x+7]=ca.y,x+=8}else{if("faces"===v.boundTo){D=0;for(C=sa.length;D<C;D++)Q=U=T=ya=v.value[sa[D]],
|
|
|
-v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=Q.x,v.array[x+5]=Q.y,x+=6;D=0;for(C=ta.length;D<C;D++)ca=Q=U=T=ya=v.value[ta[D]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=Q.x,v.array[x+5]=Q.y,v.array[x+6]=ca.x,v.array[x+7]=ca.y,x+=8}}else if(3===v.size){var Z;Z="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||"vertices"===v.boundTo){D=0;for(C=sa.length;D<C;D++)S=jb[sa[D]],T=v.value[S.a],U=v.value[S.b],Q=v.value[S.c],
|
|
|
-v.array[x]=T[Z[0]],v.array[x+1]=T[Z[1]],v.array[x+2]=T[Z[2]],v.array[x+3]=U[Z[0]],v.array[x+4]=U[Z[1]],v.array[x+5]=U[Z[2]],v.array[x+6]=Q[Z[0]],v.array[x+7]=Q[Z[1]],v.array[x+8]=Q[Z[2]],x+=9;D=0;for(C=ta.length;D<C;D++)S=jb[ta[D]],T=v.value[S.a],U=v.value[S.b],Q=v.value[S.c],ca=v.value[S.d],v.array[x]=T[Z[0]],v.array[x+1]=T[Z[1]],v.array[x+2]=T[Z[2]],v.array[x+3]=U[Z[0]],v.array[x+4]=U[Z[1]],v.array[x+5]=U[Z[2]],v.array[x+6]=Q[Z[0]],v.array[x+7]=Q[Z[1]],v.array[x+8]=Q[Z[2]],v.array[x+9]=ca[Z[0]],
|
|
|
-v.array[x+10]=ca[Z[1]],v.array[x+11]=ca[Z[2]],x+=12}else if("faces"===v.boundTo){D=0;for(C=sa.length;D<C;D++)Q=U=T=ya=v.value[sa[D]],v.array[x]=T[Z[0]],v.array[x+1]=T[Z[1]],v.array[x+2]=T[Z[2]],v.array[x+3]=U[Z[0]],v.array[x+4]=U[Z[1]],v.array[x+5]=U[Z[2]],v.array[x+6]=Q[Z[0]],v.array[x+7]=Q[Z[1]],v.array[x+8]=Q[Z[2]],x+=9;D=0;for(C=ta.length;D<C;D++)ca=Q=U=T=ya=v.value[ta[D]],v.array[x]=T[Z[0]],v.array[x+1]=T[Z[1]],v.array[x+2]=T[Z[2]],v.array[x+3]=U[Z[0]],v.array[x+4]=U[Z[1]],v.array[x+5]=U[Z[2]],
|
|
|
-v.array[x+6]=Q[Z[0]],v.array[x+7]=Q[Z[1]],v.array[x+8]=Q[Z[2]],v.array[x+9]=ca[Z[0]],v.array[x+10]=ca[Z[1]],v.array[x+11]=ca[Z[2]],x+=12}else if("faceVertices"===v.boundTo){D=0;for(C=sa.length;D<C;D++)ya=v.value[sa[D]],T=ya[0],U=ya[1],Q=ya[2],v.array[x]=T[Z[0]],v.array[x+1]=T[Z[1]],v.array[x+2]=T[Z[2]],v.array[x+3]=U[Z[0]],v.array[x+4]=U[Z[1]],v.array[x+5]=U[Z[2]],v.array[x+6]=Q[Z[0]],v.array[x+7]=Q[Z[1]],v.array[x+8]=Q[Z[2]],x+=9;D=0;for(C=ta.length;D<C;D++)ya=v.value[ta[D]],T=ya[0],U=ya[1],Q=ya[2],
|
|
|
-ca=ya[3],v.array[x]=T[Z[0]],v.array[x+1]=T[Z[1]],v.array[x+2]=T[Z[2]],v.array[x+3]=U[Z[0]],v.array[x+4]=U[Z[1]],v.array[x+5]=U[Z[2]],v.array[x+6]=Q[Z[0]],v.array[x+7]=Q[Z[1]],v.array[x+8]=Q[Z[2]],v.array[x+9]=ca[Z[0]],v.array[x+10]=ca[Z[1]],v.array[x+11]=ca[Z[2]],x+=12}}else if(4===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){D=0;for(C=sa.length;D<C;D++)S=jb[sa[D]],T=v.value[S.a],U=v.value[S.b],Q=v.value[S.c],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=
|
|
|
-U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=Q.x,v.array[x+9]=Q.y,v.array[x+10]=Q.z,v.array[x+11]=Q.w,x+=12;D=0;for(C=ta.length;D<C;D++)S=jb[ta[D]],T=v.value[S.a],U=v.value[S.b],Q=v.value[S.c],ca=v.value[S.d],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=Q.x,v.array[x+9]=Q.y,v.array[x+10]=Q.z,v.array[x+11]=Q.w,v.array[x+12]=ca.x,v.array[x+13]=ca.y,v.array[x+14]=ca.z,v.array[x+
|
|
|
-15]=ca.w,x+=16}else if("faces"===v.boundTo){D=0;for(C=sa.length;D<C;D++)Q=U=T=ya=v.value[sa[D]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=Q.x,v.array[x+9]=Q.y,v.array[x+10]=Q.z,v.array[x+11]=Q.w,x+=12;D=0;for(C=ta.length;D<C;D++)ca=Q=U=T=ya=v.value[ta[D]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+
|
|
|
-8]=Q.x,v.array[x+9]=Q.y,v.array[x+10]=Q.z,v.array[x+11]=Q.w,v.array[x+12]=ca.x,v.array[x+13]=ca.y,v.array[x+14]=ca.z,v.array[x+15]=ca.w,x+=16}else if("faceVertices"===v.boundTo){D=0;for(C=sa.length;D<C;D++)ya=v.value[sa[D]],T=ya[0],U=ya[1],Q=ya[2],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=Q.x,v.array[x+9]=Q.y,v.array[x+10]=Q.z,v.array[x+11]=Q.w,x+=12;D=0;for(C=ta.length;D<C;D++)ya=v.value[ta[D]],
|
|
|
-T=ya[0],U=ya[1],Q=ya[2],ca=ya[3],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=Q.x,v.array[x+9]=Q.y,v.array[x+10]=Q.z,v.array[x+11]=Q.w,v.array[x+12]=ca.x,v.array[x+13]=ca.y,v.array[x+14]=ca.z,v.array[x+15]=ca.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,v.buffer);k.bufferData(k.ARRAY_BUFFER,v.array,G)}}I&&(delete B.__inittedArrays,delete B.__colorArray,delete B.__normalArray,delete B.__tangentArray,delete B.__uvArray,
|
|
|
-delete B.__uv2Array,delete B.__faceArray,delete B.__vertexArray,delete B.__lineArray,delete B.__skinIndexArray,delete B.__skinWeightArray)}}j.verticesNeedUpdate=!1;j.morphTargetsNeedUpdate=!1;j.elementsNeedUpdate=!1;j.uvsNeedUpdate=!1;j.normalsNeedUpdate=!1;j.colorsNeedUpdate=!1;j.tangentsNeedUpdate=!1;j.buffersNeedUpdate=!1;p.attributes&&s(p)}else if(i instanceof THREE.Ribbon){p=e(i,j);n=p.attributes&&q(p);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.normalsNeedUpdate||n){var yb=j,sc=k.DYNAMIC_DRAW,
|
|
|
-hc=void 0,ic=void 0,jc=void 0,tc=void 0,za=void 0,uc=void 0,vc=void 0,wc=void 0,cc=void 0,gb=void 0,$b=void 0,Da=void 0,qb=void 0,dc=yb.vertices,fc=yb.colors,gc=yb.normals,oc=dc.length,pc=fc.length,Hc=gc.length,xc=yb.__vertexArray,yc=yb.__colorArray,zc=yb.__normalArray,Ic=yb.colorsNeedUpdate,Jc=yb.normalsNeedUpdate,Rc=yb.__webglCustomAttributesList;if(yb.verticesNeedUpdate){for(hc=0;hc<oc;hc++)tc=dc[hc],za=3*hc,xc[za]=tc.x,xc[za+1]=tc.y,xc[za+2]=tc.z;k.bindBuffer(k.ARRAY_BUFFER,yb.__webglVertexBuffer);
|
|
|
-k.bufferData(k.ARRAY_BUFFER,xc,sc)}if(Ic){for(ic=0;ic<pc;ic++)uc=fc[ic],za=3*ic,yc[za]=uc.r,yc[za+1]=uc.g,yc[za+2]=uc.b;k.bindBuffer(k.ARRAY_BUFFER,yb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,yc,sc)}if(Jc){for(jc=0;jc<Hc;jc++)vc=gc[jc],za=3*jc,zc[za]=vc.x,zc[za+1]=vc.y,zc[za+2]=vc.z;k.bindBuffer(k.ARRAY_BUFFER,yb.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,zc,sc)}if(Rc){wc=0;for(cc=Rc.length;wc<cc;wc++)if(Da=Rc[wc],Da.needsUpdate&&(void 0===Da.boundTo||"vertices"===Da.boundTo)){za=0;$b=
|
|
|
-Da.value.length;if(1===Da.size)for(gb=0;gb<$b;gb++)Da.array[gb]=Da.value[gb];else if(2===Da.size)for(gb=0;gb<$b;gb++)qb=Da.value[gb],Da.array[za]=qb.x,Da.array[za+1]=qb.y,za+=2;else if(3===Da.size)if("c"===Da.type)for(gb=0;gb<$b;gb++)qb=Da.value[gb],Da.array[za]=qb.r,Da.array[za+1]=qb.g,Da.array[za+2]=qb.b,za+=3;else for(gb=0;gb<$b;gb++)qb=Da.value[gb],Da.array[za]=qb.x,Da.array[za+1]=qb.y,Da.array[za+2]=qb.z,za+=3;else if(4===Da.size)for(gb=0;gb<$b;gb++)qb=Da.value[gb],Da.array[za]=qb.x,Da.array[za+
|
|
|
-1]=qb.y,Da.array[za+2]=qb.z,Da.array[za+3]=qb.w,za+=4;k.bindBuffer(k.ARRAY_BUFFER,Da.buffer);k.bufferData(k.ARRAY_BUFFER,Da.array,sc)}}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;j.normalsNeedUpdate=!1;p.attributes&&s(p)}else if(i instanceof THREE.Line){p=e(i,j);n=p.attributes&&q(p);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.lineDistancesNeedUpdate||n){var zb=j,Ac=k.DYNAMIC_DRAW,kc=void 0,lc=void 0,mc=void 0,Bc=void 0,Ia=void 0,Cc=void 0,Wc=zb.vertices,Xc=zb.colors,Yc=zb.lineDistances,Kc=Wc.length,
|
|
|
-Lc=Xc.length,Mc=Yc.length,Dc=zb.__vertexArray,Ec=zb.__colorArray,Zc=zb.__lineDistanceArray,Nc=zb.colorsNeedUpdate,dd=zb.lineDistancesNeedUpdate,Sc=zb.__webglCustomAttributesList,Fc=void 0,$c=void 0,hb=void 0,ac=void 0,rb=void 0,Ea=void 0;if(zb.verticesNeedUpdate){for(kc=0;kc<Kc;kc++)Bc=Wc[kc],Ia=3*kc,Dc[Ia]=Bc.x,Dc[Ia+1]=Bc.y,Dc[Ia+2]=Bc.z;k.bindBuffer(k.ARRAY_BUFFER,zb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Dc,Ac)}if(Nc){for(lc=0;lc<Lc;lc++)Cc=Xc[lc],Ia=3*lc,Ec[Ia]=Cc.r,Ec[Ia+1]=Cc.g,Ec[Ia+
|
|
|
-2]=Cc.b;k.bindBuffer(k.ARRAY_BUFFER,zb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Ec,Ac)}if(dd){for(mc=0;mc<Mc;mc++)Zc[mc]=Yc[mc];k.bindBuffer(k.ARRAY_BUFFER,zb.__webglLineDistanceBuffer);k.bufferData(k.ARRAY_BUFFER,Zc,Ac)}if(Sc){Fc=0;for($c=Sc.length;Fc<$c;Fc++)if(Ea=Sc[Fc],Ea.needsUpdate&&(void 0===Ea.boundTo||"vertices"===Ea.boundTo)){Ia=0;ac=Ea.value.length;if(1===Ea.size)for(hb=0;hb<ac;hb++)Ea.array[hb]=Ea.value[hb];else if(2===Ea.size)for(hb=0;hb<ac;hb++)rb=Ea.value[hb],Ea.array[Ia]=rb.x,
|
|
|
-Ea.array[Ia+1]=rb.y,Ia+=2;else if(3===Ea.size)if("c"===Ea.type)for(hb=0;hb<ac;hb++)rb=Ea.value[hb],Ea.array[Ia]=rb.r,Ea.array[Ia+1]=rb.g,Ea.array[Ia+2]=rb.b,Ia+=3;else for(hb=0;hb<ac;hb++)rb=Ea.value[hb],Ea.array[Ia]=rb.x,Ea.array[Ia+1]=rb.y,Ea.array[Ia+2]=rb.z,Ia+=3;else if(4===Ea.size)for(hb=0;hb<ac;hb++)rb=Ea.value[hb],Ea.array[Ia]=rb.x,Ea.array[Ia+1]=rb.y,Ea.array[Ia+2]=rb.z,Ea.array[Ia+3]=rb.w,Ia+=4;k.bindBuffer(k.ARRAY_BUFFER,Ea.buffer);k.bufferData(k.ARRAY_BUFFER,Ea.array,Ac)}}}j.verticesNeedUpdate=
|
|
|
-!1;j.colorsNeedUpdate=!1;j.lineDistancesNeedUpdate=!1;p.attributes&&s(p)}else if(i instanceof THREE.ParticleSystem){p=e(i,j);n=p.attributes&&q(p);if(j.verticesNeedUpdate||j.colorsNeedUpdate||i.sortParticles||n){var Gb=j,Tc=k.DYNAMIC_DRAW,nc=i,sb=void 0,Hb=void 0,Ib=void 0,da=void 0,Jb=void 0,Sb=void 0,Gc=Gb.vertices,Uc=Gc.length,Vc=Gb.colors,ad=Vc.length,Yb=Gb.__vertexArray,Zb=Gb.__colorArray,Lb=Gb.__sortArray,bd=Gb.verticesNeedUpdate,cd=Gb.colorsNeedUpdate,Mb=Gb.__webglCustomAttributesList,Db=void 0,
|
|
|
-bc=void 0,ma=void 0,Eb=void 0,Ca=void 0,ba=void 0;if(nc.sortParticles){ub.copy(Ja);ub.multiply(nc.matrixWorld);for(sb=0;sb<Uc;sb++)Ib=Gc[sb],Na.copy(Ib),Na.applyProjection(ub),Lb[sb]=[Na.z,sb];Lb.sort(l);for(sb=0;sb<Uc;sb++)Ib=Gc[Lb[sb][1]],da=3*sb,Yb[da]=Ib.x,Yb[da+1]=Ib.y,Yb[da+2]=Ib.z;for(Hb=0;Hb<ad;Hb++)da=3*Hb,Sb=Vc[Lb[Hb][1]],Zb[da]=Sb.r,Zb[da+1]=Sb.g,Zb[da+2]=Sb.b;if(Mb){Db=0;for(bc=Mb.length;Db<bc;Db++)if(ba=Mb[Db],void 0===ba.boundTo||"vertices"===ba.boundTo)if(da=0,Eb=ba.value.length,1===
|
|
|
-ba.size)for(ma=0;ma<Eb;ma++)Jb=Lb[ma][1],ba.array[ma]=ba.value[Jb];else if(2===ba.size)for(ma=0;ma<Eb;ma++)Jb=Lb[ma][1],Ca=ba.value[Jb],ba.array[da]=Ca.x,ba.array[da+1]=Ca.y,da+=2;else if(3===ba.size)if("c"===ba.type)for(ma=0;ma<Eb;ma++)Jb=Lb[ma][1],Ca=ba.value[Jb],ba.array[da]=Ca.r,ba.array[da+1]=Ca.g,ba.array[da+2]=Ca.b,da+=3;else for(ma=0;ma<Eb;ma++)Jb=Lb[ma][1],Ca=ba.value[Jb],ba.array[da]=Ca.x,ba.array[da+1]=Ca.y,ba.array[da+2]=Ca.z,da+=3;else if(4===ba.size)for(ma=0;ma<Eb;ma++)Jb=Lb[ma][1],
|
|
|
-Ca=ba.value[Jb],ba.array[da]=Ca.x,ba.array[da+1]=Ca.y,ba.array[da+2]=Ca.z,ba.array[da+3]=Ca.w,da+=4}}else{if(bd)for(sb=0;sb<Uc;sb++)Ib=Gc[sb],da=3*sb,Yb[da]=Ib.x,Yb[da+1]=Ib.y,Yb[da+2]=Ib.z;if(cd)for(Hb=0;Hb<ad;Hb++)Sb=Vc[Hb],da=3*Hb,Zb[da]=Sb.r,Zb[da+1]=Sb.g,Zb[da+2]=Sb.b;if(Mb){Db=0;for(bc=Mb.length;Db<bc;Db++)if(ba=Mb[Db],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo))if(Eb=ba.value.length,da=0,1===ba.size)for(ma=0;ma<Eb;ma++)ba.array[ma]=ba.value[ma];else if(2===ba.size)for(ma=
|
|
|
-0;ma<Eb;ma++)Ca=ba.value[ma],ba.array[da]=Ca.x,ba.array[da+1]=Ca.y,da+=2;else if(3===ba.size)if("c"===ba.type)for(ma=0;ma<Eb;ma++)Ca=ba.value[ma],ba.array[da]=Ca.r,ba.array[da+1]=Ca.g,ba.array[da+2]=Ca.b,da+=3;else for(ma=0;ma<Eb;ma++)Ca=ba.value[ma],ba.array[da]=Ca.x,ba.array[da+1]=Ca.y,ba.array[da+2]=Ca.z,da+=3;else if(4===ba.size)for(ma=0;ma<Eb;ma++)Ca=ba.value[ma],ba.array[da]=Ca.x,ba.array[da+1]=Ca.y,ba.array[da+2]=Ca.z,ba.array[da+3]=Ca.w,da+=4}}if(bd||nc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
-Gb.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,Yb,Tc);if(cd||nc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Gb.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,Zb,Tc);if(Mb){Db=0;for(bc=Mb.length;Db<bc;Db++)if(ba=Mb[Db],ba.needsUpdate||nc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,ba.buffer),k.bufferData(k.ARRAY_BUFFER,ba.array,Tc)}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;p.attributes&&s(p)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",pc);var i,j,l,m,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,s,r;e=g=s=r=p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&s++,q instanceof THREE.SpotLight&&r++,q instanceof THREE.HemisphereLight&&p++);e=g;f=s;g=r;h=p;p=q=0;for(r=b.length;p<r;p++)s=b[p],s.castShadow&&(s instanceof THREE.SpotLight&&q++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&q++);m=q;Vb&&d&&d.useVertexTexture?l=1024:(b=k.getParameter(k.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)")),l=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:l,useVertexTexture:Vb&&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:m,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,u,w,d=[];n?d.push(n):(d.push(r),d.push(s));for(u in q)d.push(u),d.push(q[u]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(u=ea.length;t<u;t++)if(d=ea[t],d.code===n){d.usedTimes++;j=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");u=[];for(w in q)d=q[w],!1!==d&&(d="#define "+w+" "+d,u.push(d));d=u.join("\n");w=k.createProgram();u=["precision "+K+" float;",d,ec?"#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):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
|
|
|
-"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-t=["precision "+K+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#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,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
+if(a===THREE.OneMinusSrcColorFactor)return k.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return k.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return k.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return k.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return k.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return k.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return k.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return k.SRC_ALPHA_SATURATE;if(void 0!==na){if(a===THREE.RGB_S3TC_DXT1_Format)return na.COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
|
+if(a===THREE.RGBA_S3TC_DXT1_Format)return na.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return na.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return na.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},Z=void 0!==a.canvas?a.canvas:document.createElement("canvas"),K=void 0!==a.precision?a.precision:"highp",oa=void 0!==a.alpha?a.alpha:!0,Pa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Va=void 0!==
|
|
|
+a.antialias?a.antialias:!1,O=void 0!==a.stencil?a.stencil:!0,qa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Fa=new THREE.Color(0),wa=0;void 0!==a.clearColor&&(console.warn("DEPRECATED: clearColor in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),Fa.setHex(a.clearColor));void 0!==a.clearAlpha&&(console.warn("DEPRECATED: clearAlpha in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),wa=a.clearAlpha);this.domElement=
|
|
|
+Z;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=
|
|
|
+!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var M=this,V=[],ea=0,pa=null,Ua=null,pb=-1,ub=null,ya=null,Ha=0,fa=0,da=-1,T=-1,aa=-1,la=-1,Y=-1,ma=-1,xa=-1,bb=-1,ia=null,ha=null,ra=null,ka=null,ua=0,Ra=0,Qa=0,Ya=0,Xb=0,Jb=0,Ab={},Sa=new THREE.Frustum,xb=new THREE.Matrix4,lb=new THREE.Matrix4,Ga=new THREE.Vector3,Ca=new THREE.Vector3,
|
|
|
+yb=!0,Ib={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,Rb,Yb,fb,na;try{if(!(k=Z.getContext("experimental-webgl",{alpha:oa,premultipliedAlpha:Pa,antialias:Va,stencil:O,preserveDrawingBuffer:qa})))throw"Error creating WebGL context.";}catch(va){console.error(va)}Rb=k.getExtension("OES_texture_float");
|
|
|
+Yb=k.getExtension("OES_standard_derivatives");fb=k.getExtension("EXT_texture_filter_anisotropic")||k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");na=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Rb||console.log("THREE.WebGLRenderer: Float textures not supported.");Yb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
|
|
|
+fb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");na||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===k.getShaderPrecisionFormat&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,
|
|
|
+k.ONE_MINUS_SRC_ALPHA);k.clearColor(Fa.r,Fa.g,Fa.b,wa);this.context=k;var ib=k.getParameter(k.MAX_TEXTURE_IMAGE_UNITS),Tb=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Ub=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),Xa=fb?k.getParameter(fb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Gb=0<Tb,Bb=Gb&&Rb;na&&k.getParameter(k.COMPRESSED_TEXTURE_FORMATS);var Kb=k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.HIGH_FLOAT),Ka=k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.MEDIUM_FLOAT);
|
|
|
+k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.LOW_FLOAT);var Sb=k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.HIGH_FLOAT),Lb=k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.MEDIUM_FLOAT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.LOW_FLOAT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.HIGH_INT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.MEDIUM_INT);k.getShaderPrecisionFormat(k.VERTEX_SHADER,k.LOW_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.HIGH_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,
|
|
|
+k.MEDIUM_INT);k.getShaderPrecisionFormat(k.FRAGMENT_SHADER,k.LOW_INT);var Hb=0<Kb.precision&&0<Sb.precision,jc=0<Ka.precision&&0<Lb.precision;"highp"===K&&!Hb&&(jc?(K="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(K="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===K&&!jc&&(K="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return k};this.supportsVertexTextures=function(){return Gb};
|
|
|
+this.supportsFloatTextures=function(){return Rb};this.supportsStandardDerivatives=function(){return Yb};this.supportsCompressedTextureS3TC=function(){return na};this.getMaxAnisotropy=function(){return Xa};this.getPrecision=function(){return K};this.setSize=function(a,b,c){Z.width=a*this.devicePixelRatio;Z.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(Z.style.width=a+"px",Z.style.height=b+"px");this.setViewport(0,0,Z.width,Z.height)};this.setViewport=function(a,b,c,d){ua=void 0!==
|
|
|
+a?a:0;Ra=void 0!==b?b:0;Qa=void 0!==c?c:Z.width;Ya=void 0!==d?d:Z.height;k.viewport(ua,Ra,Qa,Ya)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColor=function(a,b){Fa.set(a);wa=void 0!==b?b:1;k.clearColor(Fa.r,Fa.g,Fa.b,wa)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=
|
|
|
+function(){return Fa};this.getClearAlpha=function(){return wa};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=k.COLOR_BUFFER_BIT;if(void 0===b||b)d|=k.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){pa=null;pb=
|
|
|
+ub=bb=xa=aa=-1;yb=!0;T=da=-1;this.shadowMapPlugin.update(a,b)};var kc=function(a){a=a.target;a.removeEventListener("dispose",kc);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&k.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&k.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&k.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&k.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&k.deleteBuffer(a.__webglUVBuffer);void 0!==
|
|
|
+a.__webglUV2Buffer&&k.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&k.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&k.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&k.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&k.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&k.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];
|
|
|
+if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)k.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)k.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);M.info.memory.geometries--},lc=function(a){a=a.target;a.removeEventListener("dispose",lc);a.image&&a.image.__webglTextureCube?k.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,k.deleteTexture(a.__webglTexture));M.info.memory.textures--},
|
|
|
+mc=function(a){a=a.target;a.removeEventListener("dispose",mc);if(a&&a.__webglTexture)if(k.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)k.deleteFramebuffer(a.__webglFramebuffer[b]),k.deleteRenderbuffer(a.__webglRenderbuffer[b]);else k.deleteFramebuffer(a.__webglFramebuffer),k.deleteRenderbuffer(a.__webglRenderbuffer);M.info.memory.textures--},uc=function(a){a=a.target;a.removeEventListener("dispose",uc);vc(a)},vc=function(a){var b=a.program;if(void 0!==
|
|
|
+b){a.program=void 0;var c,d,e=!1,a=0;for(c=V.length;a<c;a++)if(d=V[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=V.length;a<c;a++)d=V[a],d.program!==b&&e.push(d);V=e;k.deleteProgram(b);M.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=k.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=k.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=
|
|
|
+k.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=k.createBuffer());a.hasPositions&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,!1,0,0));if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,j,l,p,m,n,r=3*a.count;for(n=0;n<r;n+=9)m=a.normalArray,
|
|
|
+d=m[n],e=m[n+1],f=m[n+2],g=m[n+3],i=m[n+4],l=m[n+5],h=m[n+6],j=m[n+7],p=m[n+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+l+p)/3,m[n]=d,m[n+1]=e,m[n+2]=f,m[n+3]=d,m[n+4]=e,m[n+5]=f,m[n+6]=d,m[n+7]=e,m[n+8]=f}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer),k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.uv),
|
|
|
+k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.color),k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,!1,0,0));k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var h,j,l;h=F(a,b,c,d,f);a=h.attributes;b=e.attributes;c=!1;h=16777215*e.id+
|
|
|
+2*h.id+(d.wireframe?1:0);h!==ub&&(ub=h,c=!0);c&&i();if(f instanceof THREE.Mesh)if(d=b.index){e=e.offsets;1<e.length&&(c=!0);for(var p=0,m=e.length;p<m;p++){var n=e[p].index;if(c){for(j in b)"index"!==j&&(h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,l,k.FLOAT,!1,0,4*n*l)));k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,d.buffer)}k.drawElements(k.TRIANGLES,e[p].count,k.UNSIGNED_SHORT,2*e[p].start);M.info.render.calls++;M.info.render.vertices+=e[p].count;
|
|
|
+M.info.render.faces+=e[p].count/3}}else{if(c)for(j in b)"index"!==j&&(h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,l,k.FLOAT,!1,0,0)));j=e.attributes.position;k.drawArrays(k.TRIANGLES,0,j.numItems/3);M.info.render.calls++;M.info.render.vertices+=j.numItems/3;M.info.render.faces+=j.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(j in b)h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,
|
|
|
+l,k.FLOAT,!1,0,0));j=b.position;k.drawArrays(k.POINTS,0,j.numItems/3);M.info.render.calls++;M.info.render.points+=j.numItems/3}}else if(f instanceof THREE.Line&&c){for(j in b)h=a[j],f=b[j],l=f.itemSize,0<=h&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),g(h),k.vertexAttribPointer(h,l,k.FLOAT,!1,0,0));B(d.linewidth);j=b.position;k.drawArrays(k.LINE_STRIP,0,j.numItems/3);M.info.render.calls++;M.info.render.points+=j.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var h,j,c=F(a,b,c,d,
|
|
|
+f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ub&&(ub=c,b=!0);b&&i();if(!d.morphTargets&&0<=a.position)b&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),g(a.position),k.vertexAttribPointer(a.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),g(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):0<=c.position&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+e.__webglVertexBuffer),g(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var l=0;j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;l<d.numSupportedMorphTargets&&l<j.length;)0<=c["morphTarget"+l]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[l]]),g(c["morphTarget"+l]),k.vertexAttribPointer(c["morphTarget"+l],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[l]]),
|
|
|
+g(c["morphNormal"+l]),k.vertexAttribPointer(c["morphNormal"+l],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=h[j[l]],l++}else{j=[];h=f.morphTargetInfluences;var p,n=h.length;for(p=0;p<n;p++)l=h[p],0<l&&j.push([l,p]);j.length>d.numSupportedMorphTargets?(j.sort(m),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(m):0===j.length&&j.push([0,0]);for(l=0;l<d.numSupportedMorphTargets;)j[l]?(p=j[l][1],0<=c["morphTarget"+l]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[p]),
|
|
|
+g(c["morphTarget"+l]),k.vertexAttribPointer(c["morphTarget"+l],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[p]),g(c["morphNormal"+l]),k.vertexAttribPointer(c["morphNormal"+l],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=h[p]):f.__webglMorphTargetInfluences[l]=0,l++}null!==d.program.uniforms.morphTargetInfluences&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){h=
|
|
|
+0;for(j=e.__webglCustomAttributesList.length;h<j;h++)c=e.__webglCustomAttributesList[h],0<=a[c.buffer.belongsToAttribute]&&(k.bindBuffer(k.ARRAY_BUFFER,c.buffer),g(a[c.buffer.belongsToAttribute]),k.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,k.FLOAT,!1,0,0))}0<=a.color&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer),g(a.color),k.vertexAttribPointer(a.color,3,k.FLOAT,!1,0,0));0<=a.normal&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer),g(a.normal),k.vertexAttribPointer(a.normal,
|
|
|
+3,k.FLOAT,!1,0,0));0<=a.tangent&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglTangentBuffer),g(a.tangent),k.vertexAttribPointer(a.tangent,4,k.FLOAT,!1,0,0));0<=a.uv&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer),g(a.uv),k.vertexAttribPointer(a.uv,2,k.FLOAT,!1,0,0));0<=a.uv2&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer),g(a.uv2),k.vertexAttribPointer(a.uv2,2,k.FLOAT,!1,0,0));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g(a.skinIndex),k.vertexAttribPointer(a.skinIndex,
|
|
|
+4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g(a.skinWeight),k.vertexAttribPointer(a.skinWeight,4,k.FLOAT,!1,0,0));0<=a.lineDistance&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglLineDistanceBuffer),g(a.lineDistance),k.vertexAttribPointer(a.lineDistance,1,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(B(d.wireframeLinewidth),b&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)):(b&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
|
|
|
+e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,B(d.linewidth),k.drawArrays(f,0,e.__webglLineCount),M.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),M.info.render.calls++,M.info.render.points+=e.__webglParticleCount):f instanceof
|
|
|
+THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),M.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,h,g,i=a.__lights,m=a.fog;pb=-1;yb=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);xb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Sa.setFromMatrix(xb);
|
|
|
+this.autoUpdateObjects&&this.initWebGLObjects(a);p(this.renderPluginsPre,a,b);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;M.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Sa.intersectsObject(h))){var n=h;
|
|
|
+n._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,n.matrixWorld);n._normalMatrix.getNormalMatrix(n._modelViewMatrix);var n=f,s=n.buffer,q=void 0,t=q=void 0,t=n.object.material;if(t instanceof THREE.MeshFaceMaterial)q=s.materialIndex,q=t.materials[q],q.transparent?(n.transparent=q,n.opaque=null):(n.opaque=q,n.transparent=null);else if(q=t)q.transparent?(n.transparent=q,n.opaque=null):(n.opaque=q,n.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(Ga.getPositionFromMatrix(h.matrixWorld),
|
|
|
+Ga.applyProjection(xb),f.z=Ga.z))}this.sortObjects&&g.sort(j);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,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),C(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,i,m,!0,d),r(a.__webglObjectsImmediate,"",b,i,m,!1,d)):(d=null,this.setBlending(THREE.NoBlending),l(a.__webglObjects,!0,"opaque",b,i,m,!1,d),r(a.__webglObjectsImmediate,"opaque",b,i,m,!1,d),l(a.__webglObjects,!1,"transparent",b,i,m,!0,d),r(a.__webglObjectsImmediate,"transparent",b,i,m,!0,d));p(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&
|
|
|
+c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=F(a,b,c,d,e);ub=-1;M.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,
|
|
|
+k,Sa):e.render(function(a){M.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)t(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)v(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,c=a.__webglObjects.length;b<c;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&
|
|
|
+v(g,a),t(g,a));var i=g,j=i.geometry,l=void 0,p=void 0,n=void 0;if(j instanceof THREE.BufferGeometry){var r=k.DYNAMIC_DRAW,y=!j.dynamic,w=j.attributes,z=void 0,A=void 0;for(z in w)A=w[z],A.needsUpdate&&("index"===z?(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,A.buffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,A.array,r)):(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,r)),A.needsUpdate=!1),y&&!A.dynamic&&delete A.array}else if(i instanceof THREE.Mesh){for(var B=0,F=j.geometryGroupsList.length;B<
|
|
|
+F;B++)if(l=j.geometryGroupsList[B],n=e(i,l),j.buffersNeedUpdate&&d(l,i),p=n.attributes&&s(n),j.verticesNeedUpdate||j.morphTargetsNeedUpdate||j.elementsNeedUpdate||j.uvsNeedUpdate||j.normalsNeedUpdate||j.colorsNeedUpdate||j.tangentsNeedUpdate||p){var D=l,G=i,H=k.DYNAMIC_DRAW,I=!j.dynamic,J=n;if(D.__inittedArrays){var V=f(J),K=J.vertexColors?J.vertexColors:!1,L=h(J),M=V===THREE.SmoothShading,E=void 0,C=void 0,N=void 0,Q=void 0,O=void 0,ea=void 0,T=void 0,Y=void 0,pa=void 0,fa=void 0,aa=void 0,R=void 0,
|
|
|
+S=void 0,P=void 0,ba=void 0,Z=void 0,da=void 0,ya=void 0,ma=void 0,Ha=void 0,ha=void 0,Ua=void 0,qa=void 0,la=void 0,ia=void 0,ka=void 0,ua=void 0,na=void 0,oa=void 0,ra=void 0,Ca=void 0,va=void 0,wa=void 0,xa=void 0,pb=void 0,za=void 0,ub=void 0,Fa=void 0,Pa=void 0,Ra=void 0,cb=void 0,bb=void 0,$a=void 0,ab=void 0,Va=void 0,Qa=void 0,Ta=0,Za=0,Xa=0,Ya=0,Ka=0,jb=0,Da=0,ob=0,Wa=0,X=0,ga=0,x=0,Aa=void 0,db=D.__vertexArray,fb=D.__uvArray,ib=D.__uv2Array,Sa=D.__normalArray,La=D.__tangentArray,eb=D.__colorArray,
|
|
|
+Ma=D.__skinIndexArray,Na=D.__skinWeightArray,yb=D.__morphTargetsArrays,Ab=D.__morphNormalsArrays,Bb=D.__webglCustomAttributesList,u=void 0,Mb=D.__faceArray,wb=D.__lineArray,qb=G.geometry,Gb=qb.elementsNeedUpdate,Hb=qb.uvsNeedUpdate,Rb=qb.normalsNeedUpdate,Sb=qb.tangentsNeedUpdate,Xb=qb.colorsNeedUpdate,Yb=qb.morphTargetsNeedUpdate,cc=qb.vertices,sa=D.faces3,ta=D.faces4,kb=qb.faces,Jb=qb.faceVertexUvs[0],Lb=qb.faceVertexUvs[1],dc=qb.skinIndices,$b=qb.skinWeights,ac=qb.morphTargets,Ib=qb.morphNormals;
|
|
|
+if(qb.verticesNeedUpdate){E=0;for(C=sa.length;E<C;E++)Q=kb[sa[E]],R=cc[Q.a],S=cc[Q.b],P=cc[Q.c],db[Za]=R.x,db[Za+1]=R.y,db[Za+2]=R.z,db[Za+3]=S.x,db[Za+4]=S.y,db[Za+5]=S.z,db[Za+6]=P.x,db[Za+7]=P.y,db[Za+8]=P.z,Za+=9;E=0;for(C=ta.length;E<C;E++)Q=kb[ta[E]],R=cc[Q.a],S=cc[Q.b],P=cc[Q.c],ba=cc[Q.d],db[Za]=R.x,db[Za+1]=R.y,db[Za+2]=R.z,db[Za+3]=S.x,db[Za+4]=S.y,db[Za+5]=S.z,db[Za+6]=P.x,db[Za+7]=P.y,db[Za+8]=P.z,db[Za+9]=ba.x,db[Za+10]=ba.y,db[Za+11]=ba.z,Za+=12;k.bindBuffer(k.ARRAY_BUFFER,D.__webglVertexBuffer);
|
|
|
+k.bufferData(k.ARRAY_BUFFER,db,H)}if(Yb){cb=0;for(bb=ac.length;cb<bb;cb++){E=ga=0;for(C=sa.length;E<C;E++)Va=sa[E],Q=kb[Va],R=ac[cb].vertices[Q.a],S=ac[cb].vertices[Q.b],P=ac[cb].vertices[Q.c],$a=yb[cb],$a[ga]=R.x,$a[ga+1]=R.y,$a[ga+2]=R.z,$a[ga+3]=S.x,$a[ga+4]=S.y,$a[ga+5]=S.z,$a[ga+6]=P.x,$a[ga+7]=P.y,$a[ga+8]=P.z,J.morphNormals&&(M?(Qa=Ib[cb].vertexNormals[Va],Ha=Qa.a,ha=Qa.b,Ua=Qa.c):Ua=ha=Ha=Ib[cb].faceNormals[Va],ab=Ab[cb],ab[ga]=Ha.x,ab[ga+1]=Ha.y,ab[ga+2]=Ha.z,ab[ga+3]=ha.x,ab[ga+4]=ha.y,
|
|
|
+ab[ga+5]=ha.z,ab[ga+6]=Ua.x,ab[ga+7]=Ua.y,ab[ga+8]=Ua.z),ga+=9;E=0;for(C=ta.length;E<C;E++)Va=ta[E],Q=kb[Va],R=ac[cb].vertices[Q.a],S=ac[cb].vertices[Q.b],P=ac[cb].vertices[Q.c],ba=ac[cb].vertices[Q.d],$a=yb[cb],$a[ga]=R.x,$a[ga+1]=R.y,$a[ga+2]=R.z,$a[ga+3]=S.x,$a[ga+4]=S.y,$a[ga+5]=S.z,$a[ga+6]=P.x,$a[ga+7]=P.y,$a[ga+8]=P.z,$a[ga+9]=ba.x,$a[ga+10]=ba.y,$a[ga+11]=ba.z,J.morphNormals&&(M?(Qa=Ib[cb].vertexNormals[Va],Ha=Qa.a,ha=Qa.b,Ua=Qa.c,qa=Qa.d):qa=Ua=ha=Ha=Ib[cb].faceNormals[Va],ab=Ab[cb],ab[ga]=
|
|
|
+Ha.x,ab[ga+1]=Ha.y,ab[ga+2]=Ha.z,ab[ga+3]=ha.x,ab[ga+4]=ha.y,ab[ga+5]=ha.z,ab[ga+6]=Ua.x,ab[ga+7]=Ua.y,ab[ga+8]=Ua.z,ab[ga+9]=qa.x,ab[ga+10]=qa.y,ab[ga+11]=qa.z),ga+=12;k.bindBuffer(k.ARRAY_BUFFER,D.__webglMorphTargetsBuffers[cb]);k.bufferData(k.ARRAY_BUFFER,yb[cb],H);J.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,D.__webglMorphNormalsBuffers[cb]),k.bufferData(k.ARRAY_BUFFER,Ab[cb],H))}}if($b.length){E=0;for(C=sa.length;E<C;E++)Q=kb[sa[E]],na=$b[Q.a],oa=$b[Q.b],ra=$b[Q.c],Na[X]=na.x,Na[X+1]=na.y,Na[X+
|
|
|
+2]=na.z,Na[X+3]=na.w,Na[X+4]=oa.x,Na[X+5]=oa.y,Na[X+6]=oa.z,Na[X+7]=oa.w,Na[X+8]=ra.x,Na[X+9]=ra.y,Na[X+10]=ra.z,Na[X+11]=ra.w,va=dc[Q.a],wa=dc[Q.b],xa=dc[Q.c],Ma[X]=va.x,Ma[X+1]=va.y,Ma[X+2]=va.z,Ma[X+3]=va.w,Ma[X+4]=wa.x,Ma[X+5]=wa.y,Ma[X+6]=wa.z,Ma[X+7]=wa.w,Ma[X+8]=xa.x,Ma[X+9]=xa.y,Ma[X+10]=xa.z,Ma[X+11]=xa.w,X+=12;E=0;for(C=ta.length;E<C;E++)Q=kb[ta[E]],na=$b[Q.a],oa=$b[Q.b],ra=$b[Q.c],Ca=$b[Q.d],Na[X]=na.x,Na[X+1]=na.y,Na[X+2]=na.z,Na[X+3]=na.w,Na[X+4]=oa.x,Na[X+5]=oa.y,Na[X+6]=oa.z,Na[X+7]=
|
|
|
+oa.w,Na[X+8]=ra.x,Na[X+9]=ra.y,Na[X+10]=ra.z,Na[X+11]=ra.w,Na[X+12]=Ca.x,Na[X+13]=Ca.y,Na[X+14]=Ca.z,Na[X+15]=Ca.w,va=dc[Q.a],wa=dc[Q.b],xa=dc[Q.c],pb=dc[Q.d],Ma[X]=va.x,Ma[X+1]=va.y,Ma[X+2]=va.z,Ma[X+3]=va.w,Ma[X+4]=wa.x,Ma[X+5]=wa.y,Ma[X+6]=wa.z,Ma[X+7]=wa.w,Ma[X+8]=xa.x,Ma[X+9]=xa.y,Ma[X+10]=xa.z,Ma[X+11]=xa.w,Ma[X+12]=pb.x,Ma[X+13]=pb.y,Ma[X+14]=pb.z,Ma[X+15]=pb.w,X+=16;0<X&&(k.bindBuffer(k.ARRAY_BUFFER,D.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,Ma,H),k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+D.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Na,H))}if(Xb&&K){E=0;for(C=sa.length;E<C;E++)Q=kb[sa[E]],T=Q.vertexColors,Y=Q.color,3===T.length&&K===THREE.VertexColors?(la=T[0],ia=T[1],ka=T[2]):ka=ia=la=Y,eb[Wa]=la.r,eb[Wa+1]=la.g,eb[Wa+2]=la.b,eb[Wa+3]=ia.r,eb[Wa+4]=ia.g,eb[Wa+5]=ia.b,eb[Wa+6]=ka.r,eb[Wa+7]=ka.g,eb[Wa+8]=ka.b,Wa+=9;E=0;for(C=ta.length;E<C;E++)Q=kb[ta[E]],T=Q.vertexColors,Y=Q.color,4===T.length&&K===THREE.VertexColors?(la=T[0],ia=T[1],ka=T[2],ua=T[3]):ua=ka=ia=la=Y,eb[Wa]=
|
|
|
+la.r,eb[Wa+1]=la.g,eb[Wa+2]=la.b,eb[Wa+3]=ia.r,eb[Wa+4]=ia.g,eb[Wa+5]=ia.b,eb[Wa+6]=ka.r,eb[Wa+7]=ka.g,eb[Wa+8]=ka.b,eb[Wa+9]=ua.r,eb[Wa+10]=ua.g,eb[Wa+11]=ua.b,Wa+=12;0<Wa&&(k.bindBuffer(k.ARRAY_BUFFER,D.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,eb,H))}if(Sb&&qb.hasTangents){E=0;for(C=sa.length;E<C;E++)Q=kb[sa[E]],pa=Q.vertexTangents,Z=pa[0],da=pa[1],ya=pa[2],La[Da]=Z.x,La[Da+1]=Z.y,La[Da+2]=Z.z,La[Da+3]=Z.w,La[Da+4]=da.x,La[Da+5]=da.y,La[Da+6]=da.z,La[Da+7]=da.w,La[Da+8]=ya.x,La[Da+9]=ya.y,
|
|
|
+La[Da+10]=ya.z,La[Da+11]=ya.w,Da+=12;E=0;for(C=ta.length;E<C;E++)Q=kb[ta[E]],pa=Q.vertexTangents,Z=pa[0],da=pa[1],ya=pa[2],ma=pa[3],La[Da]=Z.x,La[Da+1]=Z.y,La[Da+2]=Z.z,La[Da+3]=Z.w,La[Da+4]=da.x,La[Da+5]=da.y,La[Da+6]=da.z,La[Da+7]=da.w,La[Da+8]=ya.x,La[Da+9]=ya.y,La[Da+10]=ya.z,La[Da+11]=ya.w,La[Da+12]=ma.x,La[Da+13]=ma.y,La[Da+14]=ma.z,La[Da+15]=ma.w,Da+=16;k.bindBuffer(k.ARRAY_BUFFER,D.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,La,H)}if(Rb&&V){E=0;for(C=sa.length;E<C;E++)if(Q=kb[sa[E]],
|
|
|
+O=Q.vertexNormals,ea=Q.normal,3===O.length&&M)for(za=0;3>za;za++)Fa=O[za],Sa[jb]=Fa.x,Sa[jb+1]=Fa.y,Sa[jb+2]=Fa.z,jb+=3;else for(za=0;3>za;za++)Sa[jb]=ea.x,Sa[jb+1]=ea.y,Sa[jb+2]=ea.z,jb+=3;E=0;for(C=ta.length;E<C;E++)if(Q=kb[ta[E]],O=Q.vertexNormals,ea=Q.normal,4===O.length&&M)for(za=0;4>za;za++)Fa=O[za],Sa[jb]=Fa.x,Sa[jb+1]=Fa.y,Sa[jb+2]=Fa.z,jb+=3;else for(za=0;4>za;za++)Sa[jb]=ea.x,Sa[jb+1]=ea.y,Sa[jb+2]=ea.z,jb+=3;k.bindBuffer(k.ARRAY_BUFFER,D.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,
|
|
|
+Sa,H)}if(Hb&&Jb&&L){E=0;for(C=sa.length;E<C;E++)if(N=sa[E],fa=Jb[N],void 0!==fa)for(za=0;3>za;za++)Pa=fa[za],fb[Xa]=Pa.x,fb[Xa+1]=Pa.y,Xa+=2;E=0;for(C=ta.length;E<C;E++)if(N=ta[E],fa=Jb[N],void 0!==fa)for(za=0;4>za;za++)Pa=fa[za],fb[Xa]=Pa.x,fb[Xa+1]=Pa.y,Xa+=2;0<Xa&&(k.bindBuffer(k.ARRAY_BUFFER,D.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,fb,H))}if(Hb&&Lb&&L){E=0;for(C=sa.length;E<C;E++)if(N=sa[E],aa=Lb[N],void 0!==aa)for(za=0;3>za;za++)Ra=aa[za],ib[Ya]=Ra.x,ib[Ya+1]=Ra.y,Ya+=2;E=0;for(C=ta.length;E<
|
|
|
+C;E++)if(N=ta[E],aa=Lb[N],void 0!==aa)for(za=0;4>za;za++)Ra=aa[za],ib[Ya]=Ra.x,ib[Ya+1]=Ra.y,Ya+=2;0<Ya&&(k.bindBuffer(k.ARRAY_BUFFER,D.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ib,H))}if(Gb){E=0;for(C=sa.length;E<C;E++)Mb[Ka]=Ta,Mb[Ka+1]=Ta+1,Mb[Ka+2]=Ta+2,Ka+=3,wb[ob]=Ta,wb[ob+1]=Ta+1,wb[ob+2]=Ta,wb[ob+3]=Ta+2,wb[ob+4]=Ta+1,wb[ob+5]=Ta+2,ob+=6,Ta+=3;E=0;for(C=ta.length;E<C;E++)Mb[Ka]=Ta,Mb[Ka+1]=Ta+1,Mb[Ka+2]=Ta+3,Mb[Ka+3]=Ta+1,Mb[Ka+4]=Ta+2,Mb[Ka+5]=Ta+3,Ka+=6,wb[ob]=Ta,wb[ob+1]=Ta+1,wb[ob+
|
|
|
+2]=Ta,wb[ob+3]=Ta+3,wb[ob+4]=Ta+1,wb[ob+5]=Ta+2,wb[ob+6]=Ta+2,wb[ob+7]=Ta+3,ob+=8,Ta+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,D.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Mb,H);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,D.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,wb,H)}if(Bb){za=0;for(ub=Bb.length;za<ub;za++)if(u=Bb[za],u.__original.needsUpdate){x=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(C=sa.length;E<C;E++)Q=kb[sa[E]],u.array[x]=u.value[Q.a],u.array[x+
|
|
|
+1]=u.value[Q.b],u.array[x+2]=u.value[Q.c],x+=3;E=0;for(C=ta.length;E<C;E++)Q=kb[ta[E]],u.array[x]=u.value[Q.a],u.array[x+1]=u.value[Q.b],u.array[x+2]=u.value[Q.c],u.array[x+3]=u.value[Q.d],x+=4}else{if("faces"===u.boundTo){E=0;for(C=sa.length;E<C;E++)Aa=u.value[sa[E]],u.array[x]=Aa,u.array[x+1]=Aa,u.array[x+2]=Aa,x+=3;E=0;for(C=ta.length;E<C;E++)Aa=u.value[ta[E]],u.array[x]=Aa,u.array[x+1]=Aa,u.array[x+2]=Aa,u.array[x+3]=Aa,x+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=
|
|
|
+0;for(C=sa.length;E<C;E++)Q=kb[sa[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=S.x,u.array[x+3]=S.y,u.array[x+4]=P.x,u.array[x+5]=P.y,x+=6;E=0;for(C=ta.length;E<C;E++)Q=kb[ta[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],ba=u.value[Q.d],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=S.x,u.array[x+3]=S.y,u.array[x+4]=P.x,u.array[x+5]=P.y,u.array[x+6]=ba.x,u.array[x+7]=ba.y,x+=8}else{if("faces"===u.boundTo){E=0;for(C=sa.length;E<C;E++)P=S=R=Aa=u.value[sa[E]],
|
|
|
+u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=S.x,u.array[x+3]=S.y,u.array[x+4]=P.x,u.array[x+5]=P.y,x+=6;E=0;for(C=ta.length;E<C;E++)ba=P=S=R=Aa=u.value[ta[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=S.x,u.array[x+3]=S.y,u.array[x+4]=P.x,u.array[x+5]=P.y,u.array[x+6]=ba.x,u.array[x+7]=ba.y,x+=8}}else if(3===u.size){var W;W="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(C=sa.length;E<C;E++)Q=kb[sa[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],
|
|
|
+u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],x+=9;E=0;for(C=ta.length;E<C;E++)Q=kb[ta[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],ba=u.value[Q.d],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],u.array[x+9]=ba[W[0]],
|
|
|
+u.array[x+10]=ba[W[1]],u.array[x+11]=ba[W[2]],x+=12}else if("faces"===u.boundTo){E=0;for(C=sa.length;E<C;E++)P=S=R=Aa=u.value[sa[E]],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],x+=9;E=0;for(C=ta.length;E<C;E++)ba=P=S=R=Aa=u.value[ta[E]],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],
|
|
|
+u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],u.array[x+9]=ba[W[0]],u.array[x+10]=ba[W[1]],u.array[x+11]=ba[W[2]],x+=12}else if("faceVertices"===u.boundTo){E=0;for(C=sa.length;E<C;E++)Aa=u.value[sa[E]],R=Aa[0],S=Aa[1],P=Aa[2],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],x+=9;E=0;for(C=ta.length;E<C;E++)Aa=u.value[ta[E]],R=Aa[0],S=Aa[1],P=Aa[2],
|
|
|
+ba=Aa[3],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],u.array[x+9]=ba[W[0]],u.array[x+10]=ba[W[1]],u.array[x+11]=ba[W[2]],x+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(C=sa.length;E<C;E++)Q=kb[sa[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=
|
|
|
+S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,x+=12;E=0;for(C=ta.length;E<C;E++)Q=kb[ta[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],ba=u.value[Q.d],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,u.array[x+12]=ba.x,u.array[x+13]=ba.y,u.array[x+14]=ba.z,u.array[x+
|
|
|
+15]=ba.w,x+=16}else if("faces"===u.boundTo){E=0;for(C=sa.length;E<C;E++)P=S=R=Aa=u.value[sa[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,x+=12;E=0;for(C=ta.length;E<C;E++)ba=P=S=R=Aa=u.value[ta[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+
|
|
|
+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,u.array[x+12]=ba.x,u.array[x+13]=ba.y,u.array[x+14]=ba.z,u.array[x+15]=ba.w,x+=16}else if("faceVertices"===u.boundTo){E=0;for(C=sa.length;E<C;E++)Aa=u.value[sa[E]],R=Aa[0],S=Aa[1],P=Aa[2],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,x+=12;E=0;for(C=ta.length;E<C;E++)Aa=u.value[ta[E]],
|
|
|
+R=Aa[0],S=Aa[1],P=Aa[2],ba=Aa[3],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,u.array[x+12]=ba.x,u.array[x+13]=ba.y,u.array[x+14]=ba.z,u.array[x+15]=ba.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,u.buffer);k.bufferData(k.ARRAY_BUFFER,u.array,H)}}I&&(delete D.__inittedArrays,delete D.__colorArray,delete D.__normalArray,delete D.__tangentArray,delete D.__uvArray,
|
|
|
+delete D.__uv2Array,delete D.__faceArray,delete D.__vertexArray,delete D.__lineArray,delete D.__skinIndexArray,delete D.__skinWeightArray)}}j.verticesNeedUpdate=!1;j.morphTargetsNeedUpdate=!1;j.elementsNeedUpdate=!1;j.uvsNeedUpdate=!1;j.normalsNeedUpdate=!1;j.colorsNeedUpdate=!1;j.tangentsNeedUpdate=!1;j.buffersNeedUpdate=!1;n.attributes&&q(n)}else if(i instanceof THREE.Ribbon){n=e(i,j);p=n.attributes&&s(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.normalsNeedUpdate||p){var Cb=j,Kb=k.DYNAMIC_DRAW,
|
|
|
+nc=void 0,oc=void 0,pc=void 0,Tb=void 0,Ba=void 0,Ub=void 0,xc=void 0,yc=void 0,jc=void 0,gb=void 0,gc=void 0,Ia=void 0,rb=void 0,kc=Cb.vertices,lc=Cb.colors,mc=Cb.normals,uc=kc.length,vc=lc.length,Yc=mc.length,zc=Cb.__vertexArray,Ac=Cb.__colorArray,Bc=Cb.__normalArray,Zc=Cb.colorsNeedUpdate,$c=Cb.normalsNeedUpdate,Lc=Cb.__webglCustomAttributesList;if(Cb.verticesNeedUpdate){for(nc=0;nc<uc;nc++)Tb=kc[nc],Ba=3*nc,zc[Ba]=Tb.x,zc[Ba+1]=Tb.y,zc[Ba+2]=Tb.z;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglVertexBuffer);
|
|
|
+k.bufferData(k.ARRAY_BUFFER,zc,Kb)}if(Zc){for(oc=0;oc<vc;oc++)Ub=lc[oc],Ba=3*oc,Ac[Ba]=Ub.r,Ac[Ba+1]=Ub.g,Ac[Ba+2]=Ub.b;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Ac,Kb)}if($c){for(pc=0;pc<Yc;pc++)xc=mc[pc],Ba=3*pc,Bc[Ba]=xc.x,Bc[Ba+1]=xc.y,Bc[Ba+2]=xc.z;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,Bc,Kb)}if(Lc){yc=0;for(jc=Lc.length;yc<jc;yc++)if(Ia=Lc[yc],Ia.needsUpdate&&(void 0===Ia.boundTo||"vertices"===Ia.boundTo)){Ba=0;gc=
|
|
|
+Ia.value.length;if(1===Ia.size)for(gb=0;gb<gc;gb++)Ia.array[gb]=Ia.value[gb];else if(2===Ia.size)for(gb=0;gb<gc;gb++)rb=Ia.value[gb],Ia.array[Ba]=rb.x,Ia.array[Ba+1]=rb.y,Ba+=2;else if(3===Ia.size)if("c"===Ia.type)for(gb=0;gb<gc;gb++)rb=Ia.value[gb],Ia.array[Ba]=rb.r,Ia.array[Ba+1]=rb.g,Ia.array[Ba+2]=rb.b,Ba+=3;else for(gb=0;gb<gc;gb++)rb=Ia.value[gb],Ia.array[Ba]=rb.x,Ia.array[Ba+1]=rb.y,Ia.array[Ba+2]=rb.z,Ba+=3;else if(4===Ia.size)for(gb=0;gb<gc;gb++)rb=Ia.value[gb],Ia.array[Ba]=rb.x,Ia.array[Ba+
|
|
|
+1]=rb.y,Ia.array[Ba+2]=rb.z,Ia.array[Ba+3]=rb.w,Ba+=4;k.bindBuffer(k.ARRAY_BUFFER,Ia.buffer);k.bufferData(k.ARRAY_BUFFER,Ia.array,Kb)}}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;j.normalsNeedUpdate=!1;n.attributes&&q(n)}else if(i instanceof THREE.Line){n=e(i,j);p=n.attributes&&s(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.lineDistancesNeedUpdate||p){var Db=j,Cc=k.DYNAMIC_DRAW,qc=void 0,rc=void 0,sc=void 0,Dc=void 0,Oa=void 0,Ec=void 0,Qc=Db.vertices,Rc=Db.colors,Sc=Db.lineDistances,ad=Qc.length,
|
|
|
+bd=Rc.length,cd=Sc.length,Fc=Db.__vertexArray,Gc=Db.__colorArray,Tc=Db.__lineDistanceArray,dd=Db.colorsNeedUpdate,ed=Db.lineDistancesNeedUpdate,Mc=Db.__webglCustomAttributesList,Hc=void 0,Uc=void 0,hb=void 0,hc=void 0,sb=void 0,Ja=void 0;if(Db.verticesNeedUpdate){for(qc=0;qc<ad;qc++)Dc=Qc[qc],Oa=3*qc,Fc[Oa]=Dc.x,Fc[Oa+1]=Dc.y,Fc[Oa+2]=Dc.z;k.bindBuffer(k.ARRAY_BUFFER,Db.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Fc,Cc)}if(dd){for(rc=0;rc<bd;rc++)Ec=Rc[rc],Oa=3*rc,Gc[Oa]=Ec.r,Gc[Oa+1]=Ec.g,Gc[Oa+
|
|
|
+2]=Ec.b;k.bindBuffer(k.ARRAY_BUFFER,Db.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Gc,Cc)}if(ed){for(sc=0;sc<cd;sc++)Tc[sc]=Sc[sc];k.bindBuffer(k.ARRAY_BUFFER,Db.__webglLineDistanceBuffer);k.bufferData(k.ARRAY_BUFFER,Tc,Cc)}if(Mc){Hc=0;for(Uc=Mc.length;Hc<Uc;Hc++)if(Ja=Mc[Hc],Ja.needsUpdate&&(void 0===Ja.boundTo||"vertices"===Ja.boundTo)){Oa=0;hc=Ja.value.length;if(1===Ja.size)for(hb=0;hb<hc;hb++)Ja.array[hb]=Ja.value[hb];else if(2===Ja.size)for(hb=0;hb<hc;hb++)sb=Ja.value[hb],Ja.array[Oa]=sb.x,
|
|
|
+Ja.array[Oa+1]=sb.y,Oa+=2;else if(3===Ja.size)if("c"===Ja.type)for(hb=0;hb<hc;hb++)sb=Ja.value[hb],Ja.array[Oa]=sb.r,Ja.array[Oa+1]=sb.g,Ja.array[Oa+2]=sb.b,Oa+=3;else for(hb=0;hb<hc;hb++)sb=Ja.value[hb],Ja.array[Oa]=sb.x,Ja.array[Oa+1]=sb.y,Ja.array[Oa+2]=sb.z,Oa+=3;else if(4===Ja.size)for(hb=0;hb<hc;hb++)sb=Ja.value[hb],Ja.array[Oa]=sb.x,Ja.array[Oa+1]=sb.y,Ja.array[Oa+2]=sb.z,Ja.array[Oa+3]=sb.w,Oa+=4;k.bindBuffer(k.ARRAY_BUFFER,Ja.buffer);k.bufferData(k.ARRAY_BUFFER,Ja.array,Cc)}}}j.verticesNeedUpdate=
|
|
|
+!1;j.colorsNeedUpdate=!1;j.lineDistancesNeedUpdate=!1;n.attributes&&q(n)}else if(i instanceof THREE.ParticleSystem){n=e(i,j);p=n.attributes&&s(n);if(j.verticesNeedUpdate||j.colorsNeedUpdate||i.sortParticles||p){var Nb=j,Nc=k.DYNAMIC_DRAW,tc=i,tb=void 0,Ob=void 0,Pb=void 0,ca=void 0,Qb=void 0,bc=void 0,Ic=Nb.vertices,Oc=Ic.length,Pc=Nb.colors,Vc=Pc.length,ec=Nb.__vertexArray,fc=Nb.__colorArray,Vb=Nb.__sortArray,Wc=Nb.verticesNeedUpdate,Xc=Nb.colorsNeedUpdate,Wb=Nb.__webglCustomAttributesList,Eb=void 0,
|
|
|
+ic=void 0,ja=void 0,Fb=void 0,Ea=void 0,$=void 0;if(tc.sortParticles){lb.copy(xb);lb.multiply(tc.matrixWorld);for(tb=0;tb<Oc;tb++)Pb=Ic[tb],Ga.copy(Pb),Ga.applyProjection(lb),Vb[tb]=[Ga.z,tb];Vb.sort(m);for(tb=0;tb<Oc;tb++)Pb=Ic[Vb[tb][1]],ca=3*tb,ec[ca]=Pb.x,ec[ca+1]=Pb.y,ec[ca+2]=Pb.z;for(Ob=0;Ob<Vc;Ob++)ca=3*Ob,bc=Pc[Vb[Ob][1]],fc[ca]=bc.r,fc[ca+1]=bc.g,fc[ca+2]=bc.b;if(Wb){Eb=0;for(ic=Wb.length;Eb<ic;Eb++)if($=Wb[Eb],void 0===$.boundTo||"vertices"===$.boundTo)if(ca=0,Fb=$.value.length,1===$.size)for(ja=
|
|
|
+0;ja<Fb;ja++)Qb=Vb[ja][1],$.array[ja]=$.value[Qb];else if(2===$.size)for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,ca+=2;else if(3===$.size)if("c"===$.type)for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.r,$.array[ca+1]=Ea.g,$.array[ca+2]=Ea.b,ca+=3;else for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,ca+=3;else if(4===$.size)for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.x,
|
|
|
+$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,$.array[ca+3]=Ea.w,ca+=4}}else{if(Wc)for(tb=0;tb<Oc;tb++)Pb=Ic[tb],ca=3*tb,ec[ca]=Pb.x,ec[ca+1]=Pb.y,ec[ca+2]=Pb.z;if(Xc)for(Ob=0;Ob<Vc;Ob++)bc=Pc[Ob],ca=3*Ob,fc[ca]=bc.r,fc[ca+1]=bc.g,fc[ca+2]=bc.b;if(Wb){Eb=0;for(ic=Wb.length;Eb<ic;Eb++)if($=Wb[Eb],$.needsUpdate&&(void 0===$.boundTo||"vertices"===$.boundTo))if(Fb=$.value.length,ca=0,1===$.size)for(ja=0;ja<Fb;ja++)$.array[ja]=$.value[ja];else if(2===$.size)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,
|
|
|
+$.array[ca+1]=Ea.y,ca+=2;else if(3===$.size)if("c"===$.type)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.r,$.array[ca+1]=Ea.g,$.array[ca+2]=Ea.b,ca+=3;else for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,ca+=3;else if(4===$.size)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,$.array[ca+3]=Ea.w,ca+=4}}if(Wc||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,ec,Nc);
|
|
|
+if(Xc||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,fc,Nc);if(Wb){Eb=0;for(ic=Wb.length;Eb<ic;Eb++)if($=Wb[Eb],$.needsUpdate||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,$.buffer),k.bufferData(k.ARRAY_BUFFER,$.array,Nc)}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;n.attributes&&q(n)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",uc);var i,j,l,p,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?
|
|
|
+m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var r,q,s;e=h=q=s=n=0;for(f=b.length;e<f;e++)r=
|
|
|
+b[e],r.onlyShadow||(r instanceof THREE.DirectionalLight&&h++,r instanceof THREE.PointLight&&q++,r instanceof THREE.SpotLight&&s++,r instanceof THREE.HemisphereLight&&n++);e=h;f=q;h=s;g=n;n=r=0;for(s=b.length;n<s;n++)q=b[n],q.castShadow&&(q instanceof THREE.SpotLight&&r++,q instanceof THREE.DirectionalLight&&!q.shadowCascade&&r++);p=r;Bb&&d&&d.useVertexTexture?l=1024:(b=k.getParameter(k.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)")),l=b);a:{s=a.fragmentShader;q=a.vertexShader;n=a.uniforms;b=a.attributes;r=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:l,
|
|
|
+useVertexTexture:Bb&&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:h,maxHemiLights:g,maxShadows:p,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,y,d=[];m?d.push(m):(d.push(s),d.push(q));for(v in r)d.push(v),d.push(r[v]);for(t in c)d.push(t),d.push(c[t]);m=d.join();t=0;for(v=V.length;t<v;t++)if(d=V[t],d.code===m){d.usedTimes++;j=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(y in r)d=
|
|
|
+r[y],!1!==d&&(d="#define "+y+" "+d,v.push(d));d=v.join("\n");y=k.createProgram();v=["precision "+K+" float;",d,Gb?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.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):"",
|
|
|
+c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+t=["precision "+K+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#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,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",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.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
|
-"",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");u=O("vertex",u+s);t=O("fragment",t+r);k.attachShader(w,u);k.attachShader(w,t);k.linkProgram(w);k.getProgramParameter(w,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(w,k.VALIDATE_STATUS)+", gl error ["+
|
|
|
-k.getError()+"]");k.deleteShader(t);k.deleteShader(u);w.uniforms={};w.attributes={};var y;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(y in p)t.push(y);y=t;t=0;for(u=y.length;t<u;t++)p=y[t],w.uniforms[p]=k.getUniformLocation(w,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(y=0;y<c.maxMorphTargets;y++)t.push("morphTarget"+
|
|
|
-y);for(y=0;y<c.maxMorphNormals;y++)t.push("morphNormal"+y);for(j in b)t.push(j);j=t;y=0;for(b=j.length;y<b;y++)t=j[y],w.attributes[t]=k.getAttribLocation(w,t);w.id=Wa++;ea.push({program:w,code:n,usedTimes:1});L.info.memory.programs=ea.length;j=w}a.program=j;y=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(j=0;j<this.maxMorphTargets;j++)w=b+j,0<=y[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(j=0;j<this.maxMorphNormals;j++)w=
|
|
|
-b+j,0<=y[w]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?k.disable(k.CULL_FACE):(b===THREE.FrontFaceDirectionCW?k.frontFace(k.CW):k.frontFace(k.CCW),a===THREE.CullFaceBack?k.cullFace(k.BACK):a===THREE.CullFaceFront?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;V!==
|
|
|
-b&&(b?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),V=b);$!==a&&(a?k.frontFace(k.CW):k.frontFace(k.CCW),$=a)};this.setDepthTest=function(a){kb!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),kb=a)};this.setDepthWrite=function(a){oa!==a&&(k.depthMask(a),oa=a)};this.setBlending=function(a,b,c,d){a!==la&&(a===THREE.NoBlending?k.disable(k.BLEND):a===THREE.AdditiveBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.SRC_ALPHA,k.ONE)):a===THREE.SubtractiveBlending?(k.enable(k.BLEND),
|
|
|
-k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.SRC_COLOR)):a===THREE.CustomBlending?k.enable(k.BLEND):(k.enable(k.BLEND),k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)),la=a);if(a===THREE.CustomBlending){if(b!==ha&&(k.blendEquation(A(b)),ha=b),c!==ia||d!==Qa)k.blendFunc(A(c),A(d)),ia=c,Qa=d}else Qa=
|
|
|
-ia=ha=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",oc),a.__webglTexture=k.createTexture(),L.info.memory.textures++);k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);k.pixelStorei(k.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=A(a.format),
|
|
|
-f=A(a.type);C(k.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],k.texImage2D(k.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else k.texImage2D(k.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],k.compressedTexImage2D(k.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],k.texImage2D(k.TEXTURE_2D,
|
|
|
-h,e,e,f,c);a.generateMipmaps=!1}else k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.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",P);a.__webglTexture=
|
|
|
-k.createTexture();L.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);C(k.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);H(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=k.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),C(k.TEXTURE_2D,a,c),k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),
|
|
|
-k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):H(a.__webglRenderbuffer,a),c&&k.generateMipmap(k.TEXTURE_2D);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,
|
|
|
-null);k.bindFramebuffer(k.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Kb,a=Ob,d=tb,e=Nb);b!==fb&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),fb=b);Tb=c;Ub=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){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:
|
|
|
+"",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");v=J("vertex",v+q);t=J("fragment",t+s);k.attachShader(y,v);k.attachShader(y,t);k.linkProgram(y);k.getProgramParameter(y,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(y,k.VALIDATE_STATUS)+", gl error ["+
|
|
|
+k.getError()+"]");k.deleteShader(t);k.deleteShader(v);y.uniforms={};y.attributes={};var w;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(w in n)t.push(w);w=t;t=0;for(v=w.length;t<v;t++)n=w[t],y.uniforms[n]=k.getUniformLocation(y,n);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(j in b)t.push(j);j=t;w=0;for(b=j.length;w<b;w++)t=j[w],y.attributes[t]=k.getAttribLocation(y,t);y.id=ea++;V.push({program:y,code:m,usedTimes:1});M.info.memory.programs=V.length;j=y}a.program=j;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(j=0;j<this.maxMorphTargets;j++)y=b+j,0<=w[y]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(j=0;j<this.maxMorphNormals;j++)y=
|
|
|
+b+j,0<=w[y]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?k.disable(k.CULL_FACE):(b===THREE.FrontFaceDirectionCW?k.frontFace(k.CW):k.frontFace(k.CCW),a===THREE.CullFaceBack?k.cullFace(k.BACK):a===THREE.CullFaceFront?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;da!==
|
|
|
+b&&(b?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),da=b);T!==a&&(a?k.frontFace(k.CW):k.frontFace(k.CCW),T=a)};this.setDepthTest=function(a){xa!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),xa=a)};this.setDepthWrite=function(a){bb!==a&&(k.depthMask(a),bb=a)};this.setBlending=function(a,b,c,d){a!==aa&&(a===THREE.NoBlending?k.disable(k.BLEND):a===THREE.AdditiveBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.SRC_ALPHA,k.ONE)):a===THREE.SubtractiveBlending?(k.enable(k.BLEND),
|
|
|
+k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.SRC_COLOR)):a===THREE.CustomBlending?k.enable(k.BLEND):(k.enable(k.BLEND),k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)),aa=a);if(a===THREE.CustomBlending){if(b!==la&&(k.blendEquation(w(b)),la=b),c!==Y||d!==ma)k.blendFunc(w(c),w(d)),Y=c,ma=d}else ma=Y=
|
|
|
+la=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",lc),a.__webglTexture=k.createTexture(),M.info.memory.textures++);k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);k.pixelStorei(k.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=w(a.format),
|
|
|
+f=w(a.type);N(k.TEXTURE_2D,a,d);var h=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<h.length&&d){for(var g=0,i=h.length;g<i;g++)c=h[g],k.texImage2D(k.TEXTURE_2D,g,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){g=0;for(i=h.length;g<i;g++)c=h[g],k.compressedTexImage2D(k.TEXTURE_2D,g,e,c.width,c.height,0,c.data)}else if(0<h.length&&d){g=0;for(i=h.length;g<i;g++)c=h[g],k.texImage2D(k.TEXTURE_2D,
|
|
|
+g,e,e,f,c);a.generateMipmaps=!1}else k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.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",mc);a.__webglTexture=
|
|
|
+k.createTexture();M.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=w(a.format),e=w(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);N(k.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,g=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,
|
|
|
+a.__webglFramebuffer[f]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,g,h.__webglTexture,0);z(a.__webglRenderbuffer[f],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=k.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),N(k.TEXTURE_2D,a,c),k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),
|
|
|
+k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a.__webglRenderbuffer):z(a.__webglRenderbuffer,a),c&&k.generateMipmap(k.TEXTURE_2D);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,
|
|
|
+null);k.bindFramebuffer(k.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Qa,a=Ya,d=ua,e=Ra);b!==Ua&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),Ua=b);Xb=c;Jb=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){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={constructor:THREE.WebGLRenderTarget,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,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},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.vertexColors=[new THREE.Color,new THREE.Color];this.material=null};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,i=g.vertices,j=a.faces,l=g.faces,a=a.faceVertexUvs[0],g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,n=i.length;b<n;b++){var m=i[b].clone();d&&m.applyMatrix4(d);h.push(m)}b=0;for(n=l.length;b<n;b++){var m=l[b],p,t,r=m.vertexNormals,q=m.vertexColors;m instanceof
|
|
|
-THREE.Face3?p=new THREE.Face3(m.a+f,m.b+f,m.c+f):m instanceof THREE.Face4&&(p=new THREE.Face4(m.a+f,m.b+f,m.c+f,m.d+f));p.normal.copy(m.normal);e&&p.normal.applyMatrix3(e).normalize();h=0;for(i=r.length;h<i;h++)t=r[h].clone(),e&&t.applyMatrix3(e).normalize(),p.vertexNormals.push(t);p.color.copy(m.color);h=0;for(i=q.length;h<i;h++)t=q[h],p.vertexColors.push(t.clone());p.materialIndex=m.materialIndex+c;p.centroid.copy(m.centroid);d&&p.centroid.applyMatrix4(d);j.push(p)}b=0;for(n=g.length;b<n;b++){c=
|
|
|
-g[b];d=[];h=0;for(i=c.length;h<i;h++)d.push(new THREE.Vector2(c[h].x,c[h].y));a.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,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],l,n,m,p;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?
|
|
|
-(l=g[d.a],n=g[d.b],m=g[d.c],d._area=THREE.GeometryUtils.triangleArea(l,n,m)):d instanceof THREE.Face4&&(l=g[d.a],n=g[d.b],m=g[d.c],p=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(l,n,p),d._area2=THREE.GeometryUtils.triangleArea(n,m,p),d._area=d._area1+d._area2),i+=d._area,j[e]=i;d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d=THREE.GeometryUtils.__v1,e=THREE.GeometryUtils.__v2;d.subVectors(b,
|
|
|
+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.vertexColors=[new THREE.Color,new THREE.Color];this.material=null};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,j=a.faces,m=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,p=i.length;b<p;b++){var l=i[b].clone();d&&l.applyMatrix4(d);g.push(l)}b=0;for(p=m.length;b<p;b++){var l=m[b],r,t,n=l.vertexNormals,s=l.vertexColors;l instanceof
|
|
|
+THREE.Face3?r=new THREE.Face3(l.a+f,l.b+f,l.c+f):l instanceof THREE.Face4&&(r=new THREE.Face4(l.a+f,l.b+f,l.c+f,l.d+f));r.normal.copy(l.normal);e&&r.normal.applyMatrix3(e).normalize();g=0;for(i=n.length;g<i;g++)t=n[g].clone(),e&&t.applyMatrix3(e).normalize(),r.vertexNormals.push(t);r.color.copy(l.color);g=0;for(i=s.length;g<i;g++)t=s[g],r.vertexColors.push(t.clone());r.materialIndex=l.materialIndex+c;r.centroid.copy(l.centroid);d&&r.centroid.applyMatrix4(d);j.push(r)}b=0;for(p=h.length;b<p;b++){c=
|
|
|
+h[b];d=[];g=0;for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));a.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,h=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||h.push(f);a.faces=h},randomPointInTriangle:function(a,b,c){var d,e,f,h=new THREE.Vector3,g=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;h.copy(a);h.multiplyScalar(d);g.copy(b);g.multiplyScalar(e);
|
|
|
+h.add(g);g.copy(c);g.multiplyScalar(f);h.add(g);return h},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],h;c?a._area1&&a._area2?(c=a._area1,h=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),h=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=h):(c=
|
|
|
+THREE.GeometryUtils.triangleArea(d,e,b),h=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+h)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,h=a.vertices,g=f.length,i=0,j=[],m,p,l,r;for(e=0;e<g;e++)d=f[e],d instanceof THREE.Face3?
|
|
|
+(m=h[d.a],p=h[d.b],l=h[d.c],d._area=THREE.GeometryUtils.triangleArea(m,p,l)):d instanceof THREE.Face4&&(m=h[d.a],p=h[d.b],l=h[d.c],r=h[d.d],d._area1=THREE.GeometryUtils.triangleArea(m,p,r),d._area2=THREE.GeometryUtils.triangleArea(p,l,r),d._area=d._area1+d._area2),i+=d._area,j[e]=i;d=[];for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0);return d},triangleArea:function(a,b,c){var d=THREE.GeometryUtils.__v1,e=THREE.GeometryUtils.__v2;d.subVectors(b,
|
|
|
a);e.subVectors(c,a);d.cross(e);return 0.5*d.length()},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].x&&(d[e].x-=Math.floor(d[e].x)),1!==d[e].y&&(d[e].y-=Math.floor(d[e].y))},triangulateQuads:function(a){var b,
|
|
|
-c,d,e,f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,l=d.d,n=new THREE.Face3,m=new THREE.Face3;n.color.copy(d.color);m.color.copy(d.color);n.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;n.a=e;n.b=i;n.c=l;m.a=i;m.b=j;m.c=l;4===d.vertexColors.length&&(n.vertexColors[0]=d.vertexColors[0].clone(),n.vertexColors[1]=d.vertexColors[1].clone(),
|
|
|
-n.vertexColors[2]=d.vertexColors[3].clone(),m.vertexColors[0]=d.vertexColors[1].clone(),m.vertexColors[1]=d.vertexColors[2].clone(),m.vertexColors[2]=d.vertexColors[3].clone());f.push(n,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(n=a.faceVertexUvs[d][b],i=n[1],j=n[2],l=n[3],n=[n[0].clone(),i.clone(),l.clone()],i=[i.clone(),j.clone(),l.clone()],h[d].push(n,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=
|
|
|
-a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;THREE.GeometryUtils.__v2=new THREE.Vector3;THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
|
|
|
-!0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=!0,c&&c(f))};h.onerror=d;h.crossOrigin=
|
|
|
-this.crossOrigin;h.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var g=0,h=a.length;g<h;++g){var i={};
|
|
|
-e[g]=i;var j=new XMLHttpRequest;j.onload=b(j,i);j.onerror=d;i=a[g];j.open("GET",i,!0);j.responseType="arraybuffer";j.send(null)}else j=new XMLHttpRequest,j.onload=function(){var a=THREE.ImageUtils.parseDDS(j.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},j.onerror=
|
|
|
-d,j.open("GET",a,!0),j.responseType="arraybuffer",j.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(542327876!==h[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!h[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
|
|
|
-d;var i=h[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.isCubemap=h[28]&512?!0:!1;d.width=h[4];d.height=h[3];for(var h=h[1]+4,f=d.width,g=d.height,i=d.isCubemap?
|
|
|
-6:1,j=0;j<i;j++){for(var l=0;l<d.mipmapCount;l++){var n=Math.max(4,f)/4*Math.max(4,g)/4*e,m={data:new Uint8Array(a,h,n),width:f,height:g};d.mipmaps.push(m);h+=n;f=Math.max(0.5*f,1);g=Math.max(0.5*g,1)}f=d.width;g=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,
|
|
|
-0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var n=0;n<e;n++){var m=0>n-1?0:n-1,p=n+1>e-1?e-1:n+1,t=0>l-1?0:l-1,r=l+1>d-1?d-1:l+1,q=[],s=[0,0,h[4*(n*d+l)]/255*b];q.push([-1,0,h[4*(n*d+t)]/255*b]);q.push([-1,-1,h[4*(m*d+t)]/255*b]);q.push([0,-1,h[4*(m*d+l)]/255*b]);q.push([1,-1,h[4*(m*d+r)]/255*b]);q.push([1,0,h[4*(n*d+r)]/255*b]);q.push([1,1,h[4*(p*d+r)]/255*b]);q.push([0,1,h[4*(p*d+l)]/255*b]);q.push([-1,1,h[4*(p*d+t)]/255*b]);m=[];t=q.length;for(p=0;p<t;p++){var r=q[p],u=q[(p+1)%
|
|
|
-t],r=[r[0]-s[0],r[1]-s[1],r[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];m.push(c([r[1]*u[2]-r[2]*u[1],r[2]*u[0]-r[0]*u[2],r[0]*u[1]-r[1]*u[0]]))}q=[0,0,0];for(p=0;p<m.length;p++)q[0]+=m[p][0],q[1]+=m[p][1],q[2]+=m[p][2];q[0]/=m.length;q[1]/=m.length;q[2]/=m.length;s=4*(n*d+l);j[s]=255*((q[0]+1)/2)|0;j[s+1]=255*((q[1]+1)/2)|0;j[s+2]=255*q[2]|0;j[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),
|
|
|
-c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
-0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,l,n,m,p,t,r,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
-c+d;l=b[a++]*c;p=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(p,t,i,l);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,n,p,i);THREE.Shape.Utils.b2(u,m,t,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,p=b[a++]*c+d,t=b[a++]*-c,r=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,p,t,r,q),g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++)u=g/h,THREE.Shape.Utils.b3(u,n,p,r,i),THREE.Shape.Utils.b3(u,m,t,q,l)}}}return{offset:s.ha*c,path:e}}}};
|
|
|
+c,d,e,f=[],h=[],g=[];b=0;for(c=a.faceUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,m=d.d,p=new THREE.Face3,l=new THREE.Face3;p.color.copy(d.color);l.color.copy(d.color);p.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;p.a=e;p.b=i;p.c=m;l.a=i;l.b=j;l.c=m;4===d.vertexColors.length&&(p.vertexColors[0]=d.vertexColors[0].clone(),p.vertexColors[1]=d.vertexColors[1].clone(),
|
|
|
+p.vertexColors[2]=d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());f.push(p,l);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(p=a.faceVertexUvs[d][b],i=p[1],j=p[2],m=p[3],p=[p[0].clone(),i.clone(),m.clone()],i=[i.clone(),j.clone(),m.clone()],g[d].push(p,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],h[d].push(i,i))}else{f.push(d);d=0;for(e=
|
|
|
+a.faceUvs.length;d<e;d++)h[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)g[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=h;a.faceVertexUvs=g;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;THREE.GeometryUtils.__v2=new THREE.Vector3;THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
|
|
|
+!0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,h=a.length;b<h;++b){var g=new Image;e[b]=g;g.onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=!0,c&&c(f))};g.onerror=d;g.crossOrigin=
|
|
|
+this.crossOrigin;g.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var h=0,g=a.length;h<g;++h){var i={};
|
|
|
+e[h]=i;var j=new XMLHttpRequest;j.onload=b(j,i);j.onerror=d;i=a[h];j.open("GET",i,!0);j.responseType="arraybuffer";j.send(null)}else j=new XMLHttpRequest,j.onload=function(){var a=THREE.ImageUtils.parseDDS(j.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var h=0;h<a.mipmapCount;h++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+h]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},j.onerror=
|
|
|
+d,j.open("GET",a,!0),j.responseType="arraybuffer",j.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),h=c("DXT5"),g=new Int32Array(a,0,31);if(542327876!==g[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!g[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
|
|
|
+d;var i=g[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?
|
|
|
+6:1,j=0;j<i;j++){for(var m=0;m<d.mipmapCount;m++){var p=Math.max(4,f)/4*Math.max(4,h)/4*e,l={data:new Uint8Array(a,g,p),width:f,height:h};d.mipmaps.push(l);g+=p;f=Math.max(0.5*f,1);h=Math.max(0.5*h,1)}f=d.width;h=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var h=f.getContext("2d");h.drawImage(a,0,0);for(var g=h.getImageData(0,
|
|
|
+0,d,e).data,i=h.createImageData(d,e),j=i.data,m=0;m<d;m++)for(var p=0;p<e;p++){var l=0>p-1?0:p-1,r=p+1>e-1?e-1:p+1,t=0>m-1?0:m-1,n=m+1>d-1?d-1:m+1,s=[],q=[0,0,g[4*(p*d+m)]/255*b];s.push([-1,0,g[4*(p*d+t)]/255*b]);s.push([-1,-1,g[4*(l*d+t)]/255*b]);s.push([0,-1,g[4*(l*d+m)]/255*b]);s.push([1,-1,g[4*(l*d+n)]/255*b]);s.push([1,0,g[4*(p*d+n)]/255*b]);s.push([1,1,g[4*(r*d+n)]/255*b]);s.push([0,1,g[4*(r*d+m)]/255*b]);s.push([-1,1,g[4*(r*d+t)]/255*b]);l=[];t=s.length;for(r=0;r<t;r++){var n=s[r],v=s[(r+1)%
|
|
|
+t],n=[n[0]-q[0],n[1]-q[1],n[2]-q[2]],v=[v[0]-q[0],v[1]-q[1],v[2]-q[2]];l.push(c([n[1]*v[2]-n[2]*v[1],n[2]*v[0]-n[0]*v[2],n[0]*v[1]-n[1]*v[0]]))}s=[0,0,0];for(r=0;r<l.length;r++)s[0]+=l[r][0],s[1]+=l[r][1],s[2]+=l[r][2];s[0]/=l.length;s[1]/=l.length;s[2]/=l.length;q=4*(p*d+m);j[q]=255*((s[0]+1)/2)|0;j[q+1]=255*((s[1]+1)/2)|0;j[q+2]=255*s[2]|0;j[q+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),
|
|
|
+c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+1]=h,e[3*g+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
+0,e=String(a).split(""),f=e.length,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,j,m,p,l,r,t,n,s,q=b.glyphs[a]||b.glyphs["?"];if(q){if(q.o){b=q._cachedOutline||(q._cachedOutline=q.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
|
|
|
+c+d;m=b[a++]*c;r=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(r,t,i,m);if(h=f[f.length-1]){p=h.x;l=h.y;h=1;for(g=this.divisions;h<=g;h++){var v=h/g;THREE.Shape.Utils.b2(v,p,r,i);THREE.Shape.Utils.b2(v,l,t,m)}}break;case "b":if(i=b[a++]*c+d,m=b[a++]*c,r=b[a++]*c+d,t=b[a++]*-c,n=b[a++]*c+d,s=b[a++]*-c,e.bezierCurveTo(i,m,r,t,n,s),h=f[f.length-1]){p=h.x;l=h.y;h=1;for(g=this.divisions;h<=g;h++)v=h/g,THREE.Shape.Utils.b3(v,p,r,n,i),THREE.Shape.Utils.b3(v,l,t,s,m)}}}return{offset:q.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,j,l;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var n=2*e;for(j=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var m;a:{var p=m=void 0,t=void 0,r=void 0,q=void 0,s=void 0,u=void 0,w=void 0,y=
|
|
|
-void 0,p=a[g[i]].x,t=a[g[i]].y,r=a[g[j]].x,q=a[g[j]].y,s=a[g[l]].x,u=a[g[l]].y;if(1E-10>(r-p)*(u-t)-(q-t)*(s-p))m=!1;else{var F=void 0,J=void 0,B=void 0,E=void 0,z=void 0,G=void 0,I=void 0,O=void 0,C=void 0,H=void 0,C=O=I=y=w=void 0,F=s-r,J=u-q,B=p-s,E=t-u,z=r-p,G=q-t;for(m=0;m<e;m++)if(!(m===i||m===j||m===l))if(w=a[g[m]].x,y=a[g[m]].y,I=w-p,O=y-t,C=w-r,H=y-q,w-=s,y-=u,C=F*H-J*C,I=z*O-G*I,O=B*y-E*w,0<=C&&0<=O&&0<=I){m=!1;break a}m=!0}}if(m){f.push([a[g[i]],a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);
|
|
|
-i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;n=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,j,m;if(0<b(a))for(j=0;j<e;j++)h[j]=j;else for(j=0;j<e;j++)h[j]=e-1-j;var p=2*e;for(j=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);m=j+1;e<=m&&(m=0);var l;a:{var r=l=void 0,t=void 0,n=void 0,s=void 0,q=void 0,v=void 0,y=void 0,D=
|
|
|
+void 0,r=a[h[i]].x,t=a[h[i]].y,n=a[h[j]].x,s=a[h[j]].y,q=a[h[m]].x,v=a[h[m]].y;if(1E-10>(n-r)*(v-t)-(s-t)*(q-r))l=!1;else{var F=void 0,H=void 0,I=void 0,G=void 0,B=void 0,C=void 0,A=void 0,J=void 0,N=void 0,z=void 0,N=J=A=D=y=void 0,F=q-n,H=v-s,I=r-q,G=t-v,B=n-r,C=s-t;for(l=0;l<e;l++)if(!(l===i||l===j||l===m))if(y=a[h[l]].x,D=a[h[l]].y,A=y-r,J=D-t,N=y-n,z=D-s,y-=q,D-=v,N=F*z-H*N,A=B*J-C*A,J=I*D-G*y,0<=N&&0<=J&&0<=A){l=!1;break a}l=!0}}if(l){f.push([a[h[i]],a[h[j]],a[h[m]]]);g.push([h[i],h[j],h[m]]);
|
|
|
+i=j;for(m=j+1;m<e;i++,m++)h[i]=h[m];e--;p=2*e}}return d?g:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
-THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
|
+THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0<i)g=d-1;else{g=d;break}d=g;if(c[d]==f)return d/(e-1);h=c[d];return c=(d+(f-h)/(c[d+1]-h))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
|
THREE.Curve.prototype.getTangentAt=function(a){a=this.getUtoTmapping(a);return this.getTangent(a)};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};
|
|
|
THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};
|
|
|
THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);
|
|
|
THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};
|
|
|
THREE.SplineCurve=function(a){this.points=void 0==a?[]:a};THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,e;e=(d.length-1)*a;a=Math.floor(e);e-=a;c[0]=0==a?a:a-1;c[1]=a;c[2]=a>d.length-2?d.length-1:a+1;c[3]=a>d.length-3?d.length-1:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);return b};
|
|
|
-THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g};THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.xRadius*Math.cos(b);b=this.aY+this.yRadius*Math.sin(b);return new THREE.Vector2(a,b)};
|
|
|
+THREE.EllipseCurve=function(a,b,c,d,e,f,h){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=h};THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.xRadius*Math.cos(b);b=this.aY+this.yRadius*Math.sin(b);return new THREE.Vector2(a,b)};
|
|
|
THREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype);
|
|
|
THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){var a=0.5*(c-a),d=0.5*(d-b),f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}};
|
|
|
THREE.Curve.create=function(a,b){a.prototype=Object.create(THREE.Curve.prototype);a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b});
|
|
|
THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});
|
|
|
THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)});
|
|
|
-THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e,a=(d.length-1)*a;e=Math.floor(a);a-=e;c[0]=0==e?e:e-1;c[1]=e;c[2]=e>d.length-2?d.length-1:e+1;c[3]=e>d.length-3?d.length-1:e+2;e=d[c[0]];var f=d[c[1]],g=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(e.x,f.x,g.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(e.y,f.y,g.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(e.z,f.z,g.z,c.z,a);return b});
|
|
|
+THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e,a=(d.length-1)*a;e=Math.floor(a);a-=e;c[0]=0==e?e:e-1;c[1]=e;c[2]=e>d.length-2?d.length-1:e+1;c[3]=e>d.length-3?d.length-1:e+2;e=d[c[0]];var f=d[c[1]],h=d[c[2]],c=d[c[3]];b.x=THREE.Curve.Utils.interpolate(e.x,f.x,h.x,c.x,a);b.y=THREE.Curve.Utils.interpolate(e.y,f.y,h.y,c.y,a);b.z=THREE.Curve.Utils.interpolate(e.z,f.z,h.z,c.z,a);return b});
|
|
|
THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,e;e=(d.length-0)*a;a=Math.floor(e);e-=a;a+=0<a?0:(Math.floor(Math.abs(a)/d.length)+1)*d.length;c[0]=(a-1)%d.length;c[1]=a%d.length;c[2]=(a+1)%d.length;c[3]=(a+2)%d.length;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,e);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,e);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z,
|
|
|
d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
|
|
|
THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,j,l,n=a[0]instanceof THREE.Vector3;l=n?new THREE.Vector3:new THREE.Vector2;i=0;for(j=a.length;i<j;i++)h=a[i],h.x>b?b=h.x:h.x<e&&(e=h.x),h.y>c?c=h.y:h.y<f&&(f=h.y),n&&(h.z>d?d=h.z:h.z<g&&(g=h.z)),l.add(h);a={minX:e,minY:f,maxX:b,maxY:c,centroid:l.divideScalar(j)};n&&(a.maxZ=d,a.minZ=g);return a};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,h;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var g,i,j,m,p=a[0]instanceof THREE.Vector3;m=p?new THREE.Vector3:new THREE.Vector2;i=0;for(j=a.length;i<j;i++)g=a[i],g.x>b?b=g.x:g.x<e&&(e=g.x),g.y>c?c=g.y:g.y<f&&(f=g.y),p&&(g.z>d?d=g.z:g.z<h&&(h=g.z)),m.add(g);a={minX:e,minY:f,maxX:b,maxY:c,centroid:m.divideScalar(j)};p&&(a.maxZ=d,a.minZ=h);return a};
|
|
|
THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,h,g,i;d=0;for(e=a.length;d<e;d++)f=a[d],h=f.x,g=f.y,i=h/c.maxX,i=b.getUtoTmapping(i,h),h=b.getPoint(i),g=b.getNormalVector(i).multiplyScalar(g),f.x=h.x+g.x,f.y=h.y+g.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.makeFromPositionQuaternionScale(this.translationWorld,this.rotationObject,this.scaleWorld)):this.matrixWorld.copy(this.matrix),
|
|
|
this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
|
|
|
THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})};THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args,d=new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,b));this.curves.push(d);this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
|
|
|
THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d));this.curves.push(f);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
|
|
|
-THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f));this.curves.push(h);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
|
|
|
-THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
|
|
|
-THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
|
|
|
+THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var h=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args,g=new THREE.CubicBezierCurve(new THREE.Vector2(g[g.length-2],g[g.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f));this.curves.push(g);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h})};
|
|
|
+THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var h=this.actions[this.actions.length-1].args;this.absarc(a+h[h.length-2],b+h[h.length-1],c,d,e,f)};
|
|
|
+THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,h){var g=this.actions[this.actions.length-1].args;this.absellipse(a+g[g.length-2],b+g[g.length-1],c,d,e,f,h)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,h){var g=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,h);this.curves.push(i);i=i.getPoint(h?1:0);g.push(i.x);g.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:g})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,h,i,j,l,n,m,p,t,r;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];m=f[1];0<c.length?(g=c[c.length-1],p=g.x,
|
|
|
-t=g.y):(g=this.actions[d-1].args,p=g[g.length-2],t=g[g.length-1]);for(f=1;f<=a;f++)r=f/a,g=THREE.Shape.Utils.b2(r,p,n,h),r=THREE.Shape.Utils.b2(r,t,m,i),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];m=f[1];j=f[2];l=f[3];0<c.length?(g=c[c.length-1],p=g.x,t=g.y):(g=this.actions[d-1].args,p=g[g.length-2],t=g[g.length-1]);for(f=1;f<=a;f++)r=f/a,g=THREE.Shape.Utils.b3(r,p,n,j,h),r=THREE.Shape.Utils.b3(r,t,m,l,i),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.CSPLINE_THRU:g=
|
|
|
-this.actions[d-1].args;r=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;r=r.concat(f[0]);r=new THREE.SplineCurve(r);for(f=1;f<=g;f++)c.push(r.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];j=f[3];g=f[4];n=!!f[5];p=g-j;t=2*a;for(f=1;f<=t;f++)r=f/t,n||(r=1-r),r=j+r*p,g=h+m*Math.cos(r),r=i+m*Math.sin(r),c.push(new THREE.Vector2(g,r));break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];l=f[3];j=f[4];g=f[5];n=!!f[6];p=g-j;t=2*a;for(f=1;f<=t;f++)r=f/t,n||
|
|
|
-(r=1-r),r=j+r*p,g=h+m*Math.cos(r),r=i+l*Math.sin(r),c.push(new THREE.Vector2(g,r))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
-THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves,d.push(g),d;if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
|
|
|
-b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{a=0;for(b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,h,g,i,j,m,p,l,r,t,n;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],h=f.action,f=f.args,h){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:g=f[2];i=f[3];p=f[0];l=f[1];0<c.length?(h=c[c.length-1],r=h.x,
|
|
|
+t=h.y):(h=this.actions[d-1].args,r=h[h.length-2],t=h[h.length-1]);for(f=1;f<=a;f++)n=f/a,h=THREE.Shape.Utils.b2(n,r,p,g),n=THREE.Shape.Utils.b2(n,t,l,i),c.push(new THREE.Vector2(h,n));break;case THREE.PathActions.BEZIER_CURVE_TO:g=f[4];i=f[5];p=f[0];l=f[1];j=f[2];m=f[3];0<c.length?(h=c[c.length-1],r=h.x,t=h.y):(h=this.actions[d-1].args,r=h[h.length-2],t=h[h.length-1]);for(f=1;f<=a;f++)n=f/a,h=THREE.Shape.Utils.b3(n,r,p,j,g),n=THREE.Shape.Utils.b3(n,t,l,m,i),c.push(new THREE.Vector2(h,n));break;case THREE.PathActions.CSPLINE_THRU:h=
|
|
|
+this.actions[d-1].args;n=[new THREE.Vector2(h[h.length-2],h[h.length-1])];h=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=h;f++)c.push(n.getPointAt(f/h));break;case THREE.PathActions.ARC:g=f[0];i=f[1];l=f[2];j=f[3];h=f[4];p=!!f[5];r=h-j;t=2*a;for(f=1;f<=t;f++)n=f/t,p||(n=1-n),n=j+n*r,h=g+l*Math.cos(n),n=i+l*Math.sin(n),c.push(new THREE.Vector2(h,n));break;case THREE.PathActions.ELLIPSE:g=f[0];i=f[1];l=f[2];m=f[3];j=f[4];h=f[5];p=!!f[6];r=h-j;t=2*a;for(f=1;f<=t;f++)n=f/t,p||
|
|
|
+(n=1-n),n=j+n*r,h=g+l*Math.cos(n),n=i+m*Math.sin(n),c.push(new THREE.Vector2(h,n))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var h;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],h=new THREE.Shape,h.actions=f.actions,h.curves=f.curves,d.push(h),d;if(a){h=new THREE.Shape;a=0;for(b=e.length;a<
|
|
|
+b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(h.actions=f.actions,h.curves=f.curves,d.push(h),h=new THREE.Shape):h.holes.push(f)}else{a=0;for(b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(h&&d.push(h),h=new THREE.Shape,h.actions=f.actions,h.curves=f.curves):h.holes.push(f);d.push(h)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
|
|
|
THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,l,n,m,p,t=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){m=j[e];p=[];for(n=0;n<c.length;n++)l=c[n],l=m.distanceToSquared(l),p.push(l),l<f&&(f=l,g=e,h=n)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;var r=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(r);var q=[j[g],j[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);p=h;l=g;h+=1;g+=-1;0>
|
|
|
-h&&(h+=c.length);h%=c.length;0>g&&(g+=j.length);g%=j.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;r=[j[g],c[h],c[e]];r=THREE.FontUtils.Triangulate.area(r);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);n+m>r+q&&(h=p,g=l,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=j.length),g%=j.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:j.length-1);n=c.slice(0,h);m=c.slice(h);p=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];t.push([j[g],c[h],c[e]]);t.push(f);c=n.concat(p).concat(l).concat(m)}return{shape:c,
|
|
|
-isolatedPts:t,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,j={};f=0;for(g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=f;f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,h,g,i,j,m,p,l,r,t=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){l=j[e];r=[];for(p=0;p<c.length;p++)m=c[p],m=l.distanceToSquared(m),r.push(m),m<f&&(f=m,h=e,g=p)}e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:j.length-1;var n=[j[h],c[g],c[e]];p=THREE.FontUtils.Triangulate.area(n);var s=[j[h],j[f],c[g]];l=THREE.FontUtils.Triangulate.area(s);r=g;m=h;g+=1;h+=-1;0>
|
|
|
+g&&(g+=c.length);g%=c.length;0>h&&(h+=j.length);h%=j.length;e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:j.length-1;n=[j[h],c[g],c[e]];n=THREE.FontUtils.Triangulate.area(n);s=[j[h],j[f],c[g]];s=THREE.FontUtils.Triangulate.area(s);p+l>n+s&&(g=r,h=m,0>g&&(g+=c.length),g%=c.length,0>h&&(h+=j.length),h%=j.length,e=0<=g-1?g-1:c.length-1,f=0<=h-1?h-1:j.length-1);p=c.slice(0,g);l=c.slice(g);r=j.slice(h);m=j.slice(0,h);f=[j[h],j[f],c[g]];t.push([j[h],c[g],c[e]]);t.push(f);c=p.concat(r).concat(m).concat(l)}return{shape:c,
|
|
|
+isolatedPts:t,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,h,g,i,j={};f=0;for(h=d.length;f<h;f++)i=d[f].x+":"+d[f].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=f;f=0;for(h=c.length;f<h;f++){g=c[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=j[i],void 0!==i&&(g[d]=i)}f=0;for(h=e.length;f<h;f++){g=e[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=j[i],void 0!==i&&(g[d]=i)}return c.concat(e)},
|
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++)if(0>a.hierarchy[c].keys[d].time&&
|
|
|
-(a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;
|
|
|
-for(d=0;d<a.hierarchy[c].keys.length;d++){var l={};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){l[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
|
|
|
+(a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var g=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){g={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];g[j]=-1}a.hierarchy[c].usedMorphTargets=g;
|
|
|
+for(d=0;d<a.hierarchy[c].keys.length;d++){var m={};for(j in g){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){m[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(m[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=m}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
|
|
|
d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],
|
|
|
b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!1===this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD&&(e.useQuaternion=!0);e.matrixAutoUpdate=!0;void 0===e.animationCache&&(e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
|
|
|
THREE.Bone?e.skinMatrix:e.matrix);var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){!0===this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this)};
|
|
|
-THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,l;l=this.currentTime+=a*this.timeScale;j=this.currentTime%=this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,m=this.hierarchy.length;n<m;n++){a=this.hierarchy[n];i=a.animationCache;for(var p=0;3>p;p++){c=b[p];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(j<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<
|
|
|
-j;)g=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<j)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(j-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+
|
|
|
-(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d),
|
|
|
+THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,h,g,i,j,m;m=this.currentTime+=a*this.timeScale;j=this.currentTime%=this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,l=this.hierarchy.length;p<l;p++){a=this.hierarchy[p];i=a.animationCache;for(var r=0;3>r;r++){c=b[r];h=i.prevKey[c];g=i.nextKey[c];if(g.time<=m){if(j<m)if(this.loop){h=this.data.hierarchy[p].keys[0];for(g=this.getNextKeyWith(c,p,1);g.time<
|
|
|
+j;)h=g,g=this.getNextKeyWith(c,p,g.index+1)}else{this.stop();return}else{do h=g,g=this.getNextKeyWith(c,p,g.index+1);while(g.time<j)}i.prevKey[c]=h;i.nextKey[c]=g}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(j-h.time)/(g.time-h.time);e=h[c];f=g[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+
|
|
|
+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",p,h.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",p,g.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d),
|
|
|
this.target.set(d[0],d[1],d[2]),this.target.sub(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0))}else"rot"===c?THREE.Quaternion.slerp(e,f,a.quaternion,d):"scl"===c&&(c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d)}}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
|
|
|
-THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,h,g,i,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];g=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;h=e*c;d[0]=this.interpolate(f[0],g[0],i[0],j[0],e,c,h);d[1]=this.interpolate(f[1],g[1],i[1],j[1],e,c,h);d[2]=this.interpolate(f[2],g[2],i[2],j[2],e,c,h);return d};
|
|
|
+THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],h=this.getNextKeyWith(f,a,0);h&&h.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
d.matrixWorldNeedsUpdate=!0}}};
|
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++)e=this.hierarchy[c],f=this.data.hierarchy[c],e.useQuaternion=!0,void 0===f.animationCache&&(f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
|
|
|
e.matrix),e=this.data.hierarchy[c].keys,e.length&&(f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;g<this.startTimeMs&&(g=this.currentTime=this.startTimeMs+g);e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=this.hierarchy[a];if(l.length){for(l=
|
|
|
-0;l<f.length;l++)g=f[l],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,n=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(l.length){this.JITCompile&&n&&(d instanceof
|
|
|
-THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix);b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;)b=c,c=l[b.index+1]}else if(!i)for(var m=l.length-1;c.time<g&&c.index!==m;)b=c,c=l[b.index+1];n.prevKey=b;n.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
|
|
|
-this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
|
-1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,m=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
|
|
|
-2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,h,g,i;g=this.currentTime+=a*this.timeScale;h=this.currentTime%=this.data.length;h<this.startTimeMs&&(h=this.currentTime=this.startTimeMs+h);e=parseInt(Math.min(h*this.data.fps,this.data.length*this.data.fps),10);if((i=h<g)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var m=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=m.length-1;e=this.hierarchy[a];if(m.length){for(m=
|
|
|
+0;m<f.length;m++)h=f[m],(g=this.getPrevKeyWith(h,a,d))&&g.apply(h);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(h<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var m=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(m.length){this.JITCompile&&p&&(d instanceof
|
|
|
+THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix);b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=g){if(i&&this.loop){b=m[0];for(c=m[1];c.time<h;)b=c,c=m[b.index+1]}else if(!i)for(var l=m.length-1;c.time<h&&c.index!==l;)b=c,c=m[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=h?b.interpolate(c,h):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
|
|
|
+this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var h=new THREE.PerspectiveCamera(90,1,a,b);h.up.set(0,0,-1);h.lookAt(new THREE.Vector3(0,-1,0));this.add(h);var g=new THREE.PerspectiveCamera(90,
|
|
|
+1,a,b);g.up.set(0,-1,0);g.lookAt(new THREE.Vector3(0,0,1));this.add(g);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,l=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
|
|
|
+2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,h,c);c.activeCubeFace=4;a.render(b,g,c);c.generateMipmaps=l;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,h){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,h);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);
|
|
|
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPerspectiveMode=!0;this.inOrthographicMode=!1};
|
|
|
THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPerspectiveMode=!1;this.inOrthographicMode=!0};
|
|
|
THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){this.inPerspectiveMode?this.toPerspective():(this.toPerspective(),this.toOrthographic())};
|
|
|
THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
-THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3,i=c+e/b*d;h.x=a*Math.cos(i);h.y=a*Math.sin(i);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),this.faceVertexUvs[0].push([f[e],
|
|
|
-f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,r){var q,s=h.widthSegments,u=h.heightSegments,w=e/2,y=f/2,F=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",u=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",s=h.depthSegments;var J=s+1,B=u+1,E=e/s,z=f/u,G=new THREE.Vector3;G[q]=0<g?1:-1;for(e=0;e<B;e++)for(f=0;f<J;f++){var I=new THREE.Vector3;I[a]=(f*E-w)*c;I[b]=(e*z-y)*d;I[q]=g;h.vertices.push(I)}for(e=
|
|
|
-0;e<u;e++)for(f=0;f<s;f++)a=new THREE.Face4(f+J*e+F,f+J*(e+1)+F,f+1+J*(e+1)+F,f+1+J*e+F),a.normal.copy(G),a.vertexNormals.push(G.clone(),G.clone(),G.clone(),G.clone()),a.materialIndex=r,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/s,1-e/u),new THREE.Vector2(f/s,1-(e+1)/u),new THREE.Vector2((f+1)/s,1-(e+1)/u),new THREE.Vector2((f+1)/s,1-e/u)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
-f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radiusSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var g=c/2,h,i,j=[],l=[];for(i=0;i<=e;i++){var n=[],m=[],p=i/e,t=p*(b-a)+a;for(h=0;h<=d;h++){var r=h/d,q=new THREE.Vector3;q.x=t*Math.sin(2*r*Math.PI);q.y=-p*c+g;q.z=t*Math.cos(2*r*Math.PI);this.vertices.push(q);n.push(this.vertices.length-1);m.push(new THREE.Vector2(r,
|
|
|
-1-p))}j.push(n);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(n=this.vertices[j[0][h]].clone(),m=this.vertices[j[0][h+1]].clone()):(n=this.vertices[j[1][h]].clone(),m=this.vertices[j[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 p=j[i][h],t=j[i+1][h],r=j[i+1][h+1],q=j[i][h+1],s=n.clone(),u=n.clone(),w=m.clone(),y=m.clone(),F=l[i][h].clone(),J=l[i+1][h].clone(),B=l[i+1][h+1].clone(),E=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,
|
|
|
-t,r,q,[s,u,w,y]));this.faceVertexUvs[0].push([F,J,B,E])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)p=j[0][h],t=j[0][h+1],r=this.vertices.length-1,s=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),F=l[0][h].clone(),J=l[0][h+1].clone(),B=new THREE.Vector2(J.u,0),this.faces.push(new THREE.Face3(p,t,r,[s,u,w])),this.faceVertexUvs[0].push([F,J,B])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)p=j[i][h+1],
|
|
|
-t=j[i][h],r=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),F=l[i][h+1].clone(),J=l[i][h].clone(),B=new THREE.Vector2(J.u,1),this.faces.push(new THREE.Face3(p,t,r,[s,u,w])),this.faceVertexUvs[0].push([F,J,B])}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.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var h=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(h);for(e=0;e<=b;e++){var g=new THREE.Vector3,i=c+e/b*d;g.x=a*Math.cos(i);g.y=a*Math.sin(i);this.vertices.push(g);f.push(new THREE.Vector2((g.x/a+1)/2,(g.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),this.faceVertexUvs[0].push([f[e],
|
|
|
+f[e+1],h]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,n){var s,q=g.widthSegments,v=g.heightSegments,y=e/2,D=f/2,F=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)s="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)s="y",v=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)s="x",q=g.depthSegments;var H=q+1,I=v+1,G=e/q,B=f/v,C=new THREE.Vector3;C[s]=0<h?1:-1;for(e=0;e<I;e++)for(f=0;f<H;f++){var A=new THREE.Vector3;A[a]=(f*G-y)*c;A[b]=(e*B-D)*d;A[s]=h;g.vertices.push(A)}for(e=
|
|
|
+0;e<v;e++)for(f=0;f<q;f++)a=new THREE.Face4(f+H*e+F,f+H*(e+1)+F,f+1+H*(e+1)+F,f+1+H*e+F),a.normal.copy(C),a.vertexNormals.push(C.clone(),C.clone(),C.clone(),C.clone()),a.materialIndex=n,g.faces.push(a),g.faceVertexUvs[0].push([new THREE.Vector2(f/q,1-e/v),new THREE.Vector2(f/q,1-(e+1)/v),new THREE.Vector2((f+1)/q,1-(e+1)/v),new THREE.Vector2((f+1)/q,1-e/v)])}THREE.Geometry.call(this);var g=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
+f||1;a=this.width/2;b=this.height/2;c=this.depth/2;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radiusSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,j=[],m=[];for(i=0;i<=e;i++){var p=[],l=[],r=i/e,t=r*(b-a)+a;for(g=0;g<=d;g++){var n=g/d,s=new THREE.Vector3;s.x=t*Math.sin(2*n*Math.PI);s.y=-r*c+h;s.z=t*Math.cos(2*n*Math.PI);this.vertices.push(s);p.push(this.vertices.length-1);l.push(new THREE.Vector2(n,
|
|
|
+1-r))}j.push(p);m.push(l)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(p=this.vertices[j[0][g]].clone(),l=this.vertices[j[0][g+1]].clone()):(p=this.vertices[j[1][g]].clone(),l=this.vertices[j[1][g+1]].clone());p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();for(i=0;i<e;i++){var r=j[i][g],t=j[i+1][g],n=j[i+1][g+1],s=j[i][g+1],q=p.clone(),v=p.clone(),y=l.clone(),D=l.clone(),F=m[i][g].clone(),H=m[i+1][g].clone(),I=m[i+1][g+1].clone(),G=m[i][g+1].clone();this.faces.push(new THREE.Face4(r,
|
|
|
+t,n,s,[q,v,y,D]));this.faceVertexUvs[0].push([F,H,I,G])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)r=j[0][g],t=j[0][g+1],n=this.vertices.length-1,q=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),F=m[0][g].clone(),H=m[0][g+1].clone(),I=new THREE.Vector2(H.u,0),this.faces.push(new THREE.Face3(r,t,n,[q,v,y])),this.faceVertexUvs[0].push([F,H,I])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)r=j[i][g+1],
|
|
|
+t=j[i][g],n=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),F=m[i][g+1].clone(),H=m[i][g].clone(),I=new THREE.Vector2(H.u,1),this.faces.push(new THREE.Face3(r,t,n,[q,v,y])),this.faceVertexUvs[0].push([F,H,I])}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,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(N=c.length;0<=--N;){e=N;f=N-1;0>f&&(f=c.length-1);for(var g=0,h=p+2*l,
|
|
|
-g=0;g<h;g++){var i=fa*g,j=fa*(g+1),m=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,q=c,s=g,r=h,t=e,y=f,m=m+O,i=i+O,n=n+O,j=j+O;I.faces.push(new THREE.Face4(m,i,n,j,null,null,u));m=w.generateSideWallUV(I,a,q,b,m,i,n,j,s,r,t,y);I.faceVertexUvs[0].push(m)}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=O;d+=O;e+=O;I.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?w.generateBottomUV(I,a,b,c,d,e):w.generateTopUV(I,a,b,c,d,e);I.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
|
|
|
-100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=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,p=void 0!==b.steps?b.steps:1,t=b.extrudePath,r,q=!1,s=b.material,u=b.extrudeMaterial,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,y,F,J,B;t&&(r=t.getSpacedPoints(p),q=!0,n=!1,y=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,p,
|
|
|
-!1),F=new THREE.Vector3,J=new THREE.Vector3,B=new THREE.Vector3);n||(j=i=l=0);var E,z,G,I=this,O=this.vertices.length,m=a.extractPoints(m),C=m.shape,m=m.holes;if(t=!THREE.Shape.Utils.isClockWise(C)){C=C.reverse();z=0;for(G=m.length;z<G;z++)E=m[z],THREE.Shape.Utils.isClockWise(E)&&(m[z]=E.reverse());t=!1}var H=THREE.Shape.Utils.triangulateShape(C,m),t=C;z=0;for(G=m.length;z<G;z++)E=m[z],C=C.concat(E);var M,A,R,K,fa=C.length,wa=H.length,Ma=[],N=0,W=t.length;M=W-1;for(A=N+1;N<W;N++,M++,A++)M===W&&(M=
|
|
|
-0),A===W&&(A=0),Ma[N]=d(t[N],t[M],t[A]);var ja=[],na,L=Ma.concat();z=0;for(G=m.length;z<G;z++){E=m[z];na=[];N=0;W=E.length;M=W-1;for(A=N+1;N<W;N++,M++,A++)M===W&&(M=0),A===W&&(A=0),na[N]=d(E[N],E[M],E[A]);ja.push(na);L=L.concat(na)}for(M=0;M<l;M++){E=M/l;R=i*(1-E);A=j*Math.sin(E*Math.PI/2);N=0;for(W=t.length;N<W;N++)K=c(t[N],Ma[N],A),f(K.x,K.y,-R);z=0;for(G=m.length;z<G;z++){E=m[z];na=ja[z];N=0;for(W=E.length;N<W;N++)K=c(E[N],na[N],A),f(K.x,K.y,-R)}}A=j;for(N=0;N<fa;N++)K=n?c(C[N],L[N],A):C[N],q?
|
|
|
-(J.copy(y.normals[0]).multiplyScalar(K.x),F.copy(y.binormals[0]).multiplyScalar(K.y),B.copy(r[0]).add(J).add(F),f(B.x,B.y,B.z)):f(K.x,K.y,0);for(E=1;E<=p;E++)for(N=0;N<fa;N++)K=n?c(C[N],L[N],A):C[N],q?(J.copy(y.normals[E]).multiplyScalar(K.x),F.copy(y.binormals[E]).multiplyScalar(K.y),B.copy(r[E]).add(J).add(F),f(B.x,B.y,B.z)):f(K.x,K.y,h/p*E);for(M=l-1;0<=M;M--){E=M/l;R=i*(1-E);A=j*Math.sin(E*Math.PI/2);N=0;for(W=t.length;N<W;N++)K=c(t[N],Ma[N],A),f(K.x,K.y,h+R);z=0;for(G=m.length;z<G;z++){E=m[z];
|
|
|
-na=ja[z];N=0;for(W=E.length;N<W;N++)K=c(E[N],na[N],A),q?f(K.x,K.y+r[p-1].y,r[p-1].x+R):f(K.x,K.y,h+R)}}if(n){i=0*fa;for(N=0;N<wa;N++)h=H[N],g(h[2]+i,h[1]+i,h[0]+i,!0);i=fa*(p+2*l);for(N=0;N<wa;N++)h=H[N],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(N=0;N<wa;N++)h=H[N],g(h[2],h[1],h[0],!0);for(N=0;N<wa;N++)h=H[N],g(h[0]+fa*p,h[1]+fa*p,h[2]+fa*p,!1)}h=0;e(t,h);h+=t.length;z=0;for(G=m.length;z<G;z++)E=m[z],e(E,h),h+=E.length};
|
|
|
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,
|
|
|
-l=a.vertices[g].y,g=a.vertices[g].z,n=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(j,1-g),new THREE.Vector2(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(m,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
|
+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(O=c.length;0<=--O;){e=O;f=O-1;0>f&&(f=c.length-1);for(var g=0,h=r+2*m,
|
|
|
+g=0;g<h;g++){var i=oa*g,j=oa*(g+1),l=d+e+i,i=d+f+i,p=d+f+j,j=d+e+j,n=c,q=g,s=h,t=e,w=f,l=l+J,i=i+J,p=p+J,j=j+J;A.faces.push(new THREE.Face4(l,i,p,j,null,null,v));l=y.generateSideWallUV(A,a,n,b,l,i,p,j,q,s,t,w);A.faceVertexUvs[0].push(l)}}}function f(a,b,c){A.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=J;d+=J;e+=J;A.faces.push(new THREE.Face3(c,d,e,null,null,q));c=f?y.generateBottomUV(A,a,b,c,d,e):y.generateTopUV(A,a,b,c,d,e);A.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
|
|
|
+100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,r=void 0!==b.steps?b.steps:1,t=b.extrudePath,n,s=!1,q=b.material,v=b.extrudeMaterial,y=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,D,F,H,I;t&&(n=t.getSpacedPoints(r),s=!0,p=!1,D=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,r,
|
|
|
+!1),F=new THREE.Vector3,H=new THREE.Vector3,I=new THREE.Vector3);p||(j=i=m=0);var G,B,C,A=this,J=this.vertices.length,l=a.extractPoints(l),N=l.shape,l=l.holes;if(t=!THREE.Shape.Utils.isClockWise(N)){N=N.reverse();B=0;for(C=l.length;B<C;B++)G=l[B],THREE.Shape.Utils.isClockWise(G)&&(l[B]=G.reverse());t=!1}var z=THREE.Shape.Utils.triangulateShape(N,l),t=N;B=0;for(C=l.length;B<C;B++)G=l[B],N=N.concat(G);var L,w,Z,K,oa=N.length,Pa=z.length,Va=[],O=0,qa=t.length;L=qa-1;for(w=O+1;O<qa;O++,L++,w++)L===qa&&
|
|
|
+(L=0),w===qa&&(w=0),Va[O]=d(t[O],t[L],t[w]);var Fa=[],wa,M=Va.concat();B=0;for(C=l.length;B<C;B++){G=l[B];wa=[];O=0;qa=G.length;L=qa-1;for(w=O+1;O<qa;O++,L++,w++)L===qa&&(L=0),w===qa&&(w=0),wa[O]=d(G[O],G[L],G[w]);Fa.push(wa);M=M.concat(wa)}for(L=0;L<m;L++){G=L/m;Z=i*(1-G);w=j*Math.sin(G*Math.PI/2);O=0;for(qa=t.length;O<qa;O++)K=c(t[O],Va[O],w),f(K.x,K.y,-Z);B=0;for(C=l.length;B<C;B++){G=l[B];wa=Fa[B];O=0;for(qa=G.length;O<qa;O++)K=c(G[O],wa[O],w),f(K.x,K.y,-Z)}}w=j;for(O=0;O<oa;O++)K=p?c(N[O],M[O],
|
|
|
+w):N[O],s?(H.copy(D.normals[0]).multiplyScalar(K.x),F.copy(D.binormals[0]).multiplyScalar(K.y),I.copy(n[0]).add(H).add(F),f(I.x,I.y,I.z)):f(K.x,K.y,0);for(G=1;G<=r;G++)for(O=0;O<oa;O++)K=p?c(N[O],M[O],w):N[O],s?(H.copy(D.normals[G]).multiplyScalar(K.x),F.copy(D.binormals[G]).multiplyScalar(K.y),I.copy(n[G]).add(H).add(F),f(I.x,I.y,I.z)):f(K.x,K.y,g/r*G);for(L=m-1;0<=L;L--){G=L/m;Z=i*(1-G);w=j*Math.sin(G*Math.PI/2);O=0;for(qa=t.length;O<qa;O++)K=c(t[O],Va[O],w),f(K.x,K.y,g+Z);B=0;for(C=l.length;B<
|
|
|
+C;B++){G=l[B];wa=Fa[B];O=0;for(qa=G.length;O<qa;O++)K=c(G[O],wa[O],w),s?f(K.x,K.y+n[r-1].y,n[r-1].x+Z):f(K.x,K.y,g+Z)}}if(p){i=0*oa;for(O=0;O<Pa;O++)g=z[O],h(g[2]+i,g[1]+i,g[0]+i,!0);i=oa*(r+2*m);for(O=0;O<Pa;O++)g=z[O],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(O=0;O<Pa;O++)g=z[O],h(g[2],g[1],g[0],!0);for(O=0;O<Pa;O++)g=z[O],h(g[0]+oa*r,g[1]+oa*r,g[2]+oa*r,!1)}g=0;e(t,g);g+=t.length;B=0;for(C=l.length;B<C;B++)G=l[B],e(G,g),g+=G.length};
|
|
|
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,h,g){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[h].x,
|
|
|
+m=a.vertices[h].y,h=a.vertices[h].z,p=a.vertices[g].x,l=a.vertices[g].y,a=a.vertices[g].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(j,1-h),new THREE.Vector2(p,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-h),new THREE.Vector2(l,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
|
-THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,j=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=j.length;e<f;e++)g=j[e],THREE.Shape.Utils.isClockWise(g)&&(j[e]=g.reverse())}var l=THREE.Shape.Utils.triangulateShape(i,j);e=0;for(f=j.length;e<f;e++)g=j[e],
|
|
|
-i=i.concat(g);j=i.length;f=l.length;for(e=0;e<j;e++)g=i[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)j=l[e],i=j[0]+h,g=j[1]+h,j=j[2]+h,this.faces.push(new THREE.Face3(i,g,j,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,g,j))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var i=c+g*f*d,j=Math.cos(i),l=Math.sin(i),i=0,n=a.length;i<n;i++){var m=a[i],p=new THREE.Vector3;p.x=j*m.x-l*m.y;p.y=l*m.x+j*m.y;p.z=m.z;this.vertices.push(p)}c=a.length;g=0;for(h=b;g<h;g++){i=0;for(n=a.length-1;i<n;i++)d=b=i+c*g,l=b+c,j=b+1+c,this.faces.push(new THREE.Face4(d,l,j,b+1)),j=g*f,b=i*e,d=j+f,l=b+e,this.faceVertexUvs[0].push([new THREE.Vector2(j,
|
|
|
-b),new THREE.Vector2(d,b),new THREE.Vector2(d,l),new THREE.Vector2(j,l)])}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var c=a/2,e=b/2,d=this.widthSegments,f=this.heightSegments,g=d+1,h=f+1,i=this.width/d,j=this.height/f,l=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-c,-(a*j-e),0));for(a=0;a<f;a++)for(b=0;b<d;b++)c=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),c.normal.copy(l),c.vertexNormals.push(l.clone(),l.clone(),
|
|
|
-l.clone(),l.clone()),this.faces.push(c),this.faceVertexUvs[0].push([new THREE.Vector2(b/d,1-a/f),new THREE.Vector2(b/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-a/f)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,g=[],h=a,i=(b-a)/d,a=0;a<=d;a++){for(b=0;b<=c;b++){var j=new THREE.Vector3,l=e+b/c*f;j.x=h*Math.cos(l);j.y=h*Math.sin(l);this.vertices.push(j);g.push(new THREE.Vector2((j.x/h+1)/2,-(j.y/h+1)/2+1))}h+=i}e=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){f=a*c;for(b=0;b<=c;b++){var l=b+f,i=l+a,j=l+c+a,n=l+c+1+a;this.faces.push(new THREE.Face3(i,
|
|
|
-j,n,[e,e,e]));this.faceVertexUvs[0].push([g[i],g[j],g[n]]);i=l+a;j=l+c+1+a;n=l+1+a;this.faces.push(new THREE.Face3(i,j,n,[e,e,e]));this.faceVertexUvs[0].push([g[i],g[j],g[n]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,h)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=g=void 0!==g?g:Math.PI;var h,i,j=[],l=[];for(i=0;i<=c;i++){var n=[],m=[];for(h=0;h<=b;h++){var p=h/b,t=i/c,r=new THREE.Vector3;r.x=-a*Math.cos(d+p*e)*Math.sin(f+t*g);r.y=a*Math.cos(f+t*g);
|
|
|
-r.z=a*Math.sin(d+p*e)*Math.sin(f+t*g);this.vertices.push(r);n.push(this.vertices.length-1);m.push(new THREE.Vector2(p,1-t))}j.push(n);l.push(m)}for(i=0;i<this.heightSegments;i++)for(h=0;h<this.widthSegments;h++){var b=j[i][h+1],c=j[i][h],d=j[i+1][h],e=j[i+1][h+1],f=this.vertices[b].clone().normalize(),g=this.vertices[c].clone().normalize(),n=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),p=l[i][h+1].clone(),t=l[i][h].clone(),r=l[i+1][h].clone(),q=l[i+1][h+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
-this.radius?(this.faces.push(new THREE.Face3(b,d,e,[f,n,m])),this.faceVertexUvs[0].push([p,r,q])):Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(b,c,d,[f,g,n])),this.faceVertexUvs[0].push([p,t,r])):(this.faces.push(new THREE.Face4(b,c,d,e,[f,g,n,m])),this.faceVertexUvs[0].push([p,t,r,q]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){var b=b||{},c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,g=2*c/this.radialSegments*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*
|
|
|
-Math.cos(g))*Math.sin(f);h.z=this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(h.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,h=(this.tubularSegments+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.add(b[e]);i.normal.add(b[f]);i.normal.add(b[g]);i.normal.add(b[h]);
|
|
|
-i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
|
-Array(this.tubularSegments);for(b=0;b<this.tubularSegments;++b){var i=2*(a/this.radialSegments)*this.p*Math.PI,g=2*(b/this.tubularSegments)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.subVectors(i,f);d.addVectors(i,f);e.crossVectors(c,d);d.crossVectors(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,
|
|
|
-f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),i=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),j=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),l=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
|
|
|
-d,e,f));this.faceVertexUvs[0].push([g,i,j,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||!1;f&&(this.debug=new THREE.Object3D);this.grid=[];var g,h,e=this.segments+1,i,j,l,f=new THREE.Vector3,n,m,p,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);n=b.tangents;m=b.normals;p=b.binormals;this.tangents=n;this.normals=m;this.binormals=p;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);l=a.getPointAt(d);d=n[b];g=m[b];
|
|
|
-h=p[b];this.debug&&(this.debug.add(new THREE.ArrowHelper(d,l,c,255)),this.debug.add(new THREE.ArrowHelper(g,l,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,l,c,65280)));for(d=0;d<this.radiusSegments;d++)i=2*(d/this.radiusSegments)*Math.PI,j=-this.radius*Math.cos(i),i=this.radius*Math.sin(i),f.copy(l),f.x+=j*g.x+i*h.x,f.y+=j*g.y+i*h.y,f.z+=j*g.z+i*h.z,this.grid[b][d]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++)e=this.closed?
|
|
|
-(b+1)%this.segments:b+1,f=(d+1)%this.radiusSegments,a=this.grid[b][d],c=this.grid[e][d],e=this.grid[e][f],f=this.grid[b][f],n=new THREE.Vector2(b/this.segments,d/this.radiusSegments),m=new THREE.Vector2((b+1)/this.segments,d/this.radiusSegments),p=new THREE.Vector2((b+1)/this.segments,(d+1)/this.radiusSegments),g=new THREE.Vector2(b/this.segments,(d+1)/this.radiusSegments),this.faces.push(new THREE.Face4(a,c,e,f)),this.faceVertexUvs[0].push([n,m,p,g]);this.computeCentroids();this.computeFaceNormals();
|
|
|
+THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,h,g=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,j=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=j.length;e<f;e++)h=j[e],THREE.Shape.Utils.isClockWise(h)&&(j[e]=h.reverse())}var m=THREE.Shape.Utils.triangulateShape(i,j);e=0;for(f=j.length;e<f;e++)h=j[e],
|
|
|
+i=i.concat(h);j=i.length;f=m.length;for(e=0;e<j;e++)h=i[e],this.vertices.push(new THREE.Vector3(h.x,h.y,0));for(e=0;e<f;e++)j=m[e],i=j[0]+g,h=j[1]+g,j=j[2]+g,this.faces.push(new THREE.Face3(i,h,j,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,h,j))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,h=0,g=b;h<=g;h++)for(var i=c+h*f*d,j=Math.cos(i),m=Math.sin(i),i=0,p=a.length;i<p;i++){var l=a[i],r=new THREE.Vector3;r.x=j*l.x-m*l.y;r.y=m*l.x+j*l.y;r.z=l.z;this.vertices.push(r)}c=a.length;h=0;for(g=b;h<g;h++){i=0;for(p=a.length-1;i<p;i++)d=b=i+c*h,m=b+c,j=b+1+c,this.faces.push(new THREE.Face4(d,m,j,b+1)),j=h*f,b=i*e,d=j+f,m=b+e,this.faceVertexUvs[0].push([new THREE.Vector2(j,
|
|
|
+b),new THREE.Vector2(d,b),new THREE.Vector2(d,m),new THREE.Vector2(j,m)])}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var c=a/2,e=b/2,d=this.widthSegments,f=this.heightSegments,h=d+1,g=f+1,i=this.width/d,j=this.height/f,m=new THREE.Vector3(0,0,1),a=0;a<g;a++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vector3(b*i-c,-(a*j-e),0));for(a=0;a<f;a++)for(b=0;b<d;b++)c=new THREE.Face4(b+h*a,b+h*(a+1),b+1+h*(a+1),b+1+h*a),c.normal.copy(m),c.vertexNormals.push(m.clone(),m.clone(),
|
|
|
+m.clone(),m.clone()),this.faces.push(c),this.faceVertexUvs[0].push([new THREE.Vector2(b/d,1-a/f),new THREE.Vector2(b/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-a/f)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,h=[],g=a,i=(b-a)/d,a=0;a<=d;a++){for(b=0;b<=c;b++){var j=new THREE.Vector3,m=e+b/c*f;j.x=g*Math.cos(m);j.y=g*Math.sin(m);this.vertices.push(j);h.push(new THREE.Vector2((j.x/g+1)/2,-(j.y/g+1)/2+1))}g+=i}e=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){f=a*c;for(b=0;b<=c;b++){var m=b+f,i=m+a,j=m+c+a,p=m+c+1+a;this.faces.push(new THREE.Face3(i,
|
|
|
+j,p,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[j],h[p]]);i=m+a;j=m+c+1+a;p=m+1+a;this.faces.push(new THREE.Face3(i,j,p,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[j],h[p]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,g)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,h){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=h=void 0!==h?h:Math.PI;var g,i,j=[],m=[];for(i=0;i<=c;i++){var p=[],l=[];for(g=0;g<=b;g++){var r=g/b,t=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+r*e)*Math.sin(f+t*h);n.y=a*Math.cos(f+t*h);
|
|
|
+n.z=a*Math.sin(d+r*e)*Math.sin(f+t*h);this.vertices.push(n);p.push(this.vertices.length-1);l.push(new THREE.Vector2(r,1-t))}j.push(p);m.push(l)}for(i=0;i<this.heightSegments;i++)for(g=0;g<this.widthSegments;g++){var b=j[i][g+1],c=j[i][g],d=j[i+1][g],e=j[i+1][g+1],f=this.vertices[b].clone().normalize(),h=this.vertices[c].clone().normalize(),p=this.vertices[d].clone().normalize(),l=this.vertices[e].clone().normalize(),r=m[i][g+1].clone(),t=m[i][g].clone(),n=m[i+1][g].clone(),s=m[i+1][g+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
+this.radius?(this.faces.push(new THREE.Face3(b,d,e,[f,p,l])),this.faceVertexUvs[0].push([r,n,s])):Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(b,c,d,[f,h,p])),this.faceVertexUvs[0].push([r,t,n])):(this.faces.push(new THREE.Face4(b,c,d,e,[f,h,p,l])),this.faceVertexUvs[0].push([r,t,n,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){var b=b||{},c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,h=2*c/this.radialSegments*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var g=new THREE.Vector3;g.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);g.y=(this.radius+this.tube*
|
|
|
+Math.cos(h))*Math.sin(f);g.z=this.tube*Math.sin(h);this.vertices.push(g);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(g.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,h=(this.tubularSegments+1)*(c-1)+d,g=(this.tubularSegments+1)*c+d,i=new THREE.Face4(e,f,h,g,[b[e],b[f],b[h],b[g]]);i.normal.add(b[e]);i.normal.add(b[f]);i.normal.add(b[h]);i.normal.add(b[g]);
|
|
|
+i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[h].clone(),a[g].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,h){function g(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
|
+Array(this.tubularSegments);for(b=0;b<this.tubularSegments;++b){var i=2*(a/this.radialSegments)*this.p*Math.PI,h=2*(b/this.tubularSegments)*Math.PI,f=g(i,h,this.q,this.p,this.radius,this.heightScale),i=g(i+0.01,h,this.q,this.p,this.radius,this.heightScale);c.subVectors(i,f);d.addVectors(i,f);e.crossVectors(c,d);d.crossVectors(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=i*d.x+h*e.x;f.y+=i*d.y+h*e.y;f.z+=i*d.z+h*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,
|
|
|
+f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),i=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),j=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),m=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
|
|
|
+d,e,f));this.faceVertexUvs[0].push([h,i,j,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||!1;f&&(this.debug=new THREE.Object3D);this.grid=[];var h,g,e=this.segments+1,i,j,m,f=new THREE.Vector3,p,l,r,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);p=b.tangents;l=b.normals;r=b.binormals;this.tangents=p;this.normals=l;this.binormals=r;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);m=a.getPointAt(d);d=p[b];h=l[b];
|
|
|
+g=r[b];this.debug&&(this.debug.add(new THREE.ArrowHelper(d,m,c,255)),this.debug.add(new THREE.ArrowHelper(h,m,c,16711680)),this.debug.add(new THREE.ArrowHelper(g,m,c,65280)));for(d=0;d<this.radiusSegments;d++)i=2*(d/this.radiusSegments)*Math.PI,j=-this.radius*Math.cos(i),i=this.radius*Math.sin(i),f.copy(m),f.x+=j*h.x+i*g.x,f.y+=j*h.y+i*g.y,f.z+=j*h.z+i*g.z,this.grid[b][d]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++)e=this.closed?
|
|
|
+(b+1)%this.segments:b+1,f=(d+1)%this.radiusSegments,a=this.grid[b][d],c=this.grid[e][d],e=this.grid[e][f],f=this.grid[b][f],p=new THREE.Vector2(b/this.segments,d/this.radiusSegments),l=new THREE.Vector2((b+1)/this.segments,d/this.radiusSegments),r=new THREE.Vector2((b+1)/this.segments,(d+1)/this.radiusSegments),h=new THREE.Vector2(b/this.segments,(d+1)/this.radiusSegments),this.faces.push(new THREE.Face4(a,c,e,f)),this.faceVertexUvs[0].push([p,l,r,h]);this.computeCentroids();this.computeFaceNormals();
|
|
|
this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,l,n;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++)l=j/(b-1),e[j]=a.getTangentAt(l),e[j].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);n=Math.abs(e[0].z);j<=a&&(a=j,d.set(1,0,0));l<=a&&(a=l,d.set(0,1,0));n<=a&&d.set(0,0,1);h.crossVectors(e[0],
|
|
|
-d).normalize();f[0].crossVectors(e[0],h);g[0].crossVectors(e[0],f[0]);for(j=1;j<b;j++)f[j]=f[j-1].clone(),g[j]=g[j-1].clone(),h.crossVectors(e[j-1],e[j]),1E-4<h.length()&&(h.normalize(),d=Math.acos(e[j-1].dot(e[j])),f[j].applyMatrix4(i.makeRotationAxis(h,d))),g[j].crossVectors(e[j],f[j]);if(c){d=Math.acos(f[0].dot(f[b-1]));d/=b-1;0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d);for(j=1;j<b;j++)f[j].applyMatrix4(i.makeRotationAxis(e[j],d*j)),g[j].crossVectors(e[j],f[j])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=h.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.add(a).add(b).add(c).divideScalar(3);h.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);h.faceVertexUvs[0].push([g(a.uv,a,d),g(b.uv,b,d),
|
|
|
-g(c.uv,c,d)])}function g(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,h=this,i=0,j=a.length;i<j;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var l=this.vertices,a=[],i=0,j=b.length;i<j;i++){var n=l[b[i][0]],m=l[b[i][1]],p=l[b[i][2]];a[i]=new THREE.Face3(n.index,m.index,p.index,[n.clone(),m.clone(),p.clone()])}i=0;for(j=a.length;i<j;i++){m=a[i];l=d;b=Math.pow(2,
|
|
|
-l);Math.pow(4,l);for(var l=e(h.vertices[m.a]),n=e(h.vertices[m.b]),t=e(h.vertices[m.c]),m=[],p=0;p<=b;p++){m[p]=[];for(var r=e(l.clone().lerp(t,p/b)),q=e(n.clone().lerp(t,p/b)),s=b-p,u=0;u<=s;u++)m[p][u]=0==u&&p==b?r:e(r.clone().lerp(q,u/s))}for(p=0;p<b;p++)for(u=0;u<2*(b-p)-1;u++)l=Math.floor(u/2),0==u%2?f(m[p][l+1],m[p+1][l],m[p][l]):f(m[p][l+1],m[p+1][l+1],m[p+1][l])}i=0;for(j=this.faceVertexUvs[0].length;i<j;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,n=Math.max(a,Math.max(b,l)),
|
|
|
-m=Math.min(a,Math.min(b,l)),0.9<n&&0.1>m&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(d[2].x+=1));i=0;for(j=this.vertices.length;i<j;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=void 0===d?!1:d,h,i,j,l,n=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++)j=i/b,j=a(j,l),e.push(j)}var m,p,t,r;for(h=0;h<c;h++)for(i=0;i<b;i++)a=h*n+i,e=h*n+i+1,l=(h+1)*n+i,j=(h+1)*n+i+1,m=new THREE.Vector2(i/b,h/c),p=new THREE.Vector2((i+1)/b,h/c),t=new THREE.Vector2(i/b,(h+1)/c),r=new THREE.Vector2((i+1)/b,(h+1)/c),d?(f.push(new THREE.Face3(a,e,l)),f.push(new THREE.Face3(e,
|
|
|
-j,l)),g.push([m,p,t]),g.push([p,r,t])):(f.push(new THREE.Face4(a,e,j,l)),g.push([m,p,r,t]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),g=f.length();f.x+=g*2E-6*(Math.random()-0.5);f.y+=g*2E-6*(Math.random()-0.5);f.z+=g*2E-6*(Math.random()-0.5);for(var g=[],h=0;h<c.length;){var i=c[h],j=f,l=a[i[0]],n;n=l;var m=a[i[1]],p=a[i[2]],t=new THREE.Vector3,r=new THREE.Vector3;t.subVectors(p,m);r.subVectors(n,m);t.cross(r);t.normalize();n=t;l=n.dot(l);
|
|
|
-if(n.dot(j)>=l){for(j=0;3>j;j++){l=[i[j],i[(j+1)%3]];n=!0;for(m=0;m<g.length;m++)if(g[m][0]===l[1]&&g[m][1]===l[0]){g[m]=g[g.length-1];g.pop();n=!1;break}n&&g.push(l)}c[h]=c[c.length-1];c.pop()}else h++}for(m=0;m<g.length;m++)c.push([g[m][0],g[m][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;3>h;h++)void 0===f[g[h]]&&(f[g[h]]=e++,this.vertices.push(a[g[h]])),g[h]=f[g[h]]}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=0;d<this.faces.length;d++)g=
|
|
|
-this.faces[d],this.faceVertexUvs[0].push([b(this.vertices[g.a]),b(this.vertices[g.b]),b(this.vertices[g.c])]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],h=[],g=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,m,p;this.tangents=e;this.normals=f;this.binormals=h;for(j=0;j<b;j++)m=j/(b-1),e[j]=a.getTangentAt(m),e[j].normalize();f[0]=new THREE.Vector3;h[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);m=Math.abs(e[0].y);p=Math.abs(e[0].z);j<=a&&(a=j,d.set(1,0,0));m<=a&&(a=m,d.set(0,1,0));p<=a&&d.set(0,0,1);g.crossVectors(e[0],
|
|
|
+d).normalize();f[0].crossVectors(e[0],g);h[0].crossVectors(e[0],f[0]);for(j=1;j<b;j++)f[j]=f[j-1].clone(),h[j]=h[j-1].clone(),g.crossVectors(e[j-1],e[j]),1E-4<g.length()&&(g.normalize(),d=Math.acos(e[j-1].dot(e[j])),f[j].applyMatrix4(i.makeRotationAxis(g,d))),h[j].crossVectors(e[j],f[j]);if(c){d=Math.acos(f[0].dot(f[b-1]));d/=b-1;0<e[0].dot(g.crossVectors(f[0],f[b-1]))&&(d=-d);for(j=1;j<b;j++)f[j].applyMatrix4(i.makeRotationAxis(e[j],d*j)),h[j].crossVectors(e[j],f[j])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=g.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.add(a).add(b).add(c).divideScalar(3);g.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);g.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),
|
|
|
+h(c.uv,c,d)])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,j=a.length;i<j;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var m=this.vertices,a=[],i=0,j=b.length;i<j;i++){var p=m[b[i][0]],l=m[b[i][1]],r=m[b[i][2]];a[i]=new THREE.Face3(p.index,l.index,r.index,[p.clone(),l.clone(),r.clone()])}i=0;for(j=a.length;i<j;i++){l=a[i];m=d;b=Math.pow(2,
|
|
|
+m);Math.pow(4,m);for(var m=e(g.vertices[l.a]),p=e(g.vertices[l.b]),t=e(g.vertices[l.c]),l=[],r=0;r<=b;r++){l[r]=[];for(var n=e(m.clone().lerp(t,r/b)),s=e(p.clone().lerp(t,r/b)),q=b-r,v=0;v<=q;v++)l[r][v]=0==v&&r==b?n:e(n.clone().lerp(s,v/q))}for(r=0;r<b;r++)for(v=0;v<2*(b-r)-1;v++)m=Math.floor(v/2),0==v%2?f(l[r][m+1],l[r+1][m],l[r][m]):f(l[r][m+1],l[r+1][m+1],l[r+1][m])}i=0;for(j=this.faceVertexUvs[0].length;i<j;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,m=d[2].x,p=Math.max(a,Math.max(b,m)),
|
|
|
+l=Math.min(a,Math.min(b,m)),0.9<p&&0.1>l&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>m&&(d[2].x+=1));i=0;for(j=this.vertices.length;i<j;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,h=this.faceVertexUvs[0],d=void 0===d?!1:d,g,i,j,m,p=b+1;for(g=0;g<=c;g++){m=g/c;for(i=0;i<=b;i++)j=i/b,j=a(j,m),e.push(j)}var l,r,t,n;for(g=0;g<c;g++)for(i=0;i<b;i++)a=g*p+i,e=g*p+i+1,m=(g+1)*p+i,j=(g+1)*p+i+1,l=new THREE.Vector2(i/b,g/c),r=new THREE.Vector2((i+1)/b,g/c),t=new THREE.Vector2(i/b,(g+1)/c),n=new THREE.Vector2((i+1)/b,(g+1)/c),d?(f.push(new THREE.Face3(a,e,m)),f.push(new THREE.Face3(e,
|
|
|
+j,m)),h.push([l,r,t]),h.push([r,n,t])):(f.push(new THREE.Face4(a,e,j,m)),h.push([l,r,n,t]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),h=f.length();f.x+=h*2E-6*(Math.random()-0.5);f.y+=h*2E-6*(Math.random()-0.5);f.z+=h*2E-6*(Math.random()-0.5);for(var h=[],g=0;g<c.length;){var i=c[g],j=f,m=a[i[0]],p;p=m;var l=a[i[1]],r=a[i[2]],t=new THREE.Vector3,n=new THREE.Vector3;t.subVectors(r,l);n.subVectors(p,l);t.cross(n);t.normalize();p=t;m=p.dot(m);
|
|
|
+if(p.dot(j)>=m){for(j=0;3>j;j++){m=[i[j],i[(j+1)%3]];p=!0;for(l=0;l<h.length;l++)if(h[l][0]===m[1]&&h[l][1]===m[0]){h[l]=h[h.length-1];h.pop();p=!1;break}p&&h.push(m)}c[g]=c[c.length-1];c.pop()}else g++}for(l=0;l<h.length;l++)c.push([h[l][0],h[l][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){h=c[d];for(g=0;3>g;g++)void 0===f[h[g]]&&(f[h[g]]=e++,this.vertices.push(a[h[g]])),h[g]=f[h[g]]}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=0;d<this.faces.length;d++)h=
|
|
|
+this.faces[d],this.faceVertexUvs[0].push([b(this.vertices[h.a]),b(this.vertices[h.b]),b(this.vertices[h.c])]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);this.position=b;this.useQuaternion=!0;b=new THREE.Geometry;b.vertices.push(new THREE.Vector3(0,0,0));b.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(b,new THREE.LineBasicMaterial({color:d}));this.line.matrixAutoUpdate=!1;this.add(this.line);b=new THREE.CylinderGeometry(0,0.05,0.25,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,0.875,0));this.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:d}));
|
|
|
this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(){var a=new THREE.Vector3,b;return function(c){0.999<c.y?this.quaternion.set(0,0,0,1):-0.999>c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};
|
|
|
THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.BoxHelper=function(a){var a=a||1,b=new THREE.Geometry,a=[new THREE.Vector3(a,a,a),new THREE.Vector3(-a,a,a),new THREE.Vector3(-a,-a,a),new THREE.Vector3(a,-a,a),new THREE.Vector3(a,a,-a),new THREE.Vector3(-a,a,-a),new THREE.Vector3(-a,-a,-a),new THREE.Vector3(a,-a,-a)];b.vertices.push(a[0],a[1],a[1],a[2],a[2],a[3],a[3],a[0],a[4],a[5],a[5],a[6],a[6],a[7],a[7],a[4],a[0],a[4],a[1],a[5],a[2],a[6],a[3],a[7]);this.vertices=a;THREE.Line.call(this,b,new THREE.LineBasicMaterial,THREE.LinePieces)};
|
|
@@ -659,10 +658,10 @@ THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
THREE.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox();var c=b.boundingBox.min,b=b.boundingBox.max,d=this.vertices;d[0].set(b.x,b.y,b.z);d[1].set(c.x,b.y,b.z);d[2].set(c.x,c.y,b.z);d[3].set(b.x,c.y,b.z);d[4].set(b.x,b.y,c.z);d[5].set(c.x,b.y,c.z);d[6].set(c.x,c.y,c.z);d[7].set(b.x,c.y,c.z);this.geometry.computeBoundingSphere();this.geometry.verticesNeedUpdate=!0;this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new THREE.Vector3);d.colors.push(new THREE.Color(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}THREE.Line.call(this);var d=new THREE.Geometry,e=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);
|
|
|
b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);THREE.Line.call(this,d,e,THREE.LinePieces);this.camera=a;this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()};
|
|
|
THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
-THREE.CameraHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Camera,c=new THREE.Projector;return function(){function d(d,g,h,i){a.set(g,h,i);c.unprojectVector(a,b);d=e.pointMap[d];if(void 0!==d){g=0;for(h=d.length;g<h;g++)e.geometry.vertices[d[g]].copy(a)}}var e=this;b.projectionMatrix.copy(this.camera.projectionMatrix);d("c",0,0,-1);d("t",0,0,1);d("n1",-1,-1,-1);d("n2",1,-1,-1);d("n3",-1,1,-1);d("n4",1,1,-1);d("f1",-1,-1,1);d("f2",1,-1,1);d("f3",-1,1,1);d("f4",1,1,1);d("u1",
|
|
|
+THREE.CameraHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Camera,c=new THREE.Projector;return function(){function d(d,h,g,i){a.set(h,g,i);c.unprojectVector(a,b);d=e.pointMap[d];if(void 0!==d){h=0;for(g=d.length;h<g;h++)e.geometry.vertices[d[h]].copy(a)}}var e=this;b.projectionMatrix.copy(this.camera.projectionMatrix);d("c",0,0,-1);d("t",0,0,1);d("n1",-1,-1,-1);d("n2",1,-1,-1);d("n3",-1,1,-1);d("n4",1,1,-1);d("f1",-1,-1,1);d("f2",1,-1,1);d("f3",-1,1,1);d("f4",1,1,1);d("u1",
|
|
|
0.7,1.1,-1);d("u2",-0.7,1.1,-1);d("u3",0,2,-1);d("cf1",-1,0,1);d("cf2",1,0,1);d("cf3",0,-1,1);d("cf4",0,1,1);d("cn1",-1,0,-1);d("cn2",1,0,-1);d("cn3",0,-1,-1);d("cn4",0,1,-1);this.geometry.verticesNeedUpdate=!0}}();THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.light=a;var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightSphere=new THREE.Mesh(c,d);this.lightSphere.matrixWorld=this.light.matrixWorld;this.lightSphere.matrixAutoUpdate=!1;this.add(this.lightSphere);c=new THREE.Geometry;c.vertices.push(this.light.position);c.vertices.push(this.light.target.position);
|
|
|
c.computeLineDistances();d=new THREE.LineDashedMaterial({dashSize:4,gapSize:4,opacity:0.75,transparent:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine)};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
-THREE.DirectionalLightHelper.prototype.update=function(){this.lightSphere.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.computeLineDistances();this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.GridHelper=function(a,b){for(var c=new THREE.Geometry,d=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors}),e=new THREE.Color(4473924),f=new THREE.Color(8947848),g=-a;g<=a;g+=b){c.vertices.push(new THREE.Vector3(-a,0,g),new THREE.Vector3(a,0,g),new THREE.Vector3(g,0,-a),new THREE.Vector3(g,0,a));var h=0===g?e:f;c.colors.push(h,h,h,h)}THREE.Line.call(this,c,d,THREE.LinePieces)};THREE.GridHelper.prototype=Object.create(THREE.Line.prototype);THREE.HemisphereLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;var c=new THREE.SphereGeometry(b,4,2);c.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));for(var d=0;8>d;d++)c.faces[d].materialIndex=4>d?0:1;d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});d.color.copy(a.color).multiplyScalar(a.intensity);var e=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});e.color.copy(a.groundColor).multiplyScalar(a.intensity);this.lightSphere=new THREE.Mesh(c,new THREE.MeshFaceMaterial([d,
|
|
|
+THREE.DirectionalLightHelper.prototype.update=function(){this.lightSphere.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.computeLineDistances();this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.GridHelper=function(a,b){for(var c=new THREE.Geometry,d=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors}),e=new THREE.Color(4473924),f=new THREE.Color(8947848),h=-a;h<=a;h+=b){c.vertices.push(new THREE.Vector3(-a,0,h),new THREE.Vector3(a,0,h),new THREE.Vector3(h,0,-a),new THREE.Vector3(h,0,a));var g=0===h?e:f;c.colors.push(g,g,g,g)}THREE.Line.call(this,c,d,THREE.LinePieces)};THREE.GridHelper.prototype=Object.create(THREE.Line.prototype);THREE.HemisphereLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;var c=new THREE.SphereGeometry(b,4,2);c.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));for(var d=0;8>d;d++)c.faces[d].materialIndex=4>d?0:1;d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});d.color.copy(a.color).multiplyScalar(a.intensity);var e=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});e.color.copy(a.groundColor).multiplyScalar(a.intensity);this.lightSphere=new THREE.Mesh(c,new THREE.MeshFaceMaterial([d,
|
|
|
e]));this.lightSphere.position=a.position;this.lightSphere.lookAt(new THREE.Vector3);this.add(this.lightSphere)};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.HemisphereLightHelper.prototype.update=function(){this.lightSphere.lookAt(new THREE.Vector3);this.lightSphere.material.materials[0].color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightSphere.material.materials[1].color.copy(this.light.groundColor).multiplyScalar(this.light.intensity)};THREE.PointLightHelper=function(a,b){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.light=a;var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightSphere=new THREE.Mesh(c,d);this.lightSphere.matrixWorld=this.light.matrixWorld;this.lightSphere.matrixAutoUpdate=!1;this.add(this.lightSphere)};THREE.PointLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.PointLightHelper.prototype.update=function(){this.lightSphere.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.SpotLightHelper=function(a,b){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.light=a;var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightSphere=new THREE.Mesh(c,d);this.lightSphere.matrixWorld=this.light.matrixWorld;this.lightSphere.matrixAutoUpdate=!1;this.add(this.lightSphere);c=new THREE.CylinderGeometry(1E-4,1,1,8,1,!0);c.applyMatrix((new THREE.Matrix4).makeTranslation(0,
|
|
|
-0.5,0));c.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));d=new THREE.MeshBasicMaterial({fog:!1,wireframe:!0,opacity:0.3,transparent:!0});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightCone=new THREE.Mesh(c,d);this.lightCone.position=this.light.position;c=a.distance?a.distance:1E4;d=c*Math.tan(a.angle);this.lightCone.scale.set(d,d,c);this.lightCone.lookAt(this.light.target.position);this.add(this.lightCone)};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
@@ -670,43 +669,43 @@ THREE.SpotLightHelper.prototype.update=function(){var a=this.light.distance?this
|
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);
|
|
|
THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
|
|
|
-THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&1<h.length){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];f<h.start&&(h.start=f);f>h.end&&(h.end=f);c||(c=i)}}for(i in d)h=d[i],this.createAnimation(i,h.start,h.end,a);this.firstAnimation=c};
|
|
|
+THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},e=this.geometry,f=0,h=e.morphTargets.length;f<h;f++){var g=e.morphTargets[f].name.match(b);if(g&&1<g.length){var i=g[1];d[i]||(d[i]={start:Infinity,end:-Infinity});g=d[i];f<g.start&&(g.start=f);f>g.end&&(g.end=f);c||(c=i)}}for(i in d)g=d[i],this.createAnimation(i,g.start,g.end,a);this.firstAnimation=c};
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)};
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
|
|
|
THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
|
|
|
-THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;
|
|
|
-f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,i,j,l,n,m,p;this.init=function(t){b=t.context;c=t;d=t.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);t=0;e[t++]=-1;e[t++]=-1;
|
|
|
-e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
+THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),h=d.weight;
|
|
|
+f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*h,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*h;this.morphTargetInfluences[d.lastFrame]=(1-e)*h}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,h,g,i,j,m,p,l,r;this.init=function(t){b=t.context;c=t;d=t.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);t=0;e[t++]=-1;e[t++]=-1;
|
|
|
+e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,j);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
|
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,n=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));m={};p={};m.vertex=b.getAttribLocation(n,"position");m.uv=b.getAttribLocation(n,"uv");p.renderType=b.getUniformLocation(n,"renderType");p.map=b.getUniformLocation(n,"map");p.occlusionMap=b.getUniformLocation(n,"occlusionMap");p.opacity=
|
|
|
-b.getUniformLocation(n,"opacity");p.color=b.getUniformLocation(n,"color");p.scale=b.getUniformLocation(n,"scale");p.rotation=b.getUniformLocation(n,"rotation");p.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var w=new THREE.Vector3,y=f/e,F=0.5*e,J=0.5*f,B=16/f,E=new THREE.Vector2(B*y,B),z=new THREE.Vector3(1,1,0),G=new THREE.Vector2(1,1),I=p,B=m;b.useProgram(n);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
|
|
|
-b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(B.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var O,C,H,M,A;for(O=0;O<u;O++)if(B=16/f,E.set(B*y,B),M=a[O],w.set(M.matrixWorld.elements[12],M.matrixWorld.elements[13],M.matrixWorld.elements[14]),w.applyMatrix4(d.matrixWorldInverse),w.applyProjection(d.projectionMatrix),z.copy(w),G.x=z.x*F+F,
|
|
|
-G.y=z.y*J+J,l||0<G.x&&G.x<e&&0<G.y&&G.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,G.x-8,G.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,E.x,E.y);b.uniform3f(I.screenPosition,z.x,z.y,z.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,G.x-8,G.y-8,16,16,0);b.uniform1i(I.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);M.positionScreen.copy(z);M.customUpdateCallback?M.customUpdateCallback(M):M.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);C=0;for(H=M.lensFlares.length;C<H;C++)A=M.lensFlares[C],0.001<A.opacity&&0.001<A.scale&&(z.x=A.x,z.y=A.y,z.z=A.z,B=A.size*A.scale/f,E.x=B*y,E.y=B,b.uniform3f(I.screenPosition,z.x,z.y,z.z),b.uniform2f(I.scale,E.x,E.y),b.uniform1f(I.rotation,A.rotation),b.uniform1f(I.opacity,
|
|
|
-A.opacity),b.uniform3f(I.color,A.color.r,A.color.g,A.color.b),c.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),c.setTexture(A.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,j=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 p,t,r,q,s,u,w,y,F,J=[];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);p=0;for(t=n.__lights.length;p<t;p++)if(r=n.__lights[p],r.castShadow)if(r instanceof THREE.DirectionalLight&&r.shadowCascade)for(s=0;s<r.shadowCascadeCount;s++){var B;if(r.shadowCascadeArray[s])B=r.shadowCascadeArray[s];else{F=r;w=s;B=new THREE.DirectionalLight;B.isVirtual=!0;B.onlyShadow=!0;B.castShadow=!0;B.shadowCameraNear=F.shadowCameraNear;B.shadowCameraFar=F.shadowCameraFar;B.shadowCameraLeft=F.shadowCameraLeft;B.shadowCameraRight=F.shadowCameraRight;
|
|
|
-B.shadowCameraBottom=F.shadowCameraBottom;B.shadowCameraTop=F.shadowCameraTop;B.shadowCameraVisible=F.shadowCameraVisible;B.shadowDarkness=F.shadowDarkness;B.shadowBias=F.shadowCascadeBias[w];B.shadowMapWidth=F.shadowCascadeWidth[w];B.shadowMapHeight=F.shadowCascadeHeight[w];B.pointsWorld=[];B.pointsFrustum=[];y=B.pointsWorld;u=B.pointsFrustum;for(var E=0;8>E;E++)y[E]=new THREE.Vector3,u[E]=new THREE.Vector3;y=F.shadowCascadeNearZ[w];F=F.shadowCascadeFarZ[w];u[0].set(-1,-1,y);u[1].set(1,-1,y);u[2].set(-1,
|
|
|
-1,y);u[3].set(1,1,y);u[4].set(-1,-1,F);u[5].set(1,-1,F);u[6].set(-1,1,F);u[7].set(1,1,F);B.originalCamera=m;u=new THREE.Gyroscope;u.position=r.shadowCascadeOffset;u.add(B);u.add(B.target);m.add(u);r.shadowCascadeArray[s]=B;console.log("Created virtualLight",B)}w=r;y=s;F=w.shadowCascadeArray[y];F.position.copy(w.position);F.target.position.copy(w.target.position);F.lookAt(F.target);F.shadowCameraVisible=w.shadowCameraVisible;F.shadowDarkness=w.shadowDarkness;F.shadowBias=w.shadowCascadeBias[y];u=w.shadowCascadeNearZ[y];
|
|
|
-w=w.shadowCascadeFarZ[y];F=F.pointsFrustum;F[0].z=u;F[1].z=u;F[2].z=u;F[3].z=u;F[4].z=w;F[5].z=w;F[6].z=w;F[7].z=w;J[q]=B;q++}else J[q]=r,q++;p=0;for(t=J.length;p<t;p++){r=J[p];r.shadowMap||(s=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(s=THREE.NearestFilter),r.shadowMap=new THREE.WebGLRenderTarget(r.shadowMapWidth,r.shadowMapHeight,{minFilter:s,magFilter:s,format:THREE.RGBAFormat}),r.shadowMapSize=new THREE.Vector2(r.shadowMapWidth,r.shadowMapHeight),r.shadowMatrix=new THREE.Matrix4);
|
|
|
-if(!r.shadowCamera){if(r instanceof THREE.SpotLight)r.shadowCamera=new THREE.PerspectiveCamera(r.shadowCameraFov,r.shadowMapWidth/r.shadowMapHeight,r.shadowCameraNear,r.shadowCameraFar);else if(r instanceof THREE.DirectionalLight)r.shadowCamera=new THREE.OrthographicCamera(r.shadowCameraLeft,r.shadowCameraRight,r.shadowCameraTop,r.shadowCameraBottom,r.shadowCameraNear,r.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}n.add(r.shadowCamera);!0===n.autoUpdate&&n.updateMatrixWorld()}r.shadowCameraVisible&&
|
|
|
-!r.cameraHelper&&(r.cameraHelper=new THREE.CameraHelper(r.shadowCamera),r.shadowCamera.add(r.cameraHelper));if(r.isVirtual&&B.originalCamera==m){s=m;q=r.shadowCamera;u=r.pointsFrustum;F=r.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(w=0;8>w;w++)y=F[w],y.copy(u[w]),THREE.ShadowMapPlugin.__projector.unprojectVector(y,s),y.applyMatrix4(q.matrixWorldInverse),y.x<i.x&&(i.x=y.x),y.x>j.x&&(j.x=y.x),y.y<i.y&&(i.y=y.y),y.y>j.y&&(j.y=y.y),y.z<i.z&&(i.z=y.z),y.z>j.z&&
|
|
|
-(j.z=y.z);q.left=i.x;q.right=j.x;q.top=j.y;q.bottom=i.y;q.updateProjectionMatrix()}q=r.shadowMap;u=r.shadowMatrix;s=r.shadowCamera;s.position.getPositionFromMatrix(r.matrixWorld);l.getPositionFromMatrix(r.target.matrixWorld);s.lookAt(l);s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);r.cameraHelper&&(r.cameraHelper.visible=r.shadowCameraVisible);r.shadowCameraVisible&&r.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(s.projectionMatrix);u.multiply(s.matrixWorldInverse);
|
|
|
-h.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();F=n.__webglObjects;r=0;for(q=F.length;r<q;r++)if(w=F[r],u=w.object,w.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||g.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,u.matrixWorld),w.render=!0;r=0;for(q=F.length;r<q;r++)w=F[r],w.render&&(u=w.object,w=w.buffer,E=u.material instanceof THREE.MeshFaceMaterial?
|
|
|
-u.material.materials[0]:u.material,y=0<u.geometry.morphTargets.length&&E.morphTargets,E=u instanceof THREE.SkinnedMesh&&E.skinning,y=u.customDepthMaterial?u.customDepthMaterial:E?y?f:e:y?d:c,w instanceof THREE.BufferGeometry?b.renderBufferDirect(s,n.__lights,null,y,w,u):b.renderBuffer(s,n.__lights,null,y,w,u));F=n.__webglObjectsImmediate;r=0;for(q=F.length;r<q;r++)w=F[r],u=w.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(s,
|
|
|
-n.__lights,null,c,u))}p=b.getClearColor();t=b.getClearAlpha();a.clearColor(p.r,p.g,p.b,t);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,j,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,
|
|
|
-e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),t=b.createShader(b.VERTEX_SHADER),r="precision "+d+" float;\n";b.shaderSource(p,r+a.fragmentShader);b.shaderSource(t,r+a.vertexShader);b.compileShader(p);b.compileShader(t);b.attachShader(m,p);b.attachShader(m,t);b.linkProgram(m);i=m;j={};l={};j.position=b.getAttribLocation(i,"position");j.uv=b.getAttribLocation(i,
|
|
|
-"uv");l.uvOffset=b.getUniformLocation(i,"uvOffset");l.uvScale=b.getUniformLocation(i,"uvScale");l.rotation=b.getUniformLocation(i,"rotation");l.scale=b.getUniformLocation(i,"scale");l.alignment=b.getUniformLocation(i,"alignment");l.color=b.getUniformLocation(i,"color");l.map=b.getUniformLocation(i,"map");l.opacity=b.getUniformLocation(i,"opacity");l.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");l.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");l.screenPosition=b.getUniformLocation(i,
|
|
|
-"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,t){var r=d.__webglSprites,q=r.length;if(q){var s=j,u=l,w=t/
|
|
|
-f,f=0.5*f,y=0.5*t;b.useProgram(i);b.enableVertexAttribArray(s.position);b.enableVertexAttribArray(s.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(s.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(s.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);var F=s=0,J=d.fog;J?(b.uniform3f(u.fogColor,J.color.r,J.color.g,J.color.b),
|
|
|
-J instanceof THREE.Fog?(b.uniform1f(u.fogNear,J.near),b.uniform1f(u.fogFar,J.far),b.uniform1i(u.fogType,1),F=s=1):J instanceof THREE.FogExp2&&(b.uniform1f(u.fogDensity,J.density),b.uniform1i(u.fogType,2),F=s=2)):(b.uniform1i(u.fogType,0),F=s=0);for(var B,E,z=[],J=0;J<q;J++)B=r[J],E=B.material,B.visible&&0!==E.opacity&&(E.useScreenCoordinates?B.z=-B.position.z:(B._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,B.matrixWorld),B.z=-B._modelViewMatrix.elements[14]));r.sort(a);for(J=0;J<q;J++)B=
|
|
|
-r[J],E=B.material,B.visible&&0!==E.opacity&&(E.map&&E.map.image&&E.map.image.width)&&(b.uniform1f(u.alphaTest,E.alphaTest),!0===E.useScreenCoordinates?(b.uniform1i(u.useScreenCoordinates,1),b.uniform3f(u.screenPosition,(B.position.x*c.devicePixelRatio-f)/f,(y-B.position.y*c.devicePixelRatio)/y,Math.max(0,Math.min(1,B.position.z))),z[0]=c.devicePixelRatio,z[1]=c.devicePixelRatio):(b.uniform1i(u.useScreenCoordinates,0),b.uniform1i(u.sizeAttenuation,E.sizeAttenuation?1:0),b.uniformMatrix4fv(u.modelViewMatrix,
|
|
|
-!1,B._modelViewMatrix.elements),z[0]=1,z[1]=1),e=d.fog&&E.fog?F:0,s!==e&&(b.uniform1i(u.fogType,e),s=e),e=1/(E.scaleByViewport?t:1),z[0]*=e*w*B.scale.x,z[1]*=e*B.scale.y,b.uniform2f(u.uvScale,E.uvScale.x,E.uvScale.y),b.uniform2f(u.uvOffset,E.uvOffset.x,E.uvOffset.y),b.uniform2f(u.alignment,E.alignment.x,E.alignment.y),b.uniform1f(u.opacity,E.opacity),b.uniform3f(u.color,E.color.r,E.color.g,E.color.b),b.uniform1f(u.rotation,B.rotation),b.uniform2fv(u.scale,z),c.setBlending(E.blending,E.blendEquation,
|
|
|
-E.blendSrc,E.blendDst),c.setDepthTest(E.depthTest),c.setDepthWrite(E.depthWrite),c.setTexture(E.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;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,b){this.enabled&&this.update(a,b)};this.update=function(i,j){var l,n,m,p,t,r;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();j.matrixWorldInverse.getInverse(j.matrixWorld);h.multiplyMatrices(j.projectionMatrix,
|
|
|
-j.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();r=i.__webglObjects;l=0;for(n=r.length;l<n;l++)if(m=r[l],t=m.object,m.render=!1,t.visible&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||g.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,t.matrixWorld),m.render=!0;var q;l=0;for(n=r.length;l<n;l++)if(m=r[l],m.render&&(t=m.object,m=m.buffer,!(t instanceof THREE.ParticleSystem)||t.customDepthMaterial))(q=
|
|
|
-t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material)&&b.setMaterialFaces(t.material),p=0<t.geometry.morphTargets.length&&q.morphTargets,q=t instanceof THREE.SkinnedMesh&&q.skinning,p=t.customDepthMaterial?t.customDepthMaterial:q?p?f:e:p?d:c,m instanceof THREE.BufferGeometry?b.renderBufferDirect(j,i.__lights,null,p,m,t):b.renderBuffer(j,i.__lights,null,p,m,t);r=i.__webglObjectsImmediate;l=0;for(n=r.length;l<n;l++)m=r[l],t=m.object,t.visible&&(t._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,
|
|
|
-t.matrixWorld),b.renderImmediateObject(j,i.__lights,null,c,t));l=b.getClearColor();n=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,n);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,p=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,p=a(THREE.ShaderFlares.lensFlareVertexTexture,d));l={};r={};l.vertex=b.getAttribLocation(p,"position");l.uv=b.getAttribLocation(p,"uv");r.renderType=b.getUniformLocation(p,"renderType");r.map=b.getUniformLocation(p,"map");r.occlusionMap=b.getUniformLocation(p,"occlusionMap");r.opacity=
|
|
|
+b.getUniformLocation(p,"opacity");r.color=b.getUniformLocation(p,"color");r.scale=b.getUniformLocation(p,"scale");r.rotation=b.getUniformLocation(p,"rotation");r.screenPosition=b.getUniformLocation(p,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,v=a.length;if(v){var y=new THREE.Vector3,D=f/e,F=0.5*e,H=0.5*f,I=16/f,G=new THREE.Vector2(I*D,I),B=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),A=r,I=l;b.useProgram(p);b.enableVertexAttribArray(l.vertex);b.enableVertexAttribArray(l.uv);
|
|
|
+b.uniform1i(A.occlusionMap,0);b.uniform1i(A.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(I.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(I.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var J,N,z,L,w;for(J=0;J<v;J++)if(I=16/f,G.set(I*D,I),L=a[J],y.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),y.applyMatrix4(d.matrixWorldInverse),y.applyProjection(d.projectionMatrix),B.copy(y),C.x=B.x*F+F,
|
|
|
+C.y=B.y*H+H,m||0<C.x&&C.x<e&&0<C.y&&C.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,C.x-8,C.y-8,16,16,0);b.uniform1i(A.renderType,0);b.uniform2f(A.scale,G.x,G.y);b.uniform3f(A.screenPosition,B.x,B.y,B.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,C.x-8,C.y-8,16,16,0);b.uniform1i(A.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);L.positionScreen.copy(B);L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares();b.uniform1i(A.renderType,2);b.enable(b.BLEND);N=0;for(z=L.lensFlares.length;N<z;N++)w=L.lensFlares[N],0.001<w.opacity&&0.001<w.scale&&(B.x=w.x,B.y=w.y,B.z=w.z,I=w.size*w.scale/f,G.x=I*D,G.y=I,b.uniform3f(A.screenPosition,B.x,B.y,B.z),b.uniform2f(A.scale,G.x,G.y),b.uniform1f(A.rotation,w.rotation),b.uniform1f(A.opacity,
|
|
|
+w.opacity),b.uniform3f(A.color,w.color.r,w.color.g,w.color.b),c.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst),c.setTexture(w.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,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,j=new THREE.Vector3,m=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(p,l){var r,t,n,s,q,v,y,D,F,H=[];s=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);r=0;for(t=p.__lights.length;r<t;r++)if(n=p.__lights[r],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(q=0;q<n.shadowCascadeCount;q++){var I;if(n.shadowCascadeArray[q])I=n.shadowCascadeArray[q];else{F=n;y=q;I=new THREE.DirectionalLight;I.isVirtual=!0;I.onlyShadow=!0;I.castShadow=!0;I.shadowCameraNear=F.shadowCameraNear;I.shadowCameraFar=F.shadowCameraFar;I.shadowCameraLeft=F.shadowCameraLeft;I.shadowCameraRight=F.shadowCameraRight;
|
|
|
+I.shadowCameraBottom=F.shadowCameraBottom;I.shadowCameraTop=F.shadowCameraTop;I.shadowCameraVisible=F.shadowCameraVisible;I.shadowDarkness=F.shadowDarkness;I.shadowBias=F.shadowCascadeBias[y];I.shadowMapWidth=F.shadowCascadeWidth[y];I.shadowMapHeight=F.shadowCascadeHeight[y];I.pointsWorld=[];I.pointsFrustum=[];D=I.pointsWorld;v=I.pointsFrustum;for(var G=0;8>G;G++)D[G]=new THREE.Vector3,v[G]=new THREE.Vector3;D=F.shadowCascadeNearZ[y];F=F.shadowCascadeFarZ[y];v[0].set(-1,-1,D);v[1].set(1,-1,D);v[2].set(-1,
|
|
|
+1,D);v[3].set(1,1,D);v[4].set(-1,-1,F);v[5].set(1,-1,F);v[6].set(-1,1,F);v[7].set(1,1,F);I.originalCamera=l;v=new THREE.Gyroscope;v.position=n.shadowCascadeOffset;v.add(I);v.add(I.target);l.add(v);n.shadowCascadeArray[q]=I;console.log("Created virtualLight",I)}y=n;D=q;F=y.shadowCascadeArray[D];F.position.copy(y.position);F.target.position.copy(y.target.position);F.lookAt(F.target);F.shadowCameraVisible=y.shadowCameraVisible;F.shadowDarkness=y.shadowDarkness;F.shadowBias=y.shadowCascadeBias[D];v=y.shadowCascadeNearZ[D];
|
|
|
+y=y.shadowCascadeFarZ[D];F=F.pointsFrustum;F[0].z=v;F[1].z=v;F[2].z=v;F[3].z=v;F[4].z=y;F[5].z=y;F[6].z=y;F[7].z=y;H[s]=I;s++}else H[s]=n,s++;r=0;for(t=H.length;r<t;r++){n=H[r];n.shadowMap||(q=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(q=THREE.NearestFilter),n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:q,magFilter:q,format:THREE.RGBAFormat}),n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight),n.shadowMatrix=new THREE.Matrix4);
|
|
|
+if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}p.add(n.shadowCamera);!0===p.autoUpdate&&p.updateMatrixWorld()}n.shadowCameraVisible&&
|
|
|
+!n.cameraHelper&&(n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),n.shadowCamera.add(n.cameraHelper));if(n.isVirtual&&I.originalCamera==l){q=l;s=n.shadowCamera;v=n.pointsFrustum;F=n.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(y=0;8>y;y++)D=F[y],D.copy(v[y]),THREE.ShadowMapPlugin.__projector.unprojectVector(D,q),D.applyMatrix4(s.matrixWorldInverse),D.x<i.x&&(i.x=D.x),D.x>j.x&&(j.x=D.x),D.y<i.y&&(i.y=D.y),D.y>j.y&&(j.y=D.y),D.z<i.z&&(i.z=D.z),D.z>j.z&&
|
|
|
+(j.z=D.z);s.left=i.x;s.right=j.x;s.top=j.y;s.bottom=i.y;s.updateProjectionMatrix()}s=n.shadowMap;v=n.shadowMatrix;q=n.shadowCamera;q.position.getPositionFromMatrix(n.matrixWorld);m.getPositionFromMatrix(n.target.matrixWorld);q.lookAt(m);q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);n.cameraHelper&&(n.cameraHelper.visible=n.shadowCameraVisible);n.shadowCameraVisible&&n.cameraHelper.update();v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiply(q.projectionMatrix);v.multiply(q.matrixWorldInverse);
|
|
|
+g.multiplyMatrices(q.projectionMatrix,q.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(s);b.clear();F=p.__webglObjects;n=0;for(s=F.length;n<s;n++)if(y=F[n],v=y.object,y.render=!1,v.visible&&v.castShadow&&(!(v instanceof THREE.Mesh||v instanceof THREE.ParticleSystem)||!v.frustumCulled||h.intersectsObject(v)))v._modelViewMatrix.multiplyMatrices(q.matrixWorldInverse,v.matrixWorld),y.render=!0;n=0;for(s=F.length;n<s;n++)y=F[n],y.render&&(v=y.object,y=y.buffer,G=v.material instanceof THREE.MeshFaceMaterial?
|
|
|
+v.material.materials[0]:v.material,D=0<v.geometry.morphTargets.length&&G.morphTargets,G=v instanceof THREE.SkinnedMesh&&G.skinning,D=v.customDepthMaterial?v.customDepthMaterial:G?D?f:e:D?d:c,y instanceof THREE.BufferGeometry?b.renderBufferDirect(q,p.__lights,null,D,y,v):b.renderBuffer(q,p.__lights,null,D,y,v));F=p.__webglObjectsImmediate;n=0;for(s=F.length;n<s;n++)y=F[n],v=y.object,v.visible&&v.castShadow&&(v._modelViewMatrix.multiplyMatrices(q.matrixWorldInverse,v.matrixWorld),b.renderImmediateObject(q,
|
|
|
+p.__lights,null,c,v))}r=b.getClearColor();t=b.getClearAlpha();a.clearColor(r.r,r.g,r.b,t);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,h,g,i,j,m;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,
|
|
|
+e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),r=b.createShader(b.FRAGMENT_SHADER),t=b.createShader(b.VERTEX_SHADER),n="precision "+d+" float;\n";b.shaderSource(r,n+a.fragmentShader);b.shaderSource(t,n+a.vertexShader);b.compileShader(r);b.compileShader(t);b.attachShader(l,r);b.attachShader(l,t);b.linkProgram(l);i=l;j={};m={};j.position=b.getAttribLocation(i,"position");j.uv=b.getAttribLocation(i,
|
|
|
+"uv");m.uvOffset=b.getUniformLocation(i,"uvOffset");m.uvScale=b.getUniformLocation(i,"uvScale");m.rotation=b.getUniformLocation(i,"rotation");m.scale=b.getUniformLocation(i,"scale");m.alignment=b.getUniformLocation(i,"alignment");m.color=b.getUniformLocation(i,"color");m.map=b.getUniformLocation(i,"map");m.opacity=b.getUniformLocation(i,"opacity");m.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");m.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");m.screenPosition=b.getUniformLocation(i,
|
|
|
+"screenPosition");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");m.fogType=b.getUniformLocation(i,"fogType");m.fogDensity=b.getUniformLocation(i,"fogDensity");m.fogNear=b.getUniformLocation(i,"fogNear");m.fogFar=b.getUniformLocation(i,"fogFar");m.fogColor=b.getUniformLocation(i,"fogColor");m.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,t){var n=d.__webglSprites,s=n.length;if(s){var q=j,v=m,y=t/
|
|
|
+f,f=0.5*f,D=0.5*t;b.useProgram(i);b.enableVertexAttribArray(q.position);b.enableVertexAttribArray(q.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(q.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(v.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(v.map,0);var F=q=0,H=d.fog;H?(b.uniform3f(v.fogColor,H.color.r,H.color.g,H.color.b),
|
|
|
+H instanceof THREE.Fog?(b.uniform1f(v.fogNear,H.near),b.uniform1f(v.fogFar,H.far),b.uniform1i(v.fogType,1),F=q=1):H instanceof THREE.FogExp2&&(b.uniform1f(v.fogDensity,H.density),b.uniform1i(v.fogType,2),F=q=2)):(b.uniform1i(v.fogType,0),F=q=0);for(var I,G,B=[],H=0;H<s;H++)I=n[H],G=I.material,I.visible&&0!==G.opacity&&(G.useScreenCoordinates?I.z=-I.position.z:(I._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,I.matrixWorld),I.z=-I._modelViewMatrix.elements[14]));n.sort(a);for(H=0;H<s;H++)I=
|
|
|
+n[H],G=I.material,I.visible&&0!==G.opacity&&(G.map&&G.map.image&&G.map.image.width)&&(b.uniform1f(v.alphaTest,G.alphaTest),!0===G.useScreenCoordinates?(b.uniform1i(v.useScreenCoordinates,1),b.uniform3f(v.screenPosition,(I.position.x*c.devicePixelRatio-f)/f,(D-I.position.y*c.devicePixelRatio)/D,Math.max(0,Math.min(1,I.position.z))),B[0]=c.devicePixelRatio,B[1]=c.devicePixelRatio):(b.uniform1i(v.useScreenCoordinates,0),b.uniform1i(v.sizeAttenuation,G.sizeAttenuation?1:0),b.uniformMatrix4fv(v.modelViewMatrix,
|
|
|
+!1,I._modelViewMatrix.elements),B[0]=1,B[1]=1),e=d.fog&&G.fog?F:0,q!==e&&(b.uniform1i(v.fogType,e),q=e),e=1/(G.scaleByViewport?t:1),B[0]*=e*y*I.scale.x,B[1]*=e*I.scale.y,b.uniform2f(v.uvScale,G.uvScale.x,G.uvScale.y),b.uniform2f(v.uvOffset,G.uvOffset.x,G.uvOffset.y),b.uniform2f(v.alignment,G.alignment.x,G.alignment.y),b.uniform1f(v.opacity,G.opacity),b.uniform3f(v.color,G.color.r,G.color.g,G.color.b),b.uniform1f(v.rotation,I.rotation),b.uniform2fv(v.scale,B),c.setBlending(G.blending,G.blendEquation,
|
|
|
+G.blendSrc,G.blendDst),c.setDepthTest(G.depthTest),c.setDepthWrite(G.depthWrite),c.setTexture(G.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;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,b){this.enabled&&this.update(a,b)};this.update=function(i,j){var m,p,l,r,t,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();j.matrixWorldInverse.getInverse(j.matrixWorld);g.multiplyMatrices(j.projectionMatrix,
|
|
|
+j.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();n=i.__webglObjects;m=0;for(p=n.length;m<p;m++)if(l=n[m],t=l.object,l.render=!1,t.visible&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||h.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,t.matrixWorld),l.render=!0;var s;m=0;for(p=n.length;m<p;m++)if(l=n[m],l.render&&(t=l.object,l=l.buffer,!(t instanceof THREE.ParticleSystem)||t.customDepthMaterial))(s=
|
|
|
+t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material)&&b.setMaterialFaces(t.material),r=0<t.geometry.morphTargets.length&&s.morphTargets,s=t instanceof THREE.SkinnedMesh&&s.skinning,r=t.customDepthMaterial?t.customDepthMaterial:s?r?f:e:r?d:c,l instanceof THREE.BufferGeometry?b.renderBufferDirect(j,i.__lights,null,r,l,t):b.renderBuffer(j,i.__lights,null,r,l,t);n=i.__webglObjectsImmediate;m=0;for(p=n.length;m<p;m++)l=n[m],t=l.object,t.visible&&(t._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,
|
|
|
+t.matrixWorld),b.renderImmediateObject(j,i.__lights,null,c,t));m=b.getClearColor();p=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,p);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},lensFlare:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
|
|
|
fragmentShader:"uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"}};
|