// threejs.org/license 'use strict';var THREE={REVISION:"68"};"object"===typeof module&&(module.exports=THREE);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;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023; THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.Color=function(a){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(a)}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){a instanceof THREE.Color?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1c?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(a){a=a||{h:0,s:0,l:0};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 k=e-f,f=0.5>=h?k/(e+f):k/(2-e-f);switch(e){case b:g=(c-d)/k+(cf&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(k-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+k)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=0.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector3);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*= -1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},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)},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);this.onChangeCallback();return this}, multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .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,k=b._z,l=b._w;this._x=c*l+f*g+d*k-e*h;this._y=d*l+f*h+e*g-c*k;this._z=e*l+f*k+c*h-d*g;this._w=f*l-c*g-d*h-e*k;this.onChangeCallback();return this},multiplyVector3:function(a){console.warn("THREE.Quaternion: .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),k=Math.sqrt(1-g*g);if(0.001>Math.abs(k))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)/k;h=Math.sin(b*h)/k;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;this.onChangeCallback();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];this.onChangeCallback();return this},toArray:function(){return[this._x,this._y,this._z,this._w]},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){},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("THREE.Vector2: .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("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this}, subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):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);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector2,b=new THREE.Vector2);a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this}, roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b= this.x-a.x;a=this.y-a.y;return b*b+a*a},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;return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a){this.x=a[0];this.y=a[1];return this},toArray:function(){return[this.x,this.y]},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=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;case 2:return this.z;default:throw Error("index is out of range: "+ 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("THREE.Vector3: .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("THREE.Vector3: .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("THREE.Vector3: .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},applyEuler:function(){var a;return function(b){!1===b instanceof THREE.Euler&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new THREE.Quaternion);this.applyQuaternion(a.setFromEuler(b));return this}}(),applyAxisAngle:function(){var a;return function(b,c){void 0===a&&(a=new THREE.Quaternion);this.applyQuaternion(a.setFromAxisAngle(b,c));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;var 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;var h=a*b+f*d-g*c,k=a*c+g*b-e*d,l=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-l*-f;this.y=k*a+b*-f+l*-e-h*-g;this.z=l*a+b*-g+h*-f-k*-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?(a=1/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.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z= b.z);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector3,b=new THREE.Vector3);a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x= 0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},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("THREE.Vector3: .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){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g;this.y=e*f-c*h;this.z=c*g-d*f;return this},projectOnVector:function(){var a,b;return function(c){void 0===a&&(a=new THREE.Vector3);a.copy(c).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a;return function(b){void 0===a&&(a=new THREE.Vector3);a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0=== a&&(a=new THREE.Vector3);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),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){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}, setEulerFromQuaternion:function(a,b){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a, b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(a,b)},setFromMatrixPosition:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setFromMatrixScale: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},setFromMatrixColumn: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.Vector4=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.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=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;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("THREE.Vector4: .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("THREE.Vector4: .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?(a=1/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;var e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],k=a[9];c=a[2];b=a[6];var l=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(k-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(k+b)&&0.1>Math.abs(e+h+l-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;l=(l+1)/2;d=(d+g)/4;f=(f+c)/4;k=(k+b)/4;e>h&&e>l?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>l?0.01>h?(b=0.707106781,c=0,d=0.707106781):(c= Math.sqrt(h),b=d/c,d=k/c):0.01>l?(c=b=0.707106781,d=0):(d=Math.sqrt(l),b=f/d,c=k/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-k)*(b-k)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-k)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+l-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.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);this.wb.w&&(this.w=b.w);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector4,b=new THREE.Vector4);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z); this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w): Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},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.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ"; THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback();return this},copy:function(a){this._x= a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b){var c=THREE.Math.clamp,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],k=d[5],l=d[9],n=d[2],q=d[6],d=d[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(c(g,-1,1)),0.99999>Math.abs(g)?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-f,e)):(this._x=Math.atan2(q,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-c(l,-1,1)),0.99999>Math.abs(l)?(this._y=Math.atan2(g,d),this._z=Math.atan2(h,k)): (this._y=Math.atan2(-n,e),this._z=0)):"ZXY"===b?(this._x=Math.asin(c(q,-1,1)),0.99999>Math.abs(q)?(this._y=Math.atan2(-n,d),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,e))):"ZYX"===b?(this._y=Math.asin(-c(n,-1,1)),0.99999>Math.abs(n)?(this._x=Math.atan2(q,d),this._z=Math.atan2(h,e)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(c(h,-1,1)),0.99999>Math.abs(h)?(this._x=Math.atan2(-l,k),this._y=Math.atan2(-n,e)):(this._x=0,this._y=Math.atan2(g,d))):"XZY"===b?(this._z= Math.asin(-c(f,-1,1)),0.99999>Math.abs(f)?(this._x=Math.atan2(q,k),this._y=Math.atan2(g,e)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;this.onChangeCallback();return this},setFromQuaternion:function(a,b,c){var d=THREE.Math.clamp,e=a.x*a.x,f=a.y*a.y,g=a.z*a.z,h=a.w*a.w;b=b||this._order;"XYZ"===b?(this._x=Math.atan2(2*(a.x*a.w-a.y*a.z),h-e-f+g),this._y=Math.asin(d(2*(a.x*a.z+a.y*a.w),-1,1)),this._z=Math.atan2(2* (a.z*a.w-a.x*a.y),h+e-f-g)):"YXZ"===b?(this._x=Math.asin(d(2*(a.x*a.w-a.y*a.z),-1,1)),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),h-e-f+g),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),h-e+f-g)):"ZXY"===b?(this._x=Math.asin(d(2*(a.x*a.w+a.y*a.z),-1,1)),this._y=Math.atan2(2*(a.y*a.w-a.z*a.x),h-e-f+g),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),h-e+f-g)):"ZYX"===b?(this._x=Math.atan2(2*(a.x*a.w+a.z*a.y),h-e-f+g),this._y=Math.asin(d(2*(a.y*a.w-a.x*a.z),-1,1)),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),h+e-f-g)):"YZX"=== b?(this._x=Math.atan2(2*(a.x*a.w-a.z*a.y),h-e+f-g),this._y=Math.atan2(2*(a.y*a.w-a.x*a.z),h+e-f-g),this._z=Math.asin(d(2*(a.x*a.y+a.z*a.w),-1,1))):"XZY"===b?(this._x=Math.atan2(2*(a.x*a.w+a.y*a.z),h-e+f-g),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),h+e-f-g),this._z=Math.asin(d(2*(a.z*a.w-a.x*a.y),-1,1))):console.warn("THREE.Euler: .setFromQuaternion() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this); this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(){return[this._x,this._y,this._z,this._order]},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}}; THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3}; THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(0.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a, b){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=THREE.Math.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}};THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)}; THREE.Box2.prototype={constructor:THREE.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector2).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.y this.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),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},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.Box2).copy(this)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)}; THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y|| a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=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,b){return(b||new THREE.Vector3).set((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.xthis.max.x||a.max.ythis.max.y|| a.max.zthis.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,k){var l=this.elements=new Float32Array(9);l[0]=void 0!==a?a:1;l[3]=b||0;l[6]=c||0;l[1]=d||0;l[4]=void 0!==e?e:1;l[7]=f||0;l[2]=g||0;l[5]=h||0;l[8]=void 0!==k?k:1}; THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,k){var l=this.elements;l[0]=a;l[3]=b;l[6]=c;l[1]=d;l[4]=e;l[7]=f;l[2]=g;l[5]=h;l[8]=k;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("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}, multiplyVector3Array:function(a){console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;ethis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.elements.set(this.elements);c=1/g;var f=1/h,l=1/k;b.elements[0]*=c;b.elements[1]*= c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=l;b.elements[9]*=l;b.elements[10]*=l;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=k;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){a=c*Math.tan(THREE.Math.degToRad(0.5*a)); var 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,k=c-d,l=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((f+e)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},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.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 0>d?c.copy(this.origin):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);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceSqToSegment:function(a,b,c,d){var e=a.clone().add(b).multiplyScalar(0.5),f=b.clone().sub(a).normalize(),g=0.5*a.distanceTo(b), h=this.origin.clone().sub(e);a=-this.direction.dot(f);b=h.dot(this.direction);var k=-h.dot(f),l=h.lengthSq(),n=Math.abs(1-a*a),q,r;0<=n?(h=a*k-b,q=a*b-k,r=g*n,0<=h?q>=-r?q<=r?(g=1/n,h*=g,q*=g,a=h*(h+a*q+2*b)+q*(a*h+q+2*k)+l):(q=g,h=Math.max(0,-(a*q+b)),a=-h*h+q*(q+2*k)+l):(q=-g,h=Math.max(0,-(a*q+b)),a=-h*h+q*(q+2*k)+l):q<=-r?(h=Math.max(0,-(-a*g+b)),q=0f)return null;f=Math.sqrt(f-e);e=d-f; d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},isIntersectionBox:function(){var a=new THREE.Vector3; return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e;if(fg||e>d)return null;if(e>c||c!== c)c=e;if(gd?null:this.at(0<=c?c:d,b)},intersectTriangle:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Vector3;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null; e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();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},setFromPoints:function(){var a=new THREE.Box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).center(d);for(var e=0,f=0,g=b.length;f=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];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],n=c[8],q=c[9],r=c[10],t=c[11],s=c[12],p=c[13],v=c[14],c=c[15];b[0].setComponents(f-a,l-g,t-n,c-s).normalize();b[1].setComponents(f+ a,l+g,t+n,c+s).normalize();b[2].setComponents(f+d,l+h,t+q,c+p).normalize();b[3].setComponents(f-d,l-h,t-q,c-p).normalize();b[4].setComponents(f-e,l-k,t-r,c-v).normalize();b[5].setComponents(f+e,l+k,t+r,c+v).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes, c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)e;e++){var f=d[e];a.x=0g&&0>f)return!1}return!0}}(), containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0}; THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d, 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&&0a&&0f||1e;e++)8==e||13==e||18==e||23==e?b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19==e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return 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:0this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1: f+2;l=this.points[c[0]];n=this.points[c[1]];q=this.points[c[2]];r=this.points[c[3]];h=g*g;k=g*h;d.x=b(l.x,n.x,q.x,r.x,g,h,k);d.y=b(l.y,n.y,q.y,r.y,g,h,k);d.z=b(l.z,n.z,q.z,r.z,g,h,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a=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)}, clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}; THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.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!==self.performance&&void 0!==self.performance.now?self.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,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},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[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.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=[],d=b.length,e=0;ee&&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.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},l=function(a, b,c){if(!0===a.visible||!0===b.visible||!0===c.visible)return!0;L[0]=a.positionScreen;L[1]=b.positionScreen;L[2]=c.positionScreen;return E.isIntersectionBox(Q.setFromPoints(L))},q=function(a,b,c){return 0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x)};return{setObject:function(a){f=a;g=f.material;h.getNormalMatrix(f.matrixWorld);d.length=0;e.length=0},projectVertex:k,checkTriangleVisibility:l, checkBackfaceCulling:q,pushVertex:function(b,c,d){n=a();n.position.set(b,c,d);k(n)},pushNormal:function(a,b,c){d.push(a,b,c)},pushUv:function(a,b){e.push(a,b)},pushLine:function(a,b){var d=r[a],e=r[b];u=c();u.id=f.id;u.v1.copy(d);u.v2.copy(e);u.z=(d.positionScreen.z+e.positionScreen.z)/2;u.material=f.material;K.elements.push(u)},pushTriangle:function(a,c,k){var n=r[a],p=r[c],t=r[k];if(!1!==l(n,p,t)&&(g.side===THREE.DoubleSide||!0===q(n,p,t))){s=b();s.id=f.id;s.v1.copy(n);s.v2.copy(p);s.v3.copy(t); s.z=(n.positionScreen.z+p.positionScreen.z+t.positionScreen.z)/3;for(n=0;3>n;n++)p=3*arguments[n],t=s.vertexNormalsModel[n],t.set(d[p],d[p+1],d[p+2]),t.applyMatrix3(h).normalize(),p=2*arguments[n],s.uvs[n].set(e[p],e[p+1]);s.vertexNormalsLength=3;s.material=f.material;K.elements.push(s)}}}};this.projectScene=function(n,t,w,v){I=D=p=0;K.elements.length=0;!0===n.autoUpdate&&n.updateMatrixWorld();void 0===t.parent&&t.updateMatrixWorld();R.copy(t.matrixWorldInverse.getInverse(t.matrixWorld));B.multiplyMatrices(t.projectionMatrix, R);H.setFromMatrix(B);h=0;K.objects.length=0;K.lights.length=0;n.traverseVisible(function(a){if(a instanceof THREE.Light)K.lights.push(a);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Sprite)if(!1===a.frustumCulled||!0===H.intersectsObject(a)){if(h===l){var b=new THREE.RenderableObject;k.push(b);l++;h++;g=b}else g=k[h++];g.id=a.id;g.object=a;null!==a.renderDepth?g.z=a.renderDepth:(O.setFromMatrixPosition(a.matrixWorld),O.applyProjection(B),g.z=O.z);K.objects.push(g)}}); !0===w&&K.objects.sort(e);n=0;for(w=K.objects.length;nva;va++)s.uvs[va].copy(ua[va]); s.color=ca.color;s.material=qa;s.z=(la.positionScreen.z+ja.positionScreen.z+Fa.positionScreen.z)/3;K.elements.push(s)}}}}}else if(A instanceof THREE.Line)if(x instanceof THREE.BufferGeometry){if(z=x.attributes,void 0!==z.position){G=z.position.array;x=0;for(y=G.length;x=J.z&&(C=d(),C.id=A.id,C.x=J.x*x,C.y=J.y*x,C.z=J.z,C.object=A,C.rotation=A.rotation,C.scale.x=A.scale.x*Math.abs(C.x-(J.x+t.projectionMatrix.elements[0])/(J.w+t.projectionMatrix.elements[12])),C.scale.y=A.scale.y*Math.abs(C.y-(J.y+t.projectionMatrix.elements[5])/ (J.w+t.projectionMatrix.elements[13])),C.material=A.material,K.elements.push(C)))}!0===v&&K.elements.sort(e);return K}};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}; 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.materialIndex=this.materialIndex;for(var b=0,c=this.vertexNormals.length;bb.max.x&&(b.max.x=e);fb.max.y&& (b.max.y=f);gb.max.z&&(b.max.z=g)}}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0);(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')},computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&& (this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;eBa?-1:1;h[4*a]=Ea.x;h[4*a+1]=Ea.y;h[4*a+2]=Ea.z;h[4*a+3]=Pa}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 c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent= {itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,k=[],l=[],n=0;np;p++)s=a[3*c+p],-1==r[s]?(q[2*p]=s,q[2*p+1]=-1,n++):r[s]k.index+b)for(k={start:f,count:0,index:g},h.push(k),n=0;6>n;n+=2)p=q[n+1],-1n;n+=2)s=q[n],p=q[n+1],-1===p&&(p=g++),r[s]=p,t[p]=s,e[f++]=p-k.index,k.count++}this.reorderBuffers(e,t,g);return this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var a=this.attributes.normal.array, b,c,d,e=0,f=a.length;ed?-1:1,e.vertexTangents[c]=new THREE.Vector4(A.x,A.y,A.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;cd;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;cc&&(h[f].counter+=1,g=h[f].hash+"_"+h[f].counter,g in this.geometryGroups||(k={id:a++,faces3:[],materialIndex:f,vertices:0,numMorphTargets:l,numMorphNormals:n},this.geometryGroups[g]=k,this.geometryGroupsList.push(k))),this.geometryGroups[g].faces3.push(d),this.geometryGroups[g].vertices+=3}}(),clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;ca.opacity)h.transparent=a.transparent;void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&&(h.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"=== a.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=e(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=e(a.colorSpecular));a.colorAmbient&&(h.ambient=e(a.colorAmbient));a.colorEmissive&&(h.emissive=e(a.colorEmissive));a.transparency&&(h.opacity=a.transparency);a.specularCoef&&(h.shininess=a.specularCoef);a.mapDiffuse&&b&&d(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap, a.mapDiffuseAnisotropy);a.mapLight&&b&&d(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&d(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&d(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&d(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapAlpha&& b&&d(h,"alphaMap",a.mapAlpha,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);a.mapBumpScale&&(h.bumpScale=a.mapBumpScale);a.mapNormal?(g=THREE.ShaderLib.normalmap,k=THREE.UniformsUtils.clone(g.uniforms),k.tNormal.value=h.normalMap,a.mapNormalFactor&&k.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),h.map&&(k.tDiffuse.value=h.map,k.enableDiffuse.value=!0),h.specularMap&&(k.tSpecular.value=h.specularMap,k.enableSpecular.value=!0),h.lightMap&&(k.tAO.value=h.lightMap, k.enableAO.value=!0),k.diffuse.value.setHex(h.color),k.specular.value.setHex(h.specular),k.ambient.value.setHex(h.ambient),k.shininess.value=h.shininess,void 0!==h.opacity&&(k.opacity.value=h.opacity),g=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:k,lights:!0,fog:!0}),h.transparent&&(g.transparent=!0)):g=new THREE[g](h);void 0!==a.DbgName&&(g.name=a.DbgName);return g}}; THREE.Loader.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=0,c=this.handlers.length;bg;g++)r=u[k++],w=v[2*r],r=v[2*r+1],w=new THREE.Vector2(w,r),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*u[k++],t.normal.set(D[q++],D[q++],D[q]),p.normal.copy(t.normal));if(s)for(d=0;4>d;d++)q=3*u[k++],s=new THREE.Vector3(D[q++], D[q++],D[q]),2!==d&&t.vertexNormals.push(s),0!==d&&p.vertexNormals.push(s);n&&(n=u[k++],n=A[n],t.color.setHex(n),p.color.setHex(n));if(b)for(d=0;4>d;d++)n=u[k++],n=A[n],2!==d&&t.vertexColors.push(new THREE.Color(n)),0!==d&&p.vertexColors.push(new THREE.Color(n));c.faces.push(t);c.faces.push(p)}else{t=new THREE.Face3;t.a=u[k++];t.b=u[k++];t.c=u[k++];h&&(h=u[k++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;dg;g++)r=u[k++],w=v[2*r],r=v[2*r+1], w=new THREE.Vector2(w,r),c.faceVertexUvs[d][h].push(w);q&&(q=3*u[k++],t.normal.set(D[q++],D[q++],D[q]));if(s)for(d=0;3>d;d++)q=3*u[k++],s=new THREE.Vector3(D[q++],D[q++],D[q]),t.vertexNormals.push(s);n&&(n=u[k++],t.color.setHex(A[n]));if(b)for(d=0;3>d;d++)n=u[k++],t.vertexColors.push(new THREE.Color(A[n]));c.faces.push(t)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;df)){var r=b.origin.distanceTo(l);rd.far||e.push({distance:r,point:k.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}();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.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype); THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0g.far||h.push({distance:C,point:x,indices:[n,q,r],face:null,faceIndex:null,object:this})}}}else for(p=n.position.array,s=k=0,A=p.length;kg.far||h.push({distance:C,point:x,indices:[n,q,r],face:null,faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(s=this.material instanceof THREE.MeshFaceMaterial,p=!0===s?this.material.materials:null,t=g.precision,v=k.vertices,w=0,u=k.faces.length;wg.far||h.push({distance:C,point:x,face:D,faceIndex:w,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.accumulatedSclWeight=this.accumulatedPosWeight=this.accumulatedRotWeight=0};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype); THREE.Bone.prototype.updateMatrixWorld=function(a){THREE.Object3D.prototype.updateMatrixWorld.call(this,a);this.accumulatedSclWeight=this.accumulatedPosWeight=this.accumulatedRotWeight=0}; THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=256h.end&&(h.end=e);b||(b=g)}}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=(c.end-c.start)/b*1E3,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}; THREE.MorphAnimMesh.prototype.interpolateTargets=function(a,b,c){for(var d=this.morphTargetInfluences,e=0,f=d.length;e=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;dthis.scale.x||c.push({distance:d,point:this.position,face:null,object:this})}}();THREE.Sprite.prototype.updateMatrix=function(){this.matrix.compose(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.Particle=THREE.Sprite;THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;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)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}this.dispatchEvent({type:"objectAdded",object:a});a.dispatchEvent({type:"addedToScene",scene:this});for(b=0;bE&&O.clearRect(aa.min.x|0,aa.min.y|0,aa.max.x-aa.min.x|0,aa.max.y-aa.min.y|0),0$.positionScreen.z||1<$.positionScreen.z)continue;if(-1>X.positionScreen.z||1T.positionScreen.z||1=S||(S*=V.intensity,R.add(Za.multiplyScalar(S)))):V instanceof THREE.PointLight&&(da=Ga.setFromMatrixPosition(V.matrixWorld),S=ea.dot(Ga.subVectors(da,H).normalize()),0>=S||(S*=0==V.distance?1:1-Math.min(H.distanceTo(da)/V.distance,1),0!=S&&(S*=V.intensity,R.add(Za.multiplyScalar(S)))));G.multiply(Ba).add(Ya);!0===E.wireframe?b(G,E.wireframeLinewidth,E.wireframeLinecap,E.wireframeLinejoin):c(G)}else E instanceof THREE.MeshBasicMaterial||E instanceof THREE.MeshLambertMaterial||E instanceof THREE.MeshPhongMaterial?null!==E.map?E.map.mapping instanceof THREE.UVMapping&&(ca=J.uvs,f(ya,Ea,Aa,za,Oa,Pa,ca[0].x,ca[0].y,ca[1].x,ca[1].y,ca[2].x,ca[2].y,E.map)):null!==E.envMap?E.envMap.mapping instanceof THREE.SphericalReflectionMapping?(ma.copy(J.vertexNormalsModel[0]).applyMatrix3(Ja),la=0.5*ma.x+0.5,qa=0.5*ma.y+0.5,ma.copy(J.vertexNormalsModel[1]).applyMatrix3(Ja),ua=0.5*ma.x+0.5,ja=0.5*ma.y+0.5,ma.copy(J.vertexNormalsModel[2]).applyMatrix3(Ja),Fa=0.5*ma.x+0.5,va=0.5*ma.y+0.5,f(ya,Ea,Aa,za, Oa,Pa,la,qa,ua,ja,Fa,va,E.envMap)):E.envMap.mapping instanceof THREE.SphericalRefractionMapping&&(ma.copy(J.vertexNormalsModel[0]).applyMatrix3(Ja),la=-0.5*ma.x+0.5,qa=-0.5*ma.y+0.5,ma.copy(J.vertexNormalsModel[1]).applyMatrix3(Ja),ua=-0.5*ma.x+0.5,ja=-0.5*ma.y+0.5,ma.copy(J.vertexNormalsModel[2]).applyMatrix3(Ja),Fa=-0.5*ma.x+0.5,va=-0.5*ma.y+0.5,f(ya,Ea,Aa,za,Oa,Pa,la,qa,ua,ja,Fa,va,E.envMap)):(G.copy(E.color),E.vertexColors===THREE.FaceColors&&G.multiply(J.color),!0===E.wireframe?b(G,E.wireframeLinewidth, E.wireframeLinecap,E.wireframeLinejoin):c(G)):(E instanceof THREE.MeshDepthMaterial?G.r=G.g=G.b=1-p(H.positionScreen.z*H.positionScreen.w,oa.near,oa.far):E instanceof THREE.MeshNormalMaterial?(ma.copy(J.normalModel).applyMatrix3(Ja),G.setRGB(ma.x,ma.y,ma.z).multiplyScalar(0.5).addScalar(0.5)):G.setRGB(1,1,1),!0===E.wireframe?b(G,E.wireframeLinewidth,E.wireframeLinecap,E.wireframeLinejoin):c(G))}}aa.union(ra)}}O.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={}; THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( gl_FragColor.a < ALPHATEST ) discard;\n\n#endif\n";THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n\tvec3 dirVector = normalize( lDirection.xyz );\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( pointLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat lDistance = 1.0;\n\t\t\tif ( spotLightDistance[ i ] > 0.0 )\n\t\t\t\tlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n\t\tvec3 lVector = normalize( lDirection.xyz );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n\n#endif"; THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif";THREE.ShaderChunk.default_vertex="vec4 mvPosition;\n\n#ifdef USE_SKINNING\n\n\tmvPosition = modelViewMatrix * skinned;\n\n#endif\n\n#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )\n\n\tmvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#endif\n\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )\n\n\tmvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;"; THREE.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif";THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n\t#endif\n\n#endif\n"; THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif";THREE.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif";THREE.ShaderChunk.lights_phong_fragment="vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef DOUBLE_SIDED\n\n\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tvec3 pointDiffuse = vec3( 0.0 );\n\tvec3 pointSpecular = vec3( 0.0 );\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( pointLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\n\t\t\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\tpointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\tpointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tvec3 spotDiffuse = vec3( 0.0 );\n\tvec3 spotSpecular = vec3( 0.0 );\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( spotLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\tspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\n\n\t\t\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\tspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tvec3 dirDiffuse = vec3( 0.0 );\n\tvec3 dirSpecular = vec3( 0.0 );\n\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n\t\tvec3 dirVector = normalize( lDirection.xyz );\n\n\t\t\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\tdirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\tdirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tvec3 hemiDiffuse = vec3( 0.0 );\n\tvec3 hemiSpecular = vec3( 0.0 );\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n\t\tvec3 lVector = normalize( lDirection.xyz );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\themiDiffuse += diffuse * hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\themiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n\n#if MAX_DIR_LIGHTS > 0\n\n\ttotalDiffuse += dirDiffuse;\n\ttotalSpecular += dirSpecular;\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\ttotalDiffuse += hemiDiffuse;\n\ttotalSpecular += hemiSpecular;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\ttotalDiffuse += pointDiffuse;\n\ttotalSpecular += pointSpecular;\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\ttotalDiffuse += spotDiffuse;\n\ttotalSpecular += spotSpecular;\n\n#endif\n\n#ifdef METAL\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n\n#else\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n\n#endif"; THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif";THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif"; THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\tuniform samplerCube envMap;\n\tuniform float flipEnvMap;\n\tuniform int combine;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\n\t\tuniform bool useRefract;\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif";THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif"; THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t\t\t// Per-Pixel Tangent Space Normal Mapping\n\t\t\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n"; THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n";THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif";THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif"; THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif";THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\t#ifdef GAMMA_INPUT\n\n\t\ttexelColor.xyz *= texelColor.xyz;\n\n\t#endif\n\n\tgl_FragColor = gl_FragColor * texelColor;\n\n#endif";THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\n\n#endif"; THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n\tgl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n\n#endif";THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n";THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\t#ifdef GAMMA_INPUT\n\n\t\tvColor = color * color;\n\n\t#else\n\n\t\tvColor = color;\n\n\t#endif\n\n#endif";THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n"; THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\tuniform bool useRefract;\n\n#endif\n";THREE.ShaderChunk.linear_to_gamma_fragment="#ifdef GAMMA_OUTPUT\n\n\tgl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n\n#endif";THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif";THREE.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\n\nuniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n"; THREE.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n";THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\tvec3 reflectVec;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\n\t\tvec3 worldNormal = normalize( vec3( vec4( normal, 0.0 ) * viewMatrix ) );\n\n\t\tif ( useRefract ) {\n\n\t\t\treflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t} else { \n\n\t\t\treflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t}\n\n\t#else\n\n\t\treflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t\tvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#else\n\n\t\tvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#endif\n\n\t#ifdef GAMMA_INPUT\n\n\t\tcubeColor.xyz *= cubeColor.xyz;\n\n\t#endif\n\n\tif ( combine == 1 ) {\n\n\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n\n\t} else if ( combine == 2 ) {\n\n\t\tgl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n\n\t} else {\n\n\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n\n\t}\n\n#endif"; THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif";THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max(1e-6, gl_Position.w + 1.0)) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif";THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif"; THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif";THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tconst float LOG2 = 1.442695;\n\t\tfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\n\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\tgl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n\n#endif"; THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t\t\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t\t\t//\thttp://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t\t\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif"; THREE.ShaderChunk.defaultnormal_vertex="vec3 objectNormal;\n\n#ifdef USE_SKINNING\n\n\tobjectNormal = skinnedNormal.xyz;\n\n#endif\n\n#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )\n\n\tobjectNormal = morphedNormal;\n\n#endif\n\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )\n\n\tobjectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;"; THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;"; THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif";THREE.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif"; THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\tgl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n\n#endif";THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif";THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tgl_FragColor = gl_FragColor * vec4( vColor, 1.0 );\n\n#endif";THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif"; THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\n\n\tvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\n\tworldNormal = normalize( worldNormal );\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\tif ( useRefract ) {\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t} else {\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t}\n\n#endif"; THREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t#ifdef GAMMA_OUTPUT\n\n\t\tshadowColor *= shadowColor;\n\n\t#endif\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n\n#endif\n"; THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#endif\n\n\t#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#endif\n\n\t#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n#endif"; THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n#endif"; THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n"; THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif";THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tgl_FragColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n";THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n"; THREE.UniformsUtils={merge:function(a){var b,c,d,e={};for(b=0;b dashSize ) {\n\t\tdiscard;\n\t}\n\tgl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment, "}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment, "\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvNormal = normalize( normalMatrix * normal );", THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},normalmap:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i", value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new THREE.Vector2(1,1)},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},diffuse:{type:"c",value:new THREE.Color(16777215)}, specular:{type:"c",value:new THREE.Color(1118481)},ambient:{type:"c",value:new THREE.Color(16777215)},shininess:{type:"f",value:30},opacity:{type:"f",value:1},useRefract:{type:"i",value:0},refractionRatio:{type:"f",value:0.98},reflectivity:{type:"f",value:0.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,1)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),fragmentShader:["uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform bool enableReflection;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform samplerCube tCube;\nuniform vec2 uNormalScale;\nuniform bool useRefract;\nuniform float refractionRatio;\nuniform float reflectivity;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\n\tuniform vec3 wrapRGB;\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;", THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\tgl_FragColor = vec4( vec3( 1.0 ), opacity );\n\tvec3 specularTex = vec3( 1.0 );\n\tvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\n\tnormalTex.xy *= uNormalScale;\n\tnormalTex = normalize( normalTex );\n\tif( enableDiffuse ) {\n\t\t#ifdef GAMMA_INPUT\n\t\t\tvec4 texelColor = texture2D( tDiffuse, vUv );\n\t\t\ttexelColor.xyz *= texelColor.xyz;\n\t\t\tgl_FragColor = gl_FragColor * texelColor;\n\t\t#else\n\t\t\tgl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\n\t\t#endif\n\t}\n\tif( enableAO ) {\n\t\t#ifdef GAMMA_INPUT\n\t\t\tvec4 aoColor = texture2D( tAO, vUv );\n\t\t\taoColor.xyz *= aoColor.xyz;\n\t\t\tgl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;\n\t\t#else\n\t\t\tgl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;\n\t\t#endif\n\t}", THREE.ShaderChunk.alphatest_fragment,"\tif( enableSpecular )\n\t\tspecularTex = texture2D( tSpecular, vUv ).xyz;\n\tmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );\n\tvec3 finalNormal = tsb * normalTex;\n\t#ifdef FLIP_SIDED\n\t\tfinalNormal = -finalNormal;\n\t#endif\n\tvec3 normal = normalize( finalNormal );\n\tvec3 viewPosition = normalize( vViewPosition );\n\t#if MAX_POINT_LIGHTS > 0\n\t\tvec3 pointDiffuse = vec3( 0.0 );\n\t\tvec3 pointSpecular = vec3( 0.0 );\n\t\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\t\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\t\tvec3 pointVector = lPosition.xyz + vViewPosition.xyz;\n\t\t\tfloat pointDistance = 1.0;\n\t\t\tif ( pointLightDistance[ i ] > 0.0 )\n\t\t\t\tpointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );\n\t\t\tpointVector = normalize( pointVector );\n\t\t\t#ifdef WRAP_AROUND\n\t\t\t\tfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );\n\t\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );\n\t\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\t\t\t#else\n\t\t\t\tfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\n\t\t\t#endif\n\t\t\tpointDiffuse += pointDistance * pointLightColor[ i ] * diffuse * pointDiffuseWeight;\n\t\t\tvec3 pointHalfVector = normalize( pointVector + viewPosition );\n\t\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\t\tfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( pointVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\t\tpointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;\n\t\t}\n\t#endif\n\t#if MAX_SPOT_LIGHTS > 0\n\t\tvec3 spotDiffuse = vec3( 0.0 );\n\t\tvec3 spotSpecular = vec3( 0.0 );\n\t\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\t\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\t\tvec3 spotVector = lPosition.xyz + vViewPosition.xyz;\n\t\t\tfloat spotDistance = 1.0;\n\t\t\tif ( spotLightDistance[ i ] > 0.0 )\n\t\t\t\tspotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );\n\t\t\tspotVector = normalize( spotVector );\n\t\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\t\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\t\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\t\t\t\t#ifdef WRAP_AROUND\n\t\t\t\t\tfloat spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );\n\t\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );\n\t\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\t\t\t\t#else\n\t\t\t\t\tfloat spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );\n\t\t\t\t#endif\n\t\t\t\tspotDiffuse += spotDistance * spotLightColor[ i ] * diffuse * spotDiffuseWeight * spotEffect;\n\t\t\t\tvec3 spotHalfVector = normalize( spotVector + viewPosition );\n\t\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\t\tfloat spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\t\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\t\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( spotVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\t\tspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;\n\t\t\t}\n\t\t}\n\t#endif\n\t#if MAX_DIR_LIGHTS > 0\n\t\tvec3 dirDiffuse = vec3( 0.0 );\n\t\tvec3 dirSpecular = vec3( 0.0 );\n\t\tfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\n\t\t\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n\t\t\tvec3 dirVector = normalize( lDirection.xyz );\n\t\t\t#ifdef WRAP_AROUND\n\t\t\t\tfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );\n\t\t\t\tfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );\n\t\t\t\tvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );\n\t\t\t#else\n\t\t\t\tfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\n\t\t\t#endif\n\t\t\tdirDiffuse += directionalLightColor[ i ] * diffuse * dirDiffuseWeight;\n\t\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\t\tfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\t\tdirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\t\t}\n\t#endif\n\t#if MAX_HEMI_LIGHTS > 0\n\t\tvec3 hemiDiffuse = vec3( 0.0 );\n\t\tvec3 hemiSpecular = vec3( 0.0 );\n\t\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\t\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n\t\t\tvec3 lVector = normalize( lDirection.xyz );\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\t\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\t\t\themiDiffuse += diffuse * hemiColor;\n\t\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\t\tfloat hemiSpecularWeightSky = specularTex.r * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\t\t\tvec3 lVectorGround = -lVector;\n\t\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\t\tfloat hemiSpecularWeightGround = specularTex.r * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\t\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\t\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\t\themiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\t\t}\n\t#endif\n\tvec3 totalDiffuse = vec3( 0.0 );\n\tvec3 totalSpecular = vec3( 0.0 );\n\t#if MAX_DIR_LIGHTS > 0\n\t\ttotalDiffuse += dirDiffuse;\n\t\ttotalSpecular += dirSpecular;\n\t#endif\n\t#if MAX_HEMI_LIGHTS > 0\n\t\ttotalDiffuse += hemiDiffuse;\n\t\ttotalSpecular += hemiSpecular;\n\t#endif\n\t#if MAX_POINT_LIGHTS > 0\n\t\ttotalDiffuse += pointDiffuse;\n\t\ttotalSpecular += pointSpecular;\n\t#endif\n\t#if MAX_SPOT_LIGHTS > 0\n\t\ttotalDiffuse += spotDiffuse;\n\t\ttotalSpecular += spotSpecular;\n\t#endif\n\t#ifdef METAL\n\t\tgl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n\t#else\n\t\tgl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n\t#endif\n\tif ( enableReflection ) {\n\t\tvec3 vReflect;\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tif ( useRefract ) {\n\t\t\tvReflect = refract( cameraToVertex, normal, refractionRatio );\n\t\t} else {\n\t\t\tvReflect = reflect( cameraToVertex, normal );\n\t\t}\n\t\tvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n\t\t#ifdef GAMMA_INPUT\n\t\t\tcubeColor.xyz *= cubeColor.xyz;\n\t\t#endif\n\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * reflectivity );\n\t}", 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\n\tuniform sampler2D tDisplacement;\n\tuniform float uDisplacementScale;\n\tuniform 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,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"\t#ifdef USE_SKINNING\n\t\tvNormal = normalize( normalMatrix * skinnedNormal.xyz );\n\t\tvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\n\t\tvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n\t#else\n\t\tvNormal = normalize( normalMatrix * normal );\n\t\tvTangent = normalize( normalMatrix * tangent.xyz );\n\t#endif\n\tvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\n\tvUv = uv * uRepeat + uOffset;\n\tvec3 displacedPosition;\n\t#ifdef VERTEX_TEXTURES\n\t\tif ( enableDisplacement ) {\n\t\t\tvec3 dv = texture2D( tDisplacement, uv ).xyz;\n\t\t\tfloat df = uDisplacementScale * dv.x + uDisplacementBias;\n\t\t\tdisplacedPosition = position + normalize( normal ) * df;\n\t\t} else {\n\t\t\t#ifdef USE_SKINNING\n\t\t\t\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\t\t\t\tvec4 skinned = vec4( 0.0 );\n\t\t\t\tskinned += boneMatX * skinVertex * skinWeight.x;\n\t\t\t\tskinned += boneMatY * skinVertex * skinWeight.y;\n\t\t\t\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\t\t\t\tskinned += boneMatW * skinVertex * skinWeight.w;\n\t\t\t\tskinned = bindMatrixInverse * skinned;\n\t\t\t\tdisplacedPosition = skinned.xyz;\n\t\t\t#else\n\t\t\t\tdisplacedPosition = position;\n\t\t\t#endif\n\t\t}\n\t#else\n\t\t#ifdef USE_SKINNING\n\t\t\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\t\t\tvec4 skinned = vec4( 0.0 );\n\t\t\tskinned += boneMatX * skinVertex * skinWeight.x;\n\t\t\tskinned += boneMatY * skinVertex * skinWeight.y;\n\t\t\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\t\t\tskinned += boneMatW * skinVertex * skinWeight.w;\n\t\t\tskinned = bindMatrixInverse * skinned;\n\t\t\tdisplacedPosition = skinned.xyz;\n\t\t#else\n\t\t\tdisplacedPosition = position;\n\t\t#endif\n\t#endif\n\tvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\n\tvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;", THREE.ShaderChunk.logdepthbuf_vertex,"\tvWorldPosition = worldPosition.xyz;\n\tvViewPosition = -mvPosition.xyz;\n\t#ifdef USE_SHADOWMAP\n\t\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\t\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\t\t}\n\t#endif\n}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\tvWorldPosition = worldPosition.xyz;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex, "void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {", THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")}}; THREE.WebGLRenderer=function(a){function b(a,b){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=m.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}} function c(a,b){var c=b.geometry,g=a.faces3,h=3*g.length,k=1*g.length,l=3*g.length,g=d(b,a),n=f(g),r=e(g),p=g.vertexColors?g.vertexColors:!1;a.__vertexArray=new Float32Array(3*h);r&&(a.__normalArray=new Float32Array(3*h));c.hasTangents&&(a.__tangentArray=new Float32Array(4*h));p&&(a.__colorArray=new Float32Array(3*h));n&&(0ja;ja++)Da=R[ja], yb[gb]=Da.x,yb[gb+1]=Da.y,yb[gb+2]=Da.z,gb+=3;else for(ja=0;3>ja;ja++)yb[gb]=ba.x,yb[gb+1]=ba.y,yb[gb+2]=ba.z,gb+=3;m.bindBuffer(m.ARRAY_BUFFER,y.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,yb,I)}if(xb&&Hb&&Q){B=0;for(N=ka.length;Bja;ja++)Ga=V[ja],cb[Sa]=Ga.x,cb[Sa+1]=Ga.y,Sa+=2;0ja;ja++)Ya=za[ja],fb[Za]=Ya.x,fb[Za+1]=Ya.y,Za+=2;0c;c++)G.autoScaleCubemaps&&!U?(g=h,f=c,r=a.image[c],u=sc,r.width<=u&&r.height<=u||(v=Math.max(r.width,r.height),q=Math.floor(r.width*u/v),u=Math.floor(r.height*u/v),v=document.createElement("canvas"),v.width=q,v.height=u,v.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,q,u),r=v),g[f]=r):h[c]=a.image[c];c=h[0];g=THREE.Math.isPowerOfTwo(c.width)&&THREE.Math.isPowerOfTwo(c.height); f=B(a.format);r=B(a.type);E(m.TEXTURE_CUBE_MAP,a,g);for(c=0;6>c;c++)if(U)for(u=h[c].mipmaps,v=0,x=u.length;v=Qb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Qb);qa+=1;return a}function N(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)} function ba(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 P(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function O(a){a!==xa&&(m.lineWidth(a),xa=a)}function J(a,b,c){Qa!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),Qa=a);!a||cb===b&&Ga===c||(m.polygonOffset(b,c),cb=b,Ga=c)}function E(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,B(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,B(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,B(b.magFilter)),m.texParameteri(a, m.TEXTURE_MIN_FILTER,B(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,R(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,R(b.minFilter)));Ta&&b.type!==THREE.FloatType&&(1b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer); G.info.memory.textures--},ic=function(a){a=a.target;a.removeEventListener("dispose",ic);Nb(a)},Tb=function(a){void 0!==a.__webglVertexBuffer&&m.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&m.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&m.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&m.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&m.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&m.deleteBuffer(a.__webglUV2Buffer); void 0!==a.__webglSkinIndicesBuffer&&m.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&m.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&m.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&m.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&m.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)m.deleteBuffer(a.__webglCustomAttributesList[b].buffer); G.info.memory.geometries--},Nb=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Ba.length;ad.numSupportedMorphTargets?(h.sort(t),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(t):0===h.length&&h.push([0,0]);for(p=0;pf;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer(); m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);Q(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture), E(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer): Q(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=wb,a=sb,d=ma,e=Ja);b!==Za&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),Za=b);Hb=c;Ib=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,setSize:function(a,b){this.width=a;this.height=b},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.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);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.WebGLProgram=function(){var a=0;return function(b,c,d,e){var f=b.context,g=d.defines,h=d.__webglShader.uniforms,k=d.attributes,l=d.__webglShader.vertexShader,n=d.__webglShader.fragmentShader,q=d.index0AttributeName;void 0===q&&!0===e.morphTargets&&(q="position");var r="SHADOWMAP_TYPE_BASIC";e.shadowMapType===THREE.PCFShadowMap?r="SHADOWMAP_TYPE_PCF":e.shadowMapType===THREE.PCFSoftShadowMap&&(r="SHADOWMAP_TYPE_PCF_SOFT");var t,s;t=[];for(var p in g)s=g[p],!1!==s&&(s="#define "+p+" "+s,t.push(s)); t=t.join("\n");g=f.createProgram();d instanceof THREE.RawShaderMaterial?b=d="":(d=["precision "+e.precision+" float;","precision "+e.precision+" int;",t,e.supportsVertexTextures?"#define VERTEX_TEXTURES":"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+ e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.useVertexTexture?"#define BONE_TEXTURE":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals?"#define USE_MORPHNORMALS":"",e.wrapAround?"#define WRAP_AROUND": "",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+r:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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\n\tattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\n\tattribute vec3 morphTarget0;\n\tattribute vec3 morphTarget1;\n\tattribute vec3 morphTarget2;\n\tattribute vec3 morphTarget3;\n\t#ifdef USE_MORPHNORMALS\n\t\tattribute vec3 morphNormal0;\n\t\tattribute vec3 morphNormal1;\n\t\tattribute vec3 morphNormal2;\n\t\tattribute vec3 morphNormal3;\n\t#else\n\t\tattribute vec3 morphTarget4;\n\t\tattribute vec3 morphTarget5;\n\t\tattribute vec3 morphTarget6;\n\t\tattribute vec3 morphTarget7;\n\t#endif\n#endif\n#ifdef USE_SKINNING\n\tattribute vec4 skinIndex;\n\tattribute vec4 skinWeight;\n#endif\n"].join("\n"), b=["precision "+e.precision+" float;","precision "+e.precision+" int;",e.bumpMap||e.normalMap?"#extension GL_OES_standard_derivatives : enable":"",t,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"",e.useFog&&e.fog?"#define USE_FOG": "",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.metal?"#define METAL":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP": "",e.shadowMapEnabled?"#define "+r:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"));l=new THREE.WebGLShader(f,f.VERTEX_SHADER,d+l);n=new THREE.WebGLShader(f,f.FRAGMENT_SHADER,b+n);f.attachShader(g,l);f.attachShader(g,n);void 0!==q&&f.bindAttribLocation(g,0,q);f.linkProgram(g);!1===f.getProgramParameter(g,f.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader."), console.error("gl.VALIDATE_STATUS",f.getProgramParameter(g,f.VALIDATE_STATUS)),console.error("gl.getError()",f.getError()));""!==f.getProgramInfoLog(g)&&console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",f.getProgramInfoLog(g));f.deleteShader(l);f.deleteShader(n);q="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences bindMatrix bindMatrixInverse".split(" ");e.useVertexTexture?(q.push("boneTexture"),q.push("boneTextureWidth"),q.push("boneTextureHeight")): q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&q.push("logDepthBufFC");for(var v in h)q.push(v);h=q;v={};q=0;for(b=h.length;qq-1?0:q-1,t=q+1>e-1?e-1:q+1,s=0>n-1?0:n-1,p=n+1>d-1?d-1:n+1,v=[],w=[0,0,h[4*(q*d+n)]/255*b];v.push([-1,0,h[4*(q*d+s)]/255*b]);v.push([-1,-1,h[4*(r*d+s)]/255*b]);v.push([0,-1,h[4*(r*d+n)]/255*b]);v.push([1,-1,h[4*(r*d+p)]/255*b]);v.push([1,0,h[4*(q*d+p)]/255*b]);v.push([1,1,h[4*(t*d+p)]/255*b]);v.push([0,1,h[4*(t*d+n)]/255* b]);v.push([-1,1,h[4*(t*d+s)]/255*b]);r=[];s=v.length;for(t=0;te)return null;var f=[],g=[],h=[],k,l,n;if(0=q--){console.log("Warning, unable to triangulate polygon!");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);n=l+1;e<=n&&(n=0);var r;a:{var t=r=void 0,s=void 0,p=void 0,v=void 0,w=void 0,u=void 0,D=void 0,A= void 0,t=a[g[k]].x,s=a[g[k]].y,p=a[g[l]].x,v=a[g[l]].y,w=a[g[n]].x,u=a[g[n]].y;if(1E-10>(p-t)*(u-s)-(v-s)*(w-t))r=!1;else{var x=void 0,C=void 0,I=void 0,z=void 0,y=void 0,K=void 0,N=void 0,ba=void 0,P=void 0,O=void 0,P=ba=N=A=D=void 0,x=w-p,C=u-v,I=t-w,z=s-u,y=p-t,K=v-s;for(r=0;rk)g=d+1;else if(0b&&(b=0);1=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;cb?b=h.x:h.xc?c=h.y:h.yd?d=h.z:h.zMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;cl&&(g=b[f],k=-k,h=b[e],l=-l),!(a.yh.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<= h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;bz||z>I)return[];k=l*n-k*q;if(0>k||k>I)return[]}else{if(0d?[]:k==d?f?[]:[g]:a<=d?[g,h]: [g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1; d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;cO){console.log("Infinite Loop! Holes left:"+ l.length+", Probably Hole outside Shape!");break}for(q=K;qh;h++)l=k[h].x+":"+k[h].y, l=n[l],void 0!==l&&(k[h]=l);return q.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a, b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()}; THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.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;b=this.aEndAngle-this.aStartAngle;0>b&&(b+=2*Math.PI);b>2*Math.PI&&(b-=2*Math.PI);b=!0===this.aClockwise?this.aEndAngle+(1-a)*(2*Math.PI-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.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;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.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+=0a.hierarchy[b].keys[c].time&&(a.hierarchy[b].keys[c].time= 0),void 0!==a.hierarchy[b].keys[c].rot&&!(a.hierarchy[b].keys[c].rot instanceof THREE.Quaternion)){var d=a.hierarchy[b].keys[c].rot;a.hierarchy[b].keys[c].rot=(new THREE.Quaternion).fromArray(d)}if(a.hierarchy[b].keys.length&&void 0!==a.hierarchy[b].keys[0].morphTargets){d={};for(c=0;cd;d++){for(var e= this.keyTypes[d],f=this.data.hierarchy[a].keys[0],g=this.getNextKeyWith(e,a,1);g.timef.index;)f=g,g=this.getNextKeyWith(e,a,g.index+1);c.prevKey[e]=f;c.nextKey[e]=g}}}; THREE.Animation.prototype.update=function(){var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,q,r,t,s,p;e=(a.length-1)*b;q=Math.floor(e);e-=q;c[0]=0===q?q:q-1;c[1]=q;c[2]=q>a.length-2?q:q+1;c[3]=q>a.length-3?q:q+2;q=a[c[0]];t=a[c[1]];s=a[c[2]];p=a[c[3]];c=e*e;r=e*c;d[0]=f(q[0],t[0],s[0],p[0],e,c,r);d[1]=f(q[1],t[1],s[1],p[1],e,c,r);d[2]=f(q[2],t[2],s[2],p[2],e,c,r);return d},f=function(a,b,c,d,e,f,r){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)* r+(-3*(b-c)-2*a-d)*f+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){f=this.data.length;if(!0===this.loop&&this.currentTime>f)this.currentTime%=f,this.reset();else if(!1===this.loop&&this.currentTime>f){this.stop();return}f=0;for(var h=this.hierarchy.length;fn;n++){var q=this.keyTypes[n],r=l.prevKey[q],t=l.nextKey[q];if(t.time<=this.currentTime){r=this.data.hierarchy[f].keys[0]; for(t=this.getNextKeyWith(q,f,1);t.timer.index;)r=t,t=this.getNextKeyWith(q,f,t.index+1);l.prevKey[q]=r;l.nextKey[q]=t}k.matrixAutoUpdate=!0;k.matrixWorldNeedsUpdate=!0;var s=(this.currentTime-r.time)/(t.time-r.time),p=r[q],v=t[q];0>s&&(s=0);1a&&(this.currentTime%=a);this.currentTime=Math.min(this.currentTime,a);a=0;for(var b=this.hierarchy.length;af.index;)f=g,g=e[f.index+1];d.prevKey= f;d.nextKey=g}g.time>=this.currentTime?f.interpolate(g,this.currentTime):f.interpolate(g,g.time);this.data.hierarchy[a].node.updateMatrix();c.matrixWorldNeedsUpdate=!0}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;cthis.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);c=this.duration/this.frames;var d=Math.floor(this.currentTime/c);d!=b&&(this.mesh.morphTargetInfluences[a]=0,this.mesh.morphTargetInfluences[b]=1,this.mesh.morphTargetInfluences[d]= 0,a=b,b=d);this.mesh.morphTargetInfluences[d]=this.currentTime%c/c;this.mesh.morphTargetInfluences[a]=1-this.mesh.morphTargetInfluences[d]}}}()}; THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var v,w=h.widthSegments,u=h.heightSegments,D=e/2,A=f/2,x=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",u=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var C=w+1,I=u+1,z=e/w,y=f/u,K=new THREE.Vector3;K[v]=0=e)return new THREE.Vector2(c,a);e=Math.sqrt(e/2)}else a=!1,1E-10e?-1E-10>g&& (a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(H=c.length;0<=--H;){e=H;f=H-1;0>f&&(f=c.length-1);for(var g=0,h=t+2*n,g=0;gMath.abs(c-k)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(q,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(k,1-f),new THREE.Vector2(n,1-g),new THREE.Vector2(r,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.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;cc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5, a.y));return a.clone()}THREE.Geometry.call(this);c=c||1;d=d||0;for(var k=this,l=0,n=a.length;lt&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>q&&(b[2].x+=1));l=0;for(n=this.vertices.length;lc.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,b,c){void 0===b&&(b=0.2*a);void 0===c&&(c=0.2*b);this.line.scale.set(1,a,1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)}; THREE.BoxHelper=function(a){var b=new THREE.BufferGeometry;b.addAttribute("position",new THREE.BufferAttribute(new Float32Array(72),3));THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);void 0!==a&&this.update(a)};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.geometry.attributes.position.array;d[0]=b.x;d[1]=b.y;d[2]=b.z;d[3]=c.x;d[4]=b.y;d[5]=b.z;d[6]=c.x;d[7]=b.y;d[8]=b.z;d[9]=c.x;d[10]=c.y;d[11]=b.z;d[12]=c.x;d[13]=c.y;d[14]=b.z;d[15]=b.x;d[16]=c.y;d[17]=b.z;d[18]=b.x;d[19]=c.y;d[20]=b.z;d[21]=b.x;d[22]=b.y;d[23]=b.z;d[24]=b.x;d[25]=b.y;d[26]=c.z;d[27]=c.x;d[28]=b.y;d[29]=c.z;d[30]=c.x;d[31]=b.y; d[32]=c.z;d[33]=c.x;d[34]=c.y;d[35]=c.z;d[36]=c.x;d[37]=c.y;d[38]=c.z;d[39]=b.x;d[40]=c.y;d[41]=c.z;d[42]=b.x;d[43]=c.y;d[44]=c.z;d[45]=b.x;d[46]=b.y;d[47]=c.z;d[48]=b.x;d[49]=b.y;d[50]=b.z;d[51]=b.x;d[52]=b.y;d[53]=c.z;d[54]=c.x;d[55]=b.y;d[56]=b.z;d[57]=c.x;d[58]=b.y;d[59]=c.z;d[60]=c.x;d[61]=c.y;d[62]=b.z;d[63]=c.x;d[64]=c.y;d[65]=c.z;d[66]=b.x;d[67]=c.y;d[68]=b.z;d[69]=b.x;d[70]=c.y;d[71]=c.z;this.geometry.attributes.position.needsUpdate=!0;this.geometry.computeBoundingSphere();this.matrixAutoUpdate= !1;this.matrixWorld=a.matrixWorld};THREE.BoundingBoxHelper=function(a,b){var c=void 0!==b?b:8947848;this.object=a;this.box=new THREE.Box3;THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:c,wireframe:!0}))};THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object);this.box.size(this.scale);this.box.center(this.position)}; 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)}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,k){a.set(g,h,k);c.unprojectVector(a,b);d=e.pointMap[d];if(void 0!==d)for(g=0,h=d.length;gs;s++){d[0]=t[g[s]];d[1]=t[g[(s+1)%3]];d.sort(f);var p=d.toString();void 0===e[p]?(e[p]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},n++):e[p].face2=q}h.addAttribute("position",new THREE.Float32Attribute(6*n,3));d=h.attributes.position.array; f=0;for(p in e)if(g=e[p],void 0===g.face2||0.9999>k[g.face1].normal.dot(k[g.face2].normal))n=l[g.vert1],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z,n=l[g.vert2],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z;THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype); THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;cb;b++)a.faces[b].color=this.colors[4>b?0:1];b=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(a,b);this.add(this.lightSphere); this.update()};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose();this.lightSphere.material.dispose()}; THREE.HemisphereLightHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity);this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity);this.lightSphere.lookAt(a.setFromMatrixPosition(this.light.matrixWorld).negate());this.lightSphere.geometry.colorsNeedUpdate=!0}}(); THREE.PointLightHelper=function(a,b){this.light=a;this.light.updateMatrixWorld();var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);THREE.Mesh.call(this,c,d);this.matrixWorld=this.light.matrixWorld;this.matrixAutoUpdate=!1};THREE.PointLightHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.PointLightHelper.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()}; THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}; THREE.SkeletonHelper=function(a){this.bones=this.getBoneList(a);for(var b=new THREE.Geometry,c=0;cp;p++){d[0]=s[g[p]];d[1]=s[g[(p+1)%3]];d.sort(f);var v=d.toString();void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++)}d=new Float32Array(6*n);r=0;for(t=n;rp;p++)n= k[q[2*r+p]],g=6*r+3*p,d[g+0]=n.x,d[g+1]=n.y,d[g+2]=n.z;h.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(a.geometry instanceof THREE.BufferGeometry){if(void 0!==a.geometry.attributes.index){for(var k=a.geometry.attributes.position.array,t=a.geometry.attributes.index.array,l=a.geometry.offsets,n=0,q=new Uint32Array(2*t.length),s=0,w=l.length;sp;p++)d[0]=g+t[r+p],d[1]=g+t[r+(p+1)%3],d.sort(f),v=d.toString(), void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++);d=new Float32Array(6*n);r=0;for(t=n;rp;p++)g=6*r+3*p,n=3*q[2*r+p],d[g+0]=k[n],d[g+1]=k[n+1],d[g+2]=k[n+2]}else for(k=a.geometry.attributes.position.array,n=k.length/3,q=n/3,d=new Float32Array(6*n),r=0,t=q;rp;p++)g=18*r+6*p,q=9*r+3*p,d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],n=9*r+(p+1)%3*3,d[g+3]=k[n],d[g+4]=k[n+1],d[g+5]=k[n+2];h.addAttribute("position",new THREE.BufferAttribute(d,3))}THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}), THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)}; THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);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;ah.end&&(h.end=f);c||(c=k)}}for(k in d)h=d[k],this.createAnimation(k,h.start,h.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;bd.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,b){var d=c.createProgram(),e=c.createShader(c.FRAGMENT_SHADER),f=c.createShader(c.VERTEX_SHADER),g="precision "+b+" float;\n";c.shaderSource(e,g+a.fragmentShader);c.shaderSource(f,g+a.vertexShader);c.compileShader(e);c.compileShader(f);c.attachShader(d,e);c.attachShader(d,f);c.linkProgram(d);return d}var b=[],c,d,e,f,g,h,k,l,n,q,r,t,s;this.init=function(b){c=b.context;d=b;e=b.getPrecision();f=new Float32Array(16);g=new Uint16Array(6);b=0;f[b++]=-1;f[b++]= -1;f[b++]=0;f[b++]=0;f[b++]=1;f[b++]=-1;f[b++]=1;f[b++]=0;f[b++]=1;f[b++]=1;f[b++]=1;f[b++]=1;f[b++]=-1;f[b++]=1;f[b++]=0;f[b++]=1;b=0;g[b++]=0;g[b++]=1;g[b++]=2;g[b++]=0;g[b++]=2;g[b++]=3;h=c.createBuffer();k=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,h);c.bufferData(c.ARRAY_BUFFER,f,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k);c.bufferData(c.ELEMENT_ARRAY_BUFFER,g,c.STATIC_DRAW);l=c.createTexture();n=c.createTexture();c.bindTexture(c.TEXTURE_2D,l);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16, 16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,n);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE); c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);0>=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(q=!1,r=a(THREE.ShaderFlares.lensFlare,e)):(q=!0,r=a(THREE.ShaderFlares.lensFlareVertexTexture,e));t={};s={};t.vertex=c.getAttribLocation(r,"position");t.uv=c.getAttribLocation(r,"uv");s.renderType=c.getUniformLocation(r,"renderType");s.map=c.getUniformLocation(r,"map");s.occlusionMap=c.getUniformLocation(r,"occlusionMap");s.opacity= c.getUniformLocation(r,"opacity");s.color=c.getUniformLocation(r,"color");s.scale=c.getUniformLocation(r,"scale");s.rotation=c.getUniformLocation(r,"rotation");s.screenPosition=c.getUniformLocation(r,"screenPosition")};this.render=function(a,e,f,g){b.length=0;a.traverseVisible(function(a){a instanceof THREE.LensFlare&&b.push(a)});if(0!==b.length){a=new THREE.Vector3;var D=g/f,A=0.5*f,x=0.5*g,C=16/g,I=new THREE.Vector2(C*D,C),z=new THREE.Vector3(1,1,0),y=new THREE.Vector2(1,1),K=s,C=t;c.useProgram(r); c.enableVertexAttribArray(t.vertex);c.enableVertexAttribArray(t.uv);c.uniform1i(K.occlusionMap,0);c.uniform1i(K.map,1);c.bindBuffer(c.ARRAY_BUFFER,h);c.vertexAttribPointer(C.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(C.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k);c.disable(c.CULL_FACE);c.depthMask(!1);for(var N=0,ba=b.length;NK;K++)C[K]=new THREE.Vector3,A[K]=new THREE.Vector3;C=x.shadowCascadeNearZ[y];x=x.shadowCascadeFarZ[y];A[0].set(-1,-1,C);A[1].set(1,-1,C);A[2].set(-1,1,C);A[3].set(1,1,C);A[4].set(-1,-1,x);A[5].set(1,-1,x);A[6].set(-1,1,x);A[7].set(1,1,x);z.originalCamera=s;A=new THREE.Gyroscope; A.position.copy(w.shadowCascadeOffset);A.add(z);A.add(z.target);s.add(A);w.shadowCascadeArray[D]=z;console.log("Created virtualLight",z)}y=w;C=D;x=y.shadowCascadeArray[C];x.position.copy(y.position);x.target.position.copy(y.target.position);x.lookAt(x.target);x.shadowCameraVisible=y.shadowCameraVisible;x.shadowDarkness=y.shadowDarkness;x.shadowBias=y.shadowCascadeBias[C];A=y.shadowCascadeNearZ[C];y=y.shadowCascadeFarZ[C];x=x.pointsFrustum;x[0].z=A;x[1].z=A;x[2].z=A;x[3].z=A;x[4].z=y;x[5].z=y;x[6].z= y;x[7].z=y;I[u]=z;u++}else I[u]=w,u++;p=0;for(v=I.length;py;y++)C=x[y],C.copy(A[y]),THREE.ShadowMapPlugin.__projector.unprojectVector(C,D),C.applyMatrix4(u.matrixWorldInverse),C.xn.x&&(n.x=C.x),C.yn.y&&(n.y=C.y),C.zn.z&&(n.z=C.z);u.left=l.x;u.right=n.x;u.top=n.y;u.bottom=l.y;u.updateProjectionMatrix()}u=w.shadowMap;A=w.shadowMatrix; D=w.shadowCamera;D.position.setFromMatrixPosition(w.matrixWorld);q.setFromMatrixPosition(w.target.matrixWorld);D.lookAt(q);D.updateMatrixWorld();D.matrixWorldInverse.getInverse(D.matrixWorld);w.cameraHelper&&(w.cameraHelper.visible=w.shadowCameraVisible);w.shadowCameraVisible&&w.cameraHelper.update();A.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);A.multiply(D.projectionMatrix);A.multiply(D.matrixWorldInverse);k.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse);h.setFromMatrix(k);c.setRenderTarget(u); c.clear();r.length=0;a(t,t,D);w=0;for(u=r.length;w 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}"].join("\n")); u.compileShader(x);u.compileShader(P);u.attachShader(w,x);u.attachShader(w,P);u.linkProgram(w);K=w;p=u.getAttribLocation(K,"position");v=u.getAttribLocation(K,"uv");a=u.getUniformLocation(K,"uvOffset");b=u.getUniformLocation(K,"uvScale");c=u.getUniformLocation(K,"rotation");d=u.getUniformLocation(K,"scale");e=u.getUniformLocation(K,"color");f=u.getUniformLocation(K,"map");g=u.getUniformLocation(K,"opacity");h=u.getUniformLocation(K,"modelViewMatrix");k=u.getUniformLocation(K,"projectionMatrix");l= u.getUniformLocation(K,"fogType");n=u.getUniformLocation(K,"fogDensity");q=u.getUniformLocation(K,"fogNear");r=u.getUniformLocation(K,"fogFar");t=u.getUniformLocation(K,"fogColor");s=u.getUniformLocation(K,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;x=w.getContext("2d");x.fillStyle="white";x.fillRect(0,0,8,8);A=new THREE.Texture(w);A.needsUpdate=!0};this.render=function(C,I,P,O){x.length=0;C.traverseVisible(function(a){a instanceof THREE.Sprite&&x.push(a)});if(0!==x.length){u.useProgram(K); u.enableVertexAttribArray(p);u.enableVertexAttribArray(v);u.disable(u.CULL_FACE);u.enable(u.BLEND);u.bindBuffer(u.ARRAY_BUFFER,z);u.vertexAttribPointer(p,2,u.FLOAT,!1,16,0);u.vertexAttribPointer(v,2,u.FLOAT,!1,16,8);u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,y);u.uniformMatrix4fv(k,!1,I.projectionMatrix.elements);u.activeTexture(u.TEXTURE0);u.uniform1i(f,0);O=P=0;var J=C.fog;J?(u.uniform3f(t,J.color.r,J.color.g,J.color.b),J instanceof THREE.Fog?(u.uniform1f(q,J.near),u.uniform1f(r,J.far),u.uniform1i(l,1), O=P=1):J instanceof THREE.FogExp2&&(u.uniform1f(n,J.density),u.uniform1i(l,2),O=P=2)):(u.uniform1i(l,0),O=P=0);for(var J=0,E=x.length;Jc.children.length;){var j=document.createElement("span");j.style.cssText="width:1px;height:30px;float:left;background-color:#113";c.appendChild(j)}var d=document.createElement("div");d.id="ms";d.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#020;display:none";f.appendChild(d);var k=document.createElement("div"); k.id="msText";k.style.cssText="color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px";k.innerHTML="MS";d.appendChild(k);var e=document.createElement("div");e.id="msGraph";e.style.cssText="position:relative;width:74px;height:30px;background-color:#0f0";for(d.appendChild(e);74>e.children.length;)j=document.createElement("span"),j.style.cssText="width:1px;height:30px;float:left;background-color:#131",e.appendChild(j);var t=function(b){s=b;switch(s){case 0:a.style.display= "block";d.style.display="none";break;case 1:a.style.display="none",d.style.display="block"}};return{REVISION:11,domElement:f,setMode:t,begin:function(){l=Date.now()},end:function(){var b=Date.now();g=b-l;n=Math.min(n,g);o=Math.max(o,g);k.textContent=g+" MS ("+n+"-"+o+")";var a=Math.min(30,30-30*(g/200));e.appendChild(e.firstChild).style.height=a+"px";r++;b>m+1E3&&(h=Math.round(1E3*r/(b-m)),p=Math.min(p,h),q=Math.max(q,h),i.textContent=h+" FPS ("+p+"-"+q+")",a=Math.min(30,30-30*(h/100)),c.appendChild(c.firstChild).style.height= a+"px",m=b,r=0);return b},update:function(){l=this.end()}}}; /** * @author dmarcos / https://github.com/dmarcos */ THREE.VRControls = function ( camera, done ) { this._camera = camera; this._init = function () { var self = this; if ( !navigator.mozGetVRDevices && !navigator.getVRDevices ) { if ( done ) { done("Your browser is not VR Ready"); } return; } if ( navigator.getVRDevices ) { navigator.getVRDevices().then( gotVRDevices ); } else { navigator.mozGetVRDevices( gotVRDevices ); } function gotVRDevices( devices ) { var vrInput; var error; for ( var i = 0; i < devices.length; ++i ) { if ( devices[i] instanceof PositionSensorVRDevice ) { vrInput = devices[i] self._vrInput = vrInput; break; // We keep the first we encounter } } if ( done ) { if ( !vrInput ) { error = 'HMD not available'; } done( error ); } } }; this._init(); this.update = function() { var camera = this._camera; var quat; var vrState = this.getVRState(); if ( !vrState ) { return; } // Applies head rotation from sensors data. if ( camera ) { camera.quaternion.fromArray( vrState.hmd.rotation ); } }; this.getVRState = function() { var vrInput = this._vrInput; var orientation; var vrState; if ( !vrInput ) { return null; } orientation = vrInput.getState().orientation; vrState = { hmd : { rotation : [ orientation.x, orientation.y, orientation.z, orientation.w ] } }; return vrState; }; };/** * @author Tim Knip / http://www.floorplanner.com/ / tim at floorplanner.com * @author Tony Parisi / http://www.tonyparisi.com/ */ THREE.ColladaLoader = function () { var COLLADA = null; var scene = null; var daeScene; var readyCallbackFunc = null; var sources = {}; var images = {}; var animations = {}; var controllers = {}; var geometries = {}; var materials = {}; var effects = {}; var cameras = {}; var lights = {}; var animData; var visualScenes; var baseUrl; var morphs; var skins; var flip_uv = true; var preferredShading = THREE.SmoothShading; var options = { // Force Geometry to always be centered at the local origin of the // containing Mesh. centerGeometry: false, // Axis conversion is done for geometries, animations, and controllers. // If we ever pull cameras or lights out of the COLLADA file, they'll // need extra work. convertUpAxis: false, subdivideFaces: true, upAxis: 'Y', // For reflective or refractive materials we'll use this cubemap defaultEnvMap: null }; var colladaUnit = 1.0; var colladaUp = 'Y'; var upConversion = null; function load ( url, readyCallback, progressCallback ) { var length = 0; if ( document.implementation && document.implementation.createDocument ) { var request = new XMLHttpRequest(); request.onreadystatechange = function() { if( request.readyState == 4 ) { if( request.status == 0 || request.status == 200 ) { if ( request.responseXML ) { readyCallbackFunc = readyCallback; parse( request.responseXML, undefined, url ); } else if ( request.responseText ) { readyCallbackFunc = readyCallback; var xmlParser = new DOMParser(); var responseXML = xmlParser.parseFromString( request.responseText, "application/xml" ); parse( responseXML, undefined, url ); } else { console.error( "ColladaLoader: Empty or non-existing file (" + url + ")" ); } } } else if ( request.readyState == 3 ) { if ( progressCallback ) { if ( length == 0 ) { length = request.getResponseHeader( "Content-Length" ); } progressCallback( { total: length, loaded: request.responseText.length } ); } } } request.open( "GET", url, true ); request.send( null ); } else { alert( "Don't know how to parse XML!" ); } } function parse( doc, callBack, url ) { COLLADA = doc; callBack = callBack || readyCallbackFunc; if ( url !== undefined ) { var parts = url.split( '/' ); parts.pop(); baseUrl = ( parts.length < 1 ? '.' : parts.join( '/' ) ) + '/'; } parseAsset(); setUpConversion(); images = parseLib( "library_images image", _Image, "image" ); materials = parseLib( "library_materials material", Material, "material" ); effects = parseLib( "library_effects effect", Effect, "effect" ); geometries = parseLib( "library_geometries geometry", Geometry, "geometry" ); cameras = parseLib( "library_cameras camera", Camera, "camera" ); lights = parseLib( "library_lights light", Light, "light" ); controllers = parseLib( "library_controllers controller", Controller, "controller" ); animations = parseLib( "library_animations animation", Animation, "animation" ); visualScenes = parseLib( "library_visual_scenes visual_scene", VisualScene, "visual_scene" ); morphs = []; skins = []; daeScene = parseScene(); scene = new THREE.Object3D(); for ( var i = 0; i < daeScene.nodes.length; i ++ ) { scene.add( createSceneGraph( daeScene.nodes[ i ] ) ); } // unit conversion scene.scale.multiplyScalar( colladaUnit ); createAnimations(); var result = { scene: scene, morphs: morphs, skins: skins, animations: animData, dae: { images: images, materials: materials, cameras: cameras, lights: lights, effects: effects, geometries: geometries, controllers: controllers, animations: animations, visualScenes: visualScenes, scene: daeScene } }; if ( callBack ) { callBack( result ); } return result; } function setPreferredShading ( shading ) { preferredShading = shading; } function parseAsset () { var elements = COLLADA.querySelectorAll('asset'); var element = elements[0]; if ( element && element.childNodes ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; switch ( child.nodeName ) { case 'unit': var meter = child.getAttribute( 'meter' ); if ( meter ) { colladaUnit = parseFloat( meter ); } break; case 'up_axis': colladaUp = child.textContent.charAt(0); break; } } } } function parseLib ( q, classSpec, prefix ) { var elements = COLLADA.querySelectorAll(q); var lib = {}; var i = 0; var elementsLength = elements.length; for ( var j = 0; j < elementsLength; j ++ ) { var element = elements[j]; var daeElement = ( new classSpec() ).parse( element ); if ( !daeElement.id || daeElement.id.length == 0 ) daeElement.id = prefix + ( i ++ ); lib[ daeElement.id ] = daeElement; } return lib; } function parseScene() { var sceneElement = COLLADA.querySelectorAll('scene instance_visual_scene')[0]; if ( sceneElement ) { var url = sceneElement.getAttribute( 'url' ).replace( /^#/, '' ); return visualScenes[ url.length > 0 ? url : 'visual_scene0' ]; } else { return null; } } function createAnimations() { animData = []; // fill in the keys recurseHierarchy( scene ); } function recurseHierarchy( node ) { var n = daeScene.getChildById( node.name, true ), newData = null; if ( n && n.keys ) { newData = { fps: 60, hierarchy: [ { node: n, keys: n.keys, sids: n.sids } ], node: node, name: 'animation_' + node.name, length: 0 }; animData.push(newData); for ( var i = 0, il = n.keys.length; i < il; i++ ) { newData.length = Math.max( newData.length, n.keys[i].time ); } } else { newData = { hierarchy: [ { keys: [], sids: [] } ] } } for ( var i = 0, il = node.children.length; i < il; i++ ) { var d = recurseHierarchy( node.children[i] ); for ( var j = 0, jl = d.hierarchy.length; j < jl; j ++ ) { newData.hierarchy.push( { keys: [], sids: [] } ); } } return newData; } function calcAnimationBounds () { var start = 1000000; var end = -start; var frames = 0; var ID; for ( var id in animations ) { var animation = animations[ id ]; ID = ID || animation.id; for ( var i = 0; i < animation.sampler.length; i ++ ) { var sampler = animation.sampler[ i ]; sampler.create(); start = Math.min( start, sampler.startTime ); end = Math.max( end, sampler.endTime ); frames = Math.max( frames, sampler.input.length ); } } return { start:start, end:end, frames:frames,ID:ID }; } function createMorph ( geometry, ctrl ) { var morphCtrl = ctrl instanceof InstanceController ? controllers[ ctrl.url ] : ctrl; if ( !morphCtrl || !morphCtrl.morph ) { console.log("could not find morph controller!"); return; } var morph = morphCtrl.morph; for ( var i = 0; i < morph.targets.length; i ++ ) { var target_id = morph.targets[ i ]; var daeGeometry = geometries[ target_id ]; if ( !daeGeometry.mesh || !daeGeometry.mesh.primitives || !daeGeometry.mesh.primitives.length ) { continue; } var target = daeGeometry.mesh.primitives[ 0 ].geometry; if ( target.vertices.length === geometry.vertices.length ) { geometry.morphTargets.push( { name: "target_1", vertices: target.vertices } ); } } geometry.morphTargets.push( { name: "target_Z", vertices: geometry.vertices } ); }; function createSkin ( geometry, ctrl, applyBindShape ) { var skinCtrl = controllers[ ctrl.url ]; if ( !skinCtrl || !skinCtrl.skin ) { console.log( "could not find skin controller!" ); return; } if ( !ctrl.skeleton || !ctrl.skeleton.length ) { console.log( "could not find the skeleton for the skin!" ); return; } var skin = skinCtrl.skin; var skeleton = daeScene.getChildById( ctrl.skeleton[ 0 ] ); var hierarchy = []; applyBindShape = applyBindShape !== undefined ? applyBindShape : true; var bones = []; geometry.skinWeights = []; geometry.skinIndices = []; //createBones( geometry.bones, skin, hierarchy, skeleton, null, -1 ); //createWeights( skin, geometry.bones, geometry.skinIndices, geometry.skinWeights ); /* geometry.animation = { name: 'take_001', fps: 30, length: 2, JIT: true, hierarchy: hierarchy }; */ if ( applyBindShape ) { for ( var i = 0; i < geometry.vertices.length; i ++ ) { geometry.vertices[ i ].applyMatrix4( skin.bindShapeMatrix ); } } } function setupSkeleton ( node, bones, frame, parent ) { node.world = node.world || new THREE.Matrix4(); node.localworld = node.localworld || new THREE.Matrix4(); node.world.copy( node.matrix ); node.localworld.copy( node.matrix ); if ( node.channels && node.channels.length ) { var channel = node.channels[ 0 ]; var m = channel.sampler.output[ frame ]; if ( m instanceof THREE.Matrix4 ) { node.world.copy( m ); node.localworld.copy(m); if(frame == 0) node.matrix.copy(m); } } if ( parent ) { node.world.multiplyMatrices( parent, node.world ); } bones.push( node ); for ( var i = 0; i < node.nodes.length; i ++ ) { setupSkeleton( node.nodes[ i ], bones, frame, node.world ); } } function setupSkinningMatrices ( bones, skin ) { // FIXME: this is dumb... for ( var i = 0; i < bones.length; i ++ ) { var bone = bones[ i ]; var found = -1; if ( bone.type != 'JOINT' ) continue; for ( var j = 0; j < skin.joints.length; j ++ ) { if ( bone.sid == skin.joints[ j ] ) { found = j; break; } } if ( found >= 0 ) { var inv = skin.invBindMatrices[ found ]; bone.invBindMatrix = inv; bone.skinningMatrix = new THREE.Matrix4(); bone.skinningMatrix.multiplyMatrices(bone.world, inv); // (IBMi * JMi) bone.animatrix = new THREE.Matrix4(); bone.animatrix.copy(bone.localworld); bone.weights = []; for ( var j = 0; j < skin.weights.length; j ++ ) { for (var k = 0; k < skin.weights[ j ].length; k ++ ) { var w = skin.weights[ j ][ k ]; if ( w.joint == found ) { bone.weights.push( w ); } } } } else { console.warn( "ColladaLoader: Could not find joint '" + bone.sid + "'." ); bone.skinningMatrix = new THREE.Matrix4(); bone.weights = []; } } } //Walk the Collada tree and flatten the bones into a list, extract the position, quat and scale from the matrix function flattenSkeleton(skeleton) { var list = []; var walk = function(parentid, node, list) { var bone = {}; bone.name = node.sid; bone.parent = parentid; bone.matrix = node.matrix; var data = [new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3()]; bone.matrix.decompose(data[0],data[1],data[2]); bone.pos = [data[0].x,data[0].y,data[0].z]; bone.scl = [data[2].x,data[2].y,data[2].z]; bone.rotq = [data[1].x,data[1].y,data[1].z,data[1].w]; list.push(bone); for(var i in node.nodes) { walk(node.sid,node.nodes[i],list); } }; walk(-1,skeleton,list); return list; } //Move the vertices into the pose that is proper for the start of the animation function skinToBindPose(geometry,skeleton,skinController) { var bones = []; setupSkeleton( skeleton, bones, -1 ); setupSkinningMatrices( bones, skinController.skin ); v = new THREE.Vector3(); var skinned = []; for(var i =0; i < geometry.vertices.length; i++) { skinned.push(new THREE.Vector3()); } for ( i = 0; i < bones.length; i ++ ) { if ( bones[ i ].type != 'JOINT' ) continue; for ( j = 0; j < bones[ i ].weights.length; j ++ ) { w = bones[ i ].weights[ j ]; vidx = w.index; weight = w.weight; o = geometry.vertices[vidx]; s = skinned[vidx]; v.x = o.x; v.y = o.y; v.z = o.z; v.applyMatrix4( bones[i].skinningMatrix ); s.x += (v.x * weight); s.y += (v.y * weight); s.z += (v.z * weight); } } for(var i =0; i < geometry.vertices.length; i++) { geometry.vertices[i] = skinned[i]; } } function applySkin ( geometry, instanceCtrl, frame ) { // TODO: get this from the renderer or options var maxbones = 30; var skinController = controllers[ instanceCtrl.url ]; frame = frame !== undefined ? frame : 40; if ( !skinController || !skinController.skin ) { console.log( 'ColladaLoader: Could not find skin controller.' ); return; } if ( !instanceCtrl.skeleton || !instanceCtrl.skeleton.length ) { console.log( 'ColladaLoader: Could not find the skeleton for the skin. ' ); return; } var animationBounds = calcAnimationBounds(); var skeleton = daeScene.getChildById( instanceCtrl.skeleton[0], true ) || daeScene.getChildBySid( instanceCtrl.skeleton[0], true ); //flatten the skeleton into a list of bones var bonelist = flattenSkeleton(skeleton); var joints = skinController.skin.joints; //sort that list so that the order reflects the order in the joint list var sortedbones = []; for(var i = 0; i < joints.length; i++) { for(var j =0; j < bonelist.length; j++) { if(bonelist[j].name == joints[i]) { sortedbones[i] = bonelist[j]; } } } //hook up the parents by index instead of name for(var i = 0; i < sortedbones.length; i++) { for(var j =0; j < sortedbones.length; j++) { if(sortedbones[i].parent == sortedbones[j].name) { sortedbones[i].parent = j; } } } var i, j, w, vidx, weight; var v = new THREE.Vector3(), o, s; // move vertices to bind shape for ( i = 0; i < geometry.vertices.length; i ++ ) { geometry.vertices[i].applyMatrix4( skinController.skin.bindShapeMatrix ); } var skinIndices = []; var skinWeights = []; var weights = skinController.skin.weights; //hook up the skin weights // TODO - this might be a good place to choose greatest 4 weights for(var i =0; i < weights.length; i++) { var indicies = new THREE.Vector4(weights[i][0]?weights[i][0].joint:0,weights[i][1]?weights[i][1].joint:0,weights[i][2]?weights[i][2].joint:0,weights[i][3]?weights[i][3].joint:0); var weight = new THREE.Vector4(weights[i][0]?weights[i][0].weight:0,weights[i][1]?weights[i][1].weight:0,weights[i][2]?weights[i][2].weight:0,weights[i][3]?weights[i][3].weight:0); skinIndices.push(indicies); skinWeights.push(weight); } geometry.skinIndices = skinIndices; geometry.skinWeights = skinWeights; geometry.bones = sortedbones; // process animation, or simply pose the rig if no animation //create an animation for the animated bones //NOTE: this has no effect when using morphtargets var animationdata = {"name":animationBounds.ID,"fps":30,"length":animationBounds.frames/30,"hierarchy":[]}; for(var j =0; j < sortedbones.length; j++) { animationdata.hierarchy.push({parent:sortedbones[j].parent, name:sortedbones[j].name, keys:[]}); } //if using hardware skinning, move the vertices into the binding pose if(sortedbones.length < maxbones) { skinToBindPose(geometry,skeleton,skinController); } for ( frame = 0; frame < animationBounds.frames; frame ++ ) { var bones = []; var skinned = []; // process the frame and setup the rig with a fresh // transform, possibly from the bone's animation channel(s) setupSkeleton( skeleton, bones, frame ); setupSkinningMatrices( bones, skinController.skin ); //if using hardware skinning, just hook up the animiation data if(sortedbones.length < maxbones) { for(var i = 0; i < bones.length; i ++) { for(var j = 0; j < animationdata.hierarchy.length; j ++) { if(animationdata.hierarchy[j].name == bones[i].sid) { var key = {}; key.time = (frame/30); key.matrix = bones[i].animatrix; if(frame == 0) bones[i].matrix = key.matrix; var data = [new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3()]; key.matrix.decompose(data[0],data[1],data[2]); key.pos = [data[0].x,data[0].y,data[0].z]; key.scl = [data[2].x,data[2].y,data[2].z]; key.rot = data[1]; animationdata.hierarchy[j].keys.push(key); } } } geometry.animation = animationdata; } else { // otherwise, process the animation into morphtargets for ( i = 0; i < geometry.vertices.length; i++ ) { skinned.push( new THREE.Vector3() ); } for ( i = 0; i < bones.length; i ++ ) { if ( bones[ i ].type != 'JOINT' ) continue; for ( j = 0; j < bones[ i ].weights.length; j ++ ) { w = bones[ i ].weights[ j ]; vidx = w.index; weight = w.weight; o = geometry.vertices[vidx]; s = skinned[vidx]; v.x = o.x; v.y = o.y; v.z = o.z; v.applyMatrix4( bones[i].skinningMatrix ); s.x += (v.x * weight); s.y += (v.y * weight); s.z += (v.z * weight); } } geometry.morphTargets.push( { name: "target_" + frame, vertices: skinned } ); } } }; function createSceneGraph ( node, parent ) { var obj = new THREE.Object3D(); var skinned = false; var skinController; var morphController; var i, j; // FIXME: controllers for ( i = 0; i < node.controllers.length; i ++ ) { var controller = controllers[ node.controllers[ i ].url ]; switch ( controller.type ) { case 'skin': if ( geometries[ controller.skin.source ] ) { var inst_geom = new InstanceGeometry(); inst_geom.url = controller.skin.source; inst_geom.instance_material = node.controllers[ i ].instance_material; node.geometries.push( inst_geom ); skinned = true; skinController = node.controllers[ i ]; } else if ( controllers[ controller.skin.source ] ) { // urgh: controller can be chained // handle the most basic case... var second = controllers[ controller.skin.source ]; morphController = second; // skinController = node.controllers[i]; if ( second.morph && geometries[ second.morph.source ] ) { var inst_geom = new InstanceGeometry(); inst_geom.url = second.morph.source; inst_geom.instance_material = node.controllers[ i ].instance_material; node.geometries.push( inst_geom ); } } break; case 'morph': if ( geometries[ controller.morph.source ] ) { var inst_geom = new InstanceGeometry(); inst_geom.url = controller.morph.source; inst_geom.instance_material = node.controllers[ i ].instance_material; node.geometries.push( inst_geom ); morphController = node.controllers[ i ]; } console.log( 'ColladaLoader: Morph-controller partially supported.' ); default: break; } } // geometries var double_sided_materials = {}; for ( i = 0; i < node.geometries.length; i ++ ) { var instance_geometry = node.geometries[i]; var instance_materials = instance_geometry.instance_material; var geometry = geometries[ instance_geometry.url ]; var used_materials = {}; var used_materials_array = []; var num_materials = 0; var first_material; if ( geometry ) { if ( !geometry.mesh || !geometry.mesh.primitives ) continue; if ( obj.name.length == 0 ) { obj.name = geometry.id; } // collect used fx for this geometry-instance if ( instance_materials ) { for ( j = 0; j < instance_materials.length; j ++ ) { var instance_material = instance_materials[ j ]; var mat = materials[ instance_material.target ]; var effect_id = mat.instance_effect.url; var shader = effects[ effect_id ].shader; var material3js = shader.material; if ( geometry.doubleSided ) { if ( !( instance_material.symbol in double_sided_materials ) ) { var _copied_material = material3js.clone(); _copied_material.side = THREE.DoubleSide; double_sided_materials[ instance_material.symbol ] = _copied_material; } material3js = double_sided_materials[ instance_material.symbol ]; } material3js.opacity = !material3js.opacity ? 1 : material3js.opacity; used_materials[ instance_material.symbol ] = num_materials; used_materials_array.push( material3js ); first_material = material3js; first_material.name = mat.name == null || mat.name === '' ? mat.id : mat.name; num_materials ++; } } var mesh; var material = first_material || new THREE.MeshLambertMaterial( { color: 0xdddddd, shading: THREE.FlatShading, side: geometry.doubleSided ? THREE.DoubleSide : THREE.FrontSide } ); var geom = geometry.mesh.geometry3js; if ( num_materials > 1 ) { material = new THREE.MeshFaceMaterial( used_materials_array ); for ( j = 0; j < geom.faces.length; j ++ ) { var face = geom.faces[ j ]; face.materialIndex = used_materials[ face.daeMaterial ] } } if ( skinController !== undefined ) { applySkin( geom, skinController ); if(geom.morphTargets.length > 0) { material.morphTargets = true; material.skinning = false; } else { material.morphTargets = false; material.skinning = true; } mesh = new THREE.SkinnedMesh( geom, material, false ); //mesh.skeleton = skinController.skeleton; //mesh.skinController = controllers[ skinController.url ]; //mesh.skinInstanceController = skinController; mesh.name = 'skin_' + skins.length; //mesh.animationHandle.setKey(0); skins.push( mesh ); } else if ( morphController !== undefined ) { createMorph( geom, morphController ); material.morphTargets = true; mesh = new THREE.Mesh( geom, material ); mesh.name = 'morph_' + morphs.length; morphs.push( mesh ); } else { mesh = new THREE.Mesh( geom, material ); // mesh.geom.name = geometry.id; } // N.B.: TP says this is not a great default behavior. It's a nice // optimization to flatten the hierarchy but this should be done // only if requested by the user via a flag. For now I undid it // and fixed the character animation example that uses it // node.geometries.length > 1 ? obj.add( mesh ) : obj = mesh; obj.add(mesh); } } for ( i = 0; i < node.cameras.length; i ++ ) { var instance_camera = node.cameras[i]; var cparams = cameras[instance_camera.url]; var cam = new THREE.PerspectiveCamera(cparams.yfov, parseFloat(cparams.aspect_ratio), parseFloat(cparams.znear), parseFloat(cparams.zfar)); obj.add(cam); } for ( i = 0; i < node.lights.length; i ++ ) { var light = null; var instance_light = node.lights[i]; var lparams = lights[instance_light.url]; if ( lparams && lparams.technique ) { var color = lparams.color.getHex(); var intensity = lparams.intensity; var distance = 0; var angle = lparams.falloff_angle; var exponent; // Intentionally undefined, don't know what this is yet switch ( lparams.technique ) { case 'directional': light = new THREE.DirectionalLight( color, intensity, distance ); light.position.set(0, 0, 1); break; case 'point': light = new THREE.PointLight( color, intensity, distance ); break; case 'spot': light = new THREE.SpotLight( color, intensity, distance, angle, exponent ); light.position.set(0, 0, 1); break; case 'ambient': light = new THREE.AmbientLight( color ); break; } } if (light) { obj.add(light); } } obj.name = node.name || node.id || ""; obj.layer = node.layer || ""; obj.matrix = node.matrix; obj.matrix.decompose( obj.position, obj.quaternion, obj.scale ); if ( options.centerGeometry && obj.geometry ) { var delta = THREE.GeometryUtils.center( obj.geometry ); delta.multiply( obj.scale ); delta.applyQuaternion( obj.quaternion ); obj.position.sub( delta ); } for ( i = 0; i < node.nodes.length; i ++ ) { obj.add( createSceneGraph( node.nodes[i], node ) ); } return obj; }; function getJointId( skin, id ) { for ( var i = 0; i < skin.joints.length; i ++ ) { if ( skin.joints[ i ] == id ) { return i; } } }; function getLibraryNode( id ) { var nodes = COLLADA.querySelectorAll('library_nodes node'); for ( var i = 0; i < nodes.length; i++ ) { var attObj = nodes[i].attributes.getNamedItem('id'); if ( attObj && attObj.value === id ) { return nodes[i]; } } return undefined; }; function getChannelsForNode (node ) { var channels = []; var startTime = 1000000; var endTime = -1000000; for ( var id in animations ) { var animation = animations[id]; for ( var i = 0; i < animation.channel.length; i ++ ) { var channel = animation.channel[i]; var sampler = animation.sampler[i]; var id = channel.target.split('/')[0]; if ( sampler && id == node.id ) { sampler.create(); channel.sampler = sampler; startTime = Math.min(startTime, sampler.startTime); endTime = Math.max(endTime, sampler.endTime); channels.push(channel); } } } if ( channels.length ) { node.startTime = startTime; node.endTime = endTime; } return channels; }; function calcFrameDuration( node ) { var minT = 10000000; for ( var i = 0; i < node.channels.length; i ++ ) { var sampler = node.channels[i].sampler; for ( var j = 0; j < sampler.input.length - 1; j ++ ) { var t0 = sampler.input[ j ]; var t1 = sampler.input[ j + 1 ]; minT = Math.min( minT, t1 - t0 ); } } return minT; }; function calcMatrixAt( node, t ) { var animated = {}; var i, j; for ( i = 0; i < node.channels.length; i ++ ) { var channel = node.channels[ i ]; animated[ channel.sid ] = channel; } var matrix = new THREE.Matrix4(); for ( i = 0; i < node.transforms.length; i ++ ) { var transform = node.transforms[ i ]; var channel = animated[ transform.sid ]; if ( channel !== undefined ) { var sampler = channel.sampler; var value; for ( j = 0; j < sampler.input.length - 1; j ++ ) { if ( sampler.input[ j + 1 ] > t ) { value = sampler.output[ j ]; //console.log(value.flatten) break; } } if ( value !== undefined ) { if ( value instanceof THREE.Matrix4 ) { matrix.multiplyMatrices( matrix, value ); } else { // FIXME: handle other types matrix.multiplyMatrices( matrix, transform.matrix ); } } else { matrix.multiplyMatrices( matrix, transform.matrix ); } } else { matrix.multiplyMatrices( matrix, transform.matrix ); } } return matrix; }; function bakeAnimations ( node ) { if ( node.channels && node.channels.length ) { var keys = [], sids = []; for ( var i = 0, il = node.channels.length; i < il; i++ ) { var channel = node.channels[i], fullSid = channel.fullSid, sampler = channel.sampler, input = sampler.input, transform = node.getTransformBySid( channel.sid ), member; if ( channel.arrIndices ) { member = []; for ( var j = 0, jl = channel.arrIndices.length; j < jl; j++ ) { member[ j ] = getConvertedIndex( channel.arrIndices[ j ] ); } } else { member = getConvertedMember( channel.member ); } if ( transform ) { if ( sids.indexOf( fullSid ) === -1 ) { sids.push( fullSid ); } for ( var j = 0, jl = input.length; j < jl; j++ ) { var time = input[j], data = sampler.getData( transform.type, j ), key = findKey( keys, time ); if ( !key ) { key = new Key( time ); var timeNdx = findTimeNdx( keys, time ); keys.splice( timeNdx == -1 ? keys.length : timeNdx, 0, key ); } key.addTarget( fullSid, transform, member, data ); } } else { console.log( 'Could not find transform "' + channel.sid + '" in node ' + node.id ); } } // post process for ( var i = 0; i < sids.length; i++ ) { var sid = sids[ i ]; for ( var j = 0; j < keys.length; j++ ) { var key = keys[ j ]; if ( !key.hasTarget( sid ) ) { interpolateKeys( keys, key, j, sid ); } } } node.keys = keys; node.sids = sids; } }; function findKey ( keys, time) { var retVal = null; for ( var i = 0, il = keys.length; i < il && retVal == null; i++ ) { var key = keys[i]; if ( key.time === time ) { retVal = key; } else if ( key.time > time ) { break; } } return retVal; }; function findTimeNdx ( keys, time) { var ndx = -1; for ( var i = 0, il = keys.length; i < il && ndx == -1; i++ ) { var key = keys[i]; if ( key.time >= time ) { ndx = i; } } return ndx; }; function interpolateKeys ( keys, key, ndx, fullSid ) { var prevKey = getPrevKeyWith( keys, fullSid, ndx ? ndx-1 : 0 ), nextKey = getNextKeyWith( keys, fullSid, ndx+1 ); if ( prevKey && nextKey ) { var scale = (key.time - prevKey.time) / (nextKey.time - prevKey.time), prevTarget = prevKey.getTarget( fullSid ), nextData = nextKey.getTarget( fullSid ).data, prevData = prevTarget.data, data; if ( prevTarget.type === 'matrix' ) { data = prevData; } else if ( prevData.length ) { data = []; for ( var i = 0; i < prevData.length; ++i ) { data[ i ] = prevData[ i ] + ( nextData[ i ] - prevData[ i ] ) * scale; } } else { data = prevData + ( nextData - prevData ) * scale; } key.addTarget( fullSid, prevTarget.transform, prevTarget.member, data ); } }; // Get next key with given sid function getNextKeyWith( keys, fullSid, ndx ) { for ( ; ndx < keys.length; ndx++ ) { var key = keys[ ndx ]; if ( key.hasTarget( fullSid ) ) { return key; } } return null; }; // Get previous key with given sid function getPrevKeyWith( keys, fullSid, ndx ) { ndx = ndx >= 0 ? ndx : ndx + keys.length; for ( ; ndx >= 0; ndx-- ) { var key = keys[ ndx ]; if ( key.hasTarget( fullSid ) ) { return key; } } return null; }; function _Image() { this.id = ""; this.init_from = ""; }; _Image.prototype.parse = function(element) { this.id = element.getAttribute('id'); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeName == 'init_from' ) { this.init_from = child.textContent; } } return this; }; function Controller() { this.id = ""; this.name = ""; this.type = ""; this.skin = null; this.morph = null; }; Controller.prototype.parse = function( element ) { this.id = element.getAttribute('id'); this.name = element.getAttribute('name'); this.type = "none"; for ( var i = 0; i < element.childNodes.length; i++ ) { var child = element.childNodes[ i ]; switch ( child.nodeName ) { case 'skin': this.skin = (new Skin()).parse(child); this.type = child.nodeName; break; case 'morph': this.morph = (new Morph()).parse(child); this.type = child.nodeName; break; default: break; } } return this; }; function Morph() { this.method = null; this.source = null; this.targets = null; this.weights = null; }; Morph.prototype.parse = function( element ) { var sources = {}; var inputs = []; var i; this.method = element.getAttribute( 'method' ); this.source = element.getAttribute( 'source' ).replace( /^#/, '' ); for ( i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'source': var source = ( new Source() ).parse( child ); sources[ source.id ] = source; break; case 'targets': inputs = this.parseInputs( child ); break; default: console.log( child.nodeName ); break; } } for ( i = 0; i < inputs.length; i ++ ) { var input = inputs[ i ]; var source = sources[ input.source ]; switch ( input.semantic ) { case 'MORPH_TARGET': this.targets = source.read(); break; case 'MORPH_WEIGHT': this.weights = source.read(); break; default: break; } } return this; }; Morph.prototype.parseInputs = function(element) { var inputs = []; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; if ( child.nodeType != 1) continue; switch ( child.nodeName ) { case 'input': inputs.push( (new Input()).parse(child) ); break; default: break; } } return inputs; }; function Skin() { this.source = ""; this.bindShapeMatrix = null; this.invBindMatrices = []; this.joints = []; this.weights = []; }; Skin.prototype.parse = function( element ) { var sources = {}; var joints, weights; this.source = element.getAttribute( 'source' ).replace( /^#/, '' ); this.invBindMatrices = []; this.joints = []; this.weights = []; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'bind_shape_matrix': var f = _floats(child.textContent); this.bindShapeMatrix = getConvertedMat4( f ); break; case 'source': var src = new Source().parse(child); sources[ src.id ] = src; break; case 'joints': joints = child; break; case 'vertex_weights': weights = child; break; default: console.log( child.nodeName ); break; } } this.parseJoints( joints, sources ); this.parseWeights( weights, sources ); return this; }; Skin.prototype.parseJoints = function ( element, sources ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'input': var input = ( new Input() ).parse( child ); var source = sources[ input.source ]; if ( input.semantic == 'JOINT' ) { this.joints = source.read(); } else if ( input.semantic == 'INV_BIND_MATRIX' ) { this.invBindMatrices = source.read(); } break; default: break; } } }; Skin.prototype.parseWeights = function ( element, sources ) { var v, vcount, inputs = []; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'input': inputs.push( ( new Input() ).parse( child ) ); break; case 'v': v = _ints( child.textContent ); break; case 'vcount': vcount = _ints( child.textContent ); break; default: break; } } var index = 0; for ( var i = 0; i < vcount.length; i ++ ) { var numBones = vcount[i]; var vertex_weights = []; for ( var j = 0; j < numBones; j++ ) { var influence = {}; for ( var k = 0; k < inputs.length; k ++ ) { var input = inputs[ k ]; var value = v[ index + input.offset ]; switch ( input.semantic ) { case 'JOINT': influence.joint = value;//this.joints[value]; break; case 'WEIGHT': influence.weight = sources[ input.source ].data[ value ]; break; default: break; } } vertex_weights.push( influence ); index += inputs.length; } for ( var j = 0; j < vertex_weights.length; j ++ ) { vertex_weights[ j ].index = i; } this.weights.push( vertex_weights ); } }; function VisualScene () { this.id = ""; this.name = ""; this.nodes = []; this.scene = new THREE.Object3D(); }; VisualScene.prototype.getChildById = function( id, recursive ) { for ( var i = 0; i < this.nodes.length; i ++ ) { var node = this.nodes[ i ].getChildById( id, recursive ); if ( node ) { return node; } } return null; }; VisualScene.prototype.getChildBySid = function( sid, recursive ) { for ( var i = 0; i < this.nodes.length; i ++ ) { var node = this.nodes[ i ].getChildBySid( sid, recursive ); if ( node ) { return node; } } return null; }; VisualScene.prototype.parse = function( element ) { this.id = element.getAttribute( 'id' ); this.name = element.getAttribute( 'name' ); this.nodes = []; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'node': this.nodes.push( ( new Node() ).parse( child ) ); break; default: break; } } return this; }; function Node() { this.id = ""; this.name = ""; this.sid = ""; this.nodes = []; this.controllers = []; this.transforms = []; this.geometries = []; this.channels = []; this.matrix = new THREE.Matrix4(); }; Node.prototype.getChannelForTransform = function( transformSid ) { for ( var i = 0; i < this.channels.length; i ++ ) { var channel = this.channels[i]; var parts = channel.target.split('/'); var id = parts.shift(); var sid = parts.shift(); var dotSyntax = (sid.indexOf(".") >= 0); var arrSyntax = (sid.indexOf("(") >= 0); var arrIndices; var member; if ( dotSyntax ) { parts = sid.split("."); sid = parts.shift(); member = parts.shift(); } else if ( arrSyntax ) { arrIndices = sid.split("("); sid = arrIndices.shift(); for ( var j = 0; j < arrIndices.length; j ++ ) { arrIndices[ j ] = parseInt( arrIndices[ j ].replace( /\)/, '' ) ); } } if ( sid == transformSid ) { channel.info = { sid: sid, dotSyntax: dotSyntax, arrSyntax: arrSyntax, arrIndices: arrIndices }; return channel; } } return null; }; Node.prototype.getChildById = function ( id, recursive ) { if ( this.id == id ) { return this; } if ( recursive ) { for ( var i = 0; i < this.nodes.length; i ++ ) { var n = this.nodes[ i ].getChildById( id, recursive ); if ( n ) { return n; } } } return null; }; Node.prototype.getChildBySid = function ( sid, recursive ) { if ( this.sid == sid ) { return this; } if ( recursive ) { for ( var i = 0; i < this.nodes.length; i ++ ) { var n = this.nodes[ i ].getChildBySid( sid, recursive ); if ( n ) { return n; } } } return null; }; Node.prototype.getTransformBySid = function ( sid ) { for ( var i = 0; i < this.transforms.length; i ++ ) { if ( this.transforms[ i ].sid == sid ) return this.transforms[ i ]; } return null; }; Node.prototype.parse = function( element ) { var url; this.id = element.getAttribute('id'); this.sid = element.getAttribute('sid'); this.name = element.getAttribute('name'); this.type = element.getAttribute('type'); this.layer = element.getAttribute('layer'); this.type = this.type == 'JOINT' ? this.type : 'NODE'; this.nodes = []; this.transforms = []; this.geometries = []; this.cameras = []; this.lights = []; this.controllers = []; this.matrix = new THREE.Matrix4(); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'node': this.nodes.push( ( new Node() ).parse( child ) ); break; case 'instance_camera': this.cameras.push( ( new InstanceCamera() ).parse( child ) ); break; case 'instance_controller': this.controllers.push( ( new InstanceController() ).parse( child ) ); break; case 'instance_geometry': this.geometries.push( ( new InstanceGeometry() ).parse( child ) ); break; case 'instance_light': this.lights.push( ( new InstanceLight() ).parse( child ) ); break; case 'instance_node': url = child.getAttribute( 'url' ).replace( /^#/, '' ); var iNode = getLibraryNode( url ); if ( iNode ) { this.nodes.push( ( new Node() ).parse( iNode )) ; } break; case 'rotate': case 'translate': case 'scale': case 'matrix': case 'lookat': case 'skew': this.transforms.push( ( new Transform() ).parse( child ) ); break; case 'extra': break; default: console.log( child.nodeName ); break; } } this.channels = getChannelsForNode( this ); bakeAnimations( this ); this.updateMatrix(); return this; }; Node.prototype.updateMatrix = function () { this.matrix.identity(); for ( var i = 0; i < this.transforms.length; i ++ ) { this.transforms[ i ].apply( this.matrix ); } }; function Transform () { this.sid = ""; this.type = ""; this.data = []; this.obj = null; }; Transform.prototype.parse = function ( element ) { this.sid = element.getAttribute( 'sid' ); this.type = element.nodeName; this.data = _floats( element.textContent ); this.convert(); return this; }; Transform.prototype.convert = function () { switch ( this.type ) { case 'matrix': this.obj = getConvertedMat4( this.data ); break; case 'rotate': this.angle = THREE.Math.degToRad( this.data[3] ); case 'translate': fixCoords( this.data, -1 ); this.obj = new THREE.Vector3( this.data[ 0 ], this.data[ 1 ], this.data[ 2 ] ); break; case 'scale': fixCoords( this.data, 1 ); this.obj = new THREE.Vector3( this.data[ 0 ], this.data[ 1 ], this.data[ 2 ] ); break; default: console.log( 'Can not convert Transform of type ' + this.type ); break; } }; Transform.prototype.apply = function () { var m1 = new THREE.Matrix4(); return function ( matrix ) { switch ( this.type ) { case 'matrix': matrix.multiply( this.obj ); break; case 'translate': matrix.multiply( m1.makeTranslation( this.obj.x, this.obj.y, this.obj.z ) ); break; case 'rotate': matrix.multiply( m1.makeRotationAxis( this.obj, this.angle ) ); break; case 'scale': matrix.scale( this.obj ); break; } }; }(); Transform.prototype.update = function ( data, member ) { var members = [ 'X', 'Y', 'Z', 'ANGLE' ]; switch ( this.type ) { case 'matrix': if ( ! member ) { this.obj.copy( data ); } else if ( member.length === 1 ) { switch ( member[ 0 ] ) { case 0: this.obj.n11 = data[ 0 ]; this.obj.n21 = data[ 1 ]; this.obj.n31 = data[ 2 ]; this.obj.n41 = data[ 3 ]; break; case 1: this.obj.n12 = data[ 0 ]; this.obj.n22 = data[ 1 ]; this.obj.n32 = data[ 2 ]; this.obj.n42 = data[ 3 ]; break; case 2: this.obj.n13 = data[ 0 ]; this.obj.n23 = data[ 1 ]; this.obj.n33 = data[ 2 ]; this.obj.n43 = data[ 3 ]; break; case 3: this.obj.n14 = data[ 0 ]; this.obj.n24 = data[ 1 ]; this.obj.n34 = data[ 2 ]; this.obj.n44 = data[ 3 ]; break; } } else if ( member.length === 2 ) { var propName = 'n' + ( member[ 0 ] + 1 ) + ( member[ 1 ] + 1 ); this.obj[ propName ] = data; } else { console.log('Incorrect addressing of matrix in transform.'); } break; case 'translate': case 'scale': if ( Object.prototype.toString.call( member ) === '[object Array]' ) { member = members[ member[ 0 ] ]; } switch ( member ) { case 'X': this.obj.x = data; break; case 'Y': this.obj.y = data; break; case 'Z': this.obj.z = data; break; default: this.obj.x = data[ 0 ]; this.obj.y = data[ 1 ]; this.obj.z = data[ 2 ]; break; } break; case 'rotate': if ( Object.prototype.toString.call( member ) === '[object Array]' ) { member = members[ member[ 0 ] ]; } switch ( member ) { case 'X': this.obj.x = data; break; case 'Y': this.obj.y = data; break; case 'Z': this.obj.z = data; break; case 'ANGLE': this.angle = THREE.Math.degToRad( data ); break; default: this.obj.x = data[ 0 ]; this.obj.y = data[ 1 ]; this.obj.z = data[ 2 ]; this.angle = THREE.Math.degToRad( data[ 3 ] ); break; } break; } }; function InstanceController() { this.url = ""; this.skeleton = []; this.instance_material = []; }; InstanceController.prototype.parse = function ( element ) { this.url = element.getAttribute('url').replace(/^#/, ''); this.skeleton = []; this.instance_material = []; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType !== 1 ) continue; switch ( child.nodeName ) { case 'skeleton': this.skeleton.push( child.textContent.replace(/^#/, '') ); break; case 'bind_material': var instances = child.querySelectorAll('instance_material'); for ( var j = 0; j < instances.length; j ++ ){ var instance = instances[j]; this.instance_material.push( (new InstanceMaterial()).parse(instance) ); } break; case 'extra': break; default: break; } } return this; }; function InstanceMaterial () { this.symbol = ""; this.target = ""; }; InstanceMaterial.prototype.parse = function ( element ) { this.symbol = element.getAttribute('symbol'); this.target = element.getAttribute('target').replace(/^#/, ''); return this; }; function InstanceGeometry() { this.url = ""; this.instance_material = []; }; InstanceGeometry.prototype.parse = function ( element ) { this.url = element.getAttribute('url').replace(/^#/, ''); this.instance_material = []; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; if ( child.nodeType != 1 ) continue; if ( child.nodeName == 'bind_material' ) { var instances = child.querySelectorAll('instance_material'); for ( var j = 0; j < instances.length; j ++ ) { var instance = instances[j]; this.instance_material.push( (new InstanceMaterial()).parse(instance) ); } break; } } return this; }; function Geometry() { this.id = ""; this.mesh = null; }; Geometry.prototype.parse = function ( element ) { this.id = element.getAttribute('id'); extractDoubleSided( this, element ); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; switch ( child.nodeName ) { case 'mesh': this.mesh = (new Mesh(this)).parse(child); break; case 'extra': // console.log( child ); break; default: break; } } return this; }; function Mesh( geometry ) { this.geometry = geometry.id; this.primitives = []; this.vertices = null; this.geometry3js = null; }; Mesh.prototype.parse = function( element ) { this.primitives = []; var i, j; for ( i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; switch ( child.nodeName ) { case 'source': _source( child ); break; case 'vertices': this.vertices = ( new Vertices() ).parse( child ); break; case 'triangles': this.primitives.push( ( new Triangles().parse( child ) ) ); break; case 'polygons': this.primitives.push( ( new Polygons().parse( child ) ) ); break; case 'polylist': this.primitives.push( ( new Polylist().parse( child ) ) ); break; default: break; } } this.geometry3js = new THREE.Geometry(); var vertexData = sources[ this.vertices.input['POSITION'].source ].data; for ( i = 0; i < vertexData.length; i += 3 ) { this.geometry3js.vertices.push( getConvertedVec3( vertexData, i ).clone() ); } for ( i = 0; i < this.primitives.length; i ++ ) { var primitive = this.primitives[ i ]; primitive.setVertices( this.vertices ); this.handlePrimitive( primitive, this.geometry3js ); } this.geometry3js.computeFaceNormals(); if ( this.geometry3js.calcNormals ) { this.geometry3js.computeVertexNormals(); delete this.geometry3js.calcNormals; } // this.geometry3js.computeBoundingBox(); return this; }; Mesh.prototype.handlePrimitive = function( primitive, geom ) { var j, k, pList = primitive.p, inputs = primitive.inputs; var input, index, idx32; var source, numParams; var vcIndex = 0, vcount = 3, maxOffset = 0; var texture_sets = []; for ( j = 0; j < inputs.length; j ++ ) { input = inputs[ j ]; var offset = input.offset + 1; maxOffset = (maxOffset < offset)? offset : maxOffset; switch ( input.semantic ) { case 'TEXCOORD': texture_sets.push( input.set ); break; } } for ( var pCount = 0; pCount < pList.length; ++pCount ) { var p = pList[ pCount ], i = 0; while ( i < p.length ) { var vs = []; var ns = []; var ts = null; var cs = []; if ( primitive.vcount ) { vcount = primitive.vcount.length ? primitive.vcount[ vcIndex ++ ] : primitive.vcount; } else { vcount = p.length / maxOffset; } for ( j = 0; j < vcount; j ++ ) { for ( k = 0; k < inputs.length; k ++ ) { input = inputs[ k ]; source = sources[ input.source ]; index = p[ i + ( j * maxOffset ) + input.offset ]; numParams = source.accessor.params.length; idx32 = index * numParams; switch ( input.semantic ) { case 'VERTEX': vs.push( index ); break; case 'NORMAL': ns.push( getConvertedVec3( source.data, idx32 ) ); break; case 'TEXCOORD': ts = ts || { }; if ( ts[ input.set ] === undefined ) ts[ input.set ] = []; // invert the V ts[ input.set ].push( new THREE.Vector2( source.data[ idx32 ], source.data[ idx32 + 1 ] ) ); break; case 'COLOR': cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) ); break; default: break; } } } if ( ns.length == 0 ) { // check the vertices inputs input = this.vertices.input.NORMAL; if ( input ) { source = sources[ input.source ]; numParams = source.accessor.params.length; for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) { ns.push( getConvertedVec3( source.data, vs[ ndx ] * numParams ) ); } } else { geom.calcNormals = true; } } if ( !ts ) { ts = { }; // check the vertices inputs input = this.vertices.input.TEXCOORD; if ( input ) { texture_sets.push( input.set ); source = sources[ input.source ]; numParams = source.accessor.params.length; for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) { idx32 = vs[ ndx ] * numParams; if ( ts[ input.set ] === undefined ) ts[ input.set ] = [ ]; // invert the V ts[ input.set ].push( new THREE.Vector2( source.data[ idx32 ], 1.0 - source.data[ idx32 + 1 ] ) ); } } } if ( cs.length == 0 ) { // check the vertices inputs input = this.vertices.input.COLOR; if ( input ) { source = sources[ input.source ]; numParams = source.accessor.params.length; for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) { idx32 = vs[ ndx ] * numParams; cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) ); } } } var face = null, faces = [], uv, uvArr; if ( vcount === 3 ) { faces.push( new THREE.Face3( vs[0], vs[1], vs[2], ns, cs.length ? cs : new THREE.Color() ) ); } else if ( vcount === 4 ) { faces.push( new THREE.Face3( vs[0], vs[1], vs[3], [ns[0], ns[1], ns[3]], cs.length ? [cs[0], cs[1], cs[3]] : new THREE.Color() ) ); faces.push( new THREE.Face3( vs[1], vs[2], vs[3], [ns[1], ns[2], ns[3]], cs.length ? [cs[1], cs[2], cs[3]] : new THREE.Color() ) ); } else if ( vcount > 4 && options.subdivideFaces ) { var clr = cs.length ? cs : new THREE.Color(), vec1, vec2, vec3, v1, v2, norm; // subdivide into multiple Face3s for ( k = 1; k < vcount - 1; ) { // FIXME: normals don't seem to be quite right faces.push( new THREE.Face3( vs[0], vs[k], vs[k+1], [ ns[0], ns[k++], ns[k] ], clr ) ); } } if ( faces.length ) { for ( var ndx = 0, len = faces.length; ndx < len; ndx ++ ) { face = faces[ndx]; face.daeMaterial = primitive.material; geom.faces.push( face ); for ( k = 0; k < texture_sets.length; k++ ) { uv = ts[ texture_sets[k] ]; if ( vcount > 4 ) { // Grab the right UVs for the vertices in this face uvArr = [ uv[0], uv[ndx+1], uv[ndx+2] ]; } else if ( vcount === 4 ) { if ( ndx === 0 ) { uvArr = [ uv[0], uv[1], uv[3] ]; } else { uvArr = [ uv[1].clone(), uv[2], uv[3].clone() ]; } } else { uvArr = [ uv[0], uv[1], uv[2] ]; } if ( geom.faceVertexUvs[k] === undefined ) { geom.faceVertexUvs[k] = []; } geom.faceVertexUvs[k].push( uvArr ); } } } else { console.log( 'dropped face with vcount ' + vcount + ' for geometry with id: ' + geom.id ); } i += maxOffset * vcount; } } }; function Polygons () { this.material = ""; this.count = 0; this.inputs = []; this.vcount = null; this.p = []; this.geometry = new THREE.Geometry(); }; Polygons.prototype.setVertices = function ( vertices ) { for ( var i = 0; i < this.inputs.length; i ++ ) { if ( this.inputs[ i ].source == vertices.id ) { this.inputs[ i ].source = vertices.input[ 'POSITION' ].source; } } }; Polygons.prototype.parse = function ( element ) { this.material = element.getAttribute( 'material' ); this.count = _attr_as_int( element, 'count', 0 ); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; switch ( child.nodeName ) { case 'input': this.inputs.push( ( new Input() ).parse( element.childNodes[ i ] ) ); break; case 'vcount': this.vcount = _ints( child.textContent ); break; case 'p': this.p.push( _ints( child.textContent ) ); break; case 'ph': console.warn( 'polygon holes not yet supported!' ); break; default: break; } } return this; }; function Polylist () { Polygons.call( this ); this.vcount = []; }; Polylist.prototype = Object.create( Polygons.prototype ); function Triangles () { Polygons.call( this ); this.vcount = 3; }; Triangles.prototype = Object.create( Polygons.prototype ); function Accessor() { this.source = ""; this.count = 0; this.stride = 0; this.params = []; }; Accessor.prototype.parse = function ( element ) { this.params = []; this.source = element.getAttribute( 'source' ); this.count = _attr_as_int( element, 'count', 0 ); this.stride = _attr_as_int( element, 'stride', 0 ); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeName == 'param' ) { var param = {}; param[ 'name' ] = child.getAttribute( 'name' ); param[ 'type' ] = child.getAttribute( 'type' ); this.params.push( param ); } } return this; }; function Vertices() { this.input = {}; }; Vertices.prototype.parse = function ( element ) { this.id = element.getAttribute('id'); for ( var i = 0; i < element.childNodes.length; i ++ ) { if ( element.childNodes[i].nodeName == 'input' ) { var input = ( new Input() ).parse( element.childNodes[ i ] ); this.input[ input.semantic ] = input; } } return this; }; function Input () { this.semantic = ""; this.offset = 0; this.source = ""; this.set = 0; }; Input.prototype.parse = function ( element ) { this.semantic = element.getAttribute('semantic'); this.source = element.getAttribute('source').replace(/^#/, ''); this.set = _attr_as_int(element, 'set', -1); this.offset = _attr_as_int(element, 'offset', 0); if ( this.semantic == 'TEXCOORD' && this.set < 0 ) { this.set = 0; } return this; }; function Source ( id ) { this.id = id; this.type = null; }; Source.prototype.parse = function ( element ) { this.id = element.getAttribute( 'id' ); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; switch ( child.nodeName ) { case 'bool_array': this.data = _bools( child.textContent ); this.type = child.nodeName; break; case 'float_array': this.data = _floats( child.textContent ); this.type = child.nodeName; break; case 'int_array': this.data = _ints( child.textContent ); this.type = child.nodeName; break; case 'IDREF_array': case 'Name_array': this.data = _strings( child.textContent ); this.type = child.nodeName; break; case 'technique_common': for ( var j = 0; j < child.childNodes.length; j ++ ) { if ( child.childNodes[ j ].nodeName == 'accessor' ) { this.accessor = ( new Accessor() ).parse( child.childNodes[ j ] ); break; } } break; default: // console.log(child.nodeName); break; } } return this; }; Source.prototype.read = function () { var result = []; //for (var i = 0; i < this.accessor.params.length; i++) { var param = this.accessor.params[ 0 ]; //console.log(param.name + " " + param.type); switch ( param.type ) { case 'IDREF': case 'Name': case 'name': case 'float': return this.data; case 'float4x4': for ( var j = 0; j < this.data.length; j += 16 ) { var s = this.data.slice( j, j + 16 ); var m = getConvertedMat4( s ); result.push( m ); } break; default: console.log( 'ColladaLoader: Source: Read dont know how to read ' + param.type + '.' ); break; } //} return result; }; function Material () { this.id = ""; this.name = ""; this.instance_effect = null; }; Material.prototype.parse = function ( element ) { this.id = element.getAttribute( 'id' ); this.name = element.getAttribute( 'name' ); for ( var i = 0; i < element.childNodes.length; i ++ ) { if ( element.childNodes[ i ].nodeName == 'instance_effect' ) { this.instance_effect = ( new InstanceEffect() ).parse( element.childNodes[ i ] ); break; } } return this; }; function ColorOrTexture () { this.color = new THREE.Color(); this.color.setRGB( Math.random(), Math.random(), Math.random() ); this.color.a = 1.0; this.texture = null; this.texcoord = null; this.texOpts = null; }; ColorOrTexture.prototype.isColor = function () { return ( this.texture == null ); }; ColorOrTexture.prototype.isTexture = function () { return ( this.texture != null ); }; ColorOrTexture.prototype.parse = function ( element ) { if (element.nodeName == 'transparent') { this.opaque = element.getAttribute('opaque'); } for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'color': var rgba = _floats( child.textContent ); this.color = new THREE.Color(); this.color.setRGB( rgba[0], rgba[1], rgba[2] ); this.color.a = rgba[3]; break; case 'texture': this.texture = child.getAttribute('texture'); this.texcoord = child.getAttribute('texcoord'); // Defaults from: // https://collada.org/mediawiki/index.php/Maya_texture_placement_MAYA_extension this.texOpts = { offsetU: 0, offsetV: 0, repeatU: 1, repeatV: 1, wrapU: 1, wrapV: 1 }; this.parseTexture( child ); break; default: break; } } return this; }; ColorOrTexture.prototype.parseTexture = function ( element ) { if ( ! element.childNodes ) return this; // This should be supported by Maya, 3dsMax, and MotionBuilder if ( element.childNodes[1] && element.childNodes[1].nodeName === 'extra' ) { element = element.childNodes[1]; if ( element.childNodes[1] && element.childNodes[1].nodeName === 'technique' ) { element = element.childNodes[1]; } } for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; switch ( child.nodeName ) { case 'offsetU': case 'offsetV': case 'repeatU': case 'repeatV': this.texOpts[ child.nodeName ] = parseFloat( child.textContent ); break; case 'wrapU': case 'wrapV': // some dae have a value of true which becomes NaN via parseInt if ( child.textContent.toUpperCase() === 'TRUE' ) { this.texOpts[ child.nodeName ] = 1; } else { this.texOpts[ child.nodeName ] = parseInt( child.textContent ); } break; default: this.texOpts[ child.nodeName ] = child.textContent; break; } } return this; }; function Shader ( type, effect ) { this.type = type; this.effect = effect; this.material = null; }; Shader.prototype.parse = function ( element ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'ambient': case 'emission': case 'diffuse': case 'specular': case 'transparent': case 'bump': this[ child.nodeName ] = ( new ColorOrTexture() ).parse( child ); break; case 'shininess': case 'reflectivity': case 'index_of_refraction': case 'transparency': var f = child.querySelectorAll('float'); if ( f.length > 0 ) this[ child.nodeName ] = parseFloat( f[ 0 ].textContent ); break; default: break; } } this.create(); return this; }; Shader.prototype.create = function() { var props = {}; var transparent = false; if (this['transparency'] !== undefined && this['transparent'] !== undefined) { // convert transparent color RBG to average value var transparentColor = this['transparent']; var transparencyLevel = (this.transparent.color.r + this.transparent.color.g + this.transparent.color.b) / 3 * this.transparency; if (transparencyLevel > 0) { transparent = true; props[ 'transparent' ] = true; props[ 'opacity' ] = 1 - transparencyLevel; } } var keys = { 'diffuse':'map', 'ambient':"lightMap" , 'specular':'specularMap', 'emission':'emissionMap', 'bump':'normalMap' }; for ( var prop in this ) { switch ( prop ) { case 'ambient': case 'emission': case 'diffuse': case 'specular': case 'bump': var cot = this[ prop ]; if ( cot instanceof ColorOrTexture ) { if ( cot.isTexture() ) { var samplerId = cot.texture; var surfaceId = this.effect.sampler[samplerId]; if ( surfaceId !== undefined && surfaceId.source !== undefined ) { var surface = this.effect.surface[surfaceId.source]; var image = images[surface.init_from]; if (image) { var texture = THREE.ImageUtils.loadTexture(baseUrl + image.init_from); texture.wrapS = cot.texOpts.wrapU ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping; texture.wrapT = cot.texOpts.wrapV ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping; texture.offset.x = cot.texOpts.offsetU; texture.offset.y = cot.texOpts.offsetV; texture.repeat.x = cot.texOpts.repeatU; texture.repeat.y = cot.texOpts.repeatV; props[keys[prop]] = texture; // Texture with baked lighting? if (prop === 'emission') props['emissive'] = 0xffffff; } } } else if ( prop === 'diffuse' || !transparent ) { if ( prop === 'emission' ) { props[ 'emissive' ] = cot.color.getHex(); } else { props[ prop ] = cot.color.getHex(); } } } break; case 'shininess': props[ prop ] = this[ prop ]; break; case 'reflectivity': props[ prop ] = this[ prop ]; if( props[ prop ] > 0.0 ) props['envMap'] = options.defaultEnvMap; props['combine'] = THREE.MixOperation; //mix regular shading with reflective component break; case 'index_of_refraction': props[ 'refractionRatio' ] = this[ prop ]; //TODO: "index_of_refraction" becomes "refractionRatio" in shader, but I'm not sure if the two are actually comparable if ( this[ prop ] !== 1.0 ) props['envMap'] = options.defaultEnvMap; break; case 'transparency': // gets figured out up top break; default: break; } } props[ 'shading' ] = preferredShading; props[ 'side' ] = this.effect.doubleSided ? THREE.DoubleSide : THREE.FrontSide; switch ( this.type ) { case 'constant': if (props.emissive != undefined) props.color = props.emissive; this.material = new THREE.MeshBasicMaterial( props ); break; case 'phong': case 'blinn': if (props.diffuse != undefined) props.color = props.diffuse; this.material = new THREE.MeshPhongMaterial( props ); break; case 'lambert': default: if (props.diffuse != undefined) props.color = props.diffuse; this.material = new THREE.MeshLambertMaterial( props ); break; } return this.material; }; function Surface ( effect ) { this.effect = effect; this.init_from = null; this.format = null; }; Surface.prototype.parse = function ( element ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'init_from': this.init_from = child.textContent; break; case 'format': this.format = child.textContent; break; default: console.log( "unhandled Surface prop: " + child.nodeName ); break; } } return this; }; function Sampler2D ( effect ) { this.effect = effect; this.source = null; this.wrap_s = null; this.wrap_t = null; this.minfilter = null; this.magfilter = null; this.mipfilter = null; }; Sampler2D.prototype.parse = function ( element ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'source': this.source = child.textContent; break; case 'minfilter': this.minfilter = child.textContent; break; case 'magfilter': this.magfilter = child.textContent; break; case 'mipfilter': this.mipfilter = child.textContent; break; case 'wrap_s': this.wrap_s = child.textContent; break; case 'wrap_t': this.wrap_t = child.textContent; break; default: console.log( "unhandled Sampler2D prop: " + child.nodeName ); break; } } return this; }; function Effect () { this.id = ""; this.name = ""; this.shader = null; this.surface = {}; this.sampler = {}; }; Effect.prototype.create = function () { if ( this.shader == null ) { return null; } }; Effect.prototype.parse = function ( element ) { this.id = element.getAttribute( 'id' ); this.name = element.getAttribute( 'name' ); extractDoubleSided( this, element ); this.shader = null; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'profile_COMMON': this.parseTechnique( this.parseProfileCOMMON( child ) ); break; default: break; } } return this; }; Effect.prototype.parseNewparam = function ( element ) { var sid = element.getAttribute( 'sid' ); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'surface': this.surface[sid] = ( new Surface( this ) ).parse( child ); break; case 'sampler2D': this.sampler[sid] = ( new Sampler2D( this ) ).parse( child ); break; case 'extra': break; default: console.log( child.nodeName ); break; } } }; Effect.prototype.parseProfileCOMMON = function ( element ) { var technique; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'profile_COMMON': this.parseProfileCOMMON( child ); break; case 'technique': technique = child; break; case 'newparam': this.parseNewparam( child ); break; case 'image': var _image = ( new _Image() ).parse( child ); images[ _image.id ] = _image; break; case 'extra': break; default: console.log( child.nodeName ); break; } } return technique; }; Effect.prototype.parseTechnique= function ( element ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'constant': case 'lambert': case 'blinn': case 'phong': this.shader = ( new Shader( child.nodeName, this ) ).parse( child ); break; case 'extra': this.parseExtra(child); break; default: break; } } }; Effect.prototype.parseExtra = function ( element ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'technique': this.parseExtraTechnique( child ); break; default: break; } } }; Effect.prototype.parseExtraTechnique= function ( element ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[i]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'bump': this.shader.parse( element ); break; default: break; } } }; function InstanceEffect () { this.url = ""; }; InstanceEffect.prototype.parse = function ( element ) { this.url = element.getAttribute( 'url' ).replace( /^#/, '' ); return this; }; function Animation() { this.id = ""; this.name = ""; this.source = {}; this.sampler = []; this.channel = []; }; Animation.prototype.parse = function ( element ) { this.id = element.getAttribute( 'id' ); this.name = element.getAttribute( 'name' ); this.source = {}; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'animation': var anim = ( new Animation() ).parse( child ); for ( var src in anim.source ) { this.source[ src ] = anim.source[ src ]; } for ( var j = 0; j < anim.channel.length; j ++ ) { this.channel.push( anim.channel[ j ] ); this.sampler.push( anim.sampler[ j ] ); } break; case 'source': var src = ( new Source() ).parse( child ); this.source[ src.id ] = src; break; case 'sampler': this.sampler.push( ( new Sampler( this ) ).parse( child ) ); break; case 'channel': this.channel.push( ( new Channel( this ) ).parse( child ) ); break; default: break; } } return this; }; function Channel( animation ) { this.animation = animation; this.source = ""; this.target = ""; this.fullSid = null; this.sid = null; this.dotSyntax = null; this.arrSyntax = null; this.arrIndices = null; this.member = null; }; Channel.prototype.parse = function ( element ) { this.source = element.getAttribute( 'source' ).replace( /^#/, '' ); this.target = element.getAttribute( 'target' ); var parts = this.target.split( '/' ); var id = parts.shift(); var sid = parts.shift(); var dotSyntax = ( sid.indexOf(".") >= 0 ); var arrSyntax = ( sid.indexOf("(") >= 0 ); if ( dotSyntax ) { parts = sid.split("."); this.sid = parts.shift(); this.member = parts.shift(); } else if ( arrSyntax ) { var arrIndices = sid.split("("); this.sid = arrIndices.shift(); for (var j = 0; j < arrIndices.length; j ++ ) { arrIndices[j] = parseInt( arrIndices[j].replace(/\)/, '') ); } this.arrIndices = arrIndices; } else { this.sid = sid; } this.fullSid = sid; this.dotSyntax = dotSyntax; this.arrSyntax = arrSyntax; return this; }; function Sampler ( animation ) { this.id = ""; this.animation = animation; this.inputs = []; this.input = null; this.output = null; this.strideOut = null; this.interpolation = null; this.startTime = null; this.endTime = null; this.duration = 0; }; Sampler.prototype.parse = function ( element ) { this.id = element.getAttribute( 'id' ); this.inputs = []; for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'input': this.inputs.push( (new Input()).parse( child ) ); break; default: break; } } return this; }; Sampler.prototype.create = function () { for ( var i = 0; i < this.inputs.length; i ++ ) { var input = this.inputs[ i ]; var source = this.animation.source[ input.source ]; switch ( input.semantic ) { case 'INPUT': this.input = source.read(); break; case 'OUTPUT': this.output = source.read(); this.strideOut = source.accessor.stride; break; case 'INTERPOLATION': this.interpolation = source.read(); break; case 'IN_TANGENT': break; case 'OUT_TANGENT': break; default: console.log(input.semantic); break; } } this.startTime = 0; this.endTime = 0; this.duration = 0; if ( this.input.length ) { this.startTime = 100000000; this.endTime = -100000000; for ( var i = 0; i < this.input.length; i ++ ) { this.startTime = Math.min( this.startTime, this.input[ i ] ); this.endTime = Math.max( this.endTime, this.input[ i ] ); } this.duration = this.endTime - this.startTime; } }; Sampler.prototype.getData = function ( type, ndx ) { var data; if ( type === 'matrix' && this.strideOut === 16 ) { data = this.output[ ndx ]; } else if ( this.strideOut > 1 ) { data = []; ndx *= this.strideOut; for ( var i = 0; i < this.strideOut; ++i ) { data[ i ] = this.output[ ndx + i ]; } if ( this.strideOut === 3 ) { switch ( type ) { case 'rotate': case 'translate': fixCoords( data, -1 ); break; case 'scale': fixCoords( data, 1 ); break; } } else if ( this.strideOut === 4 && type === 'matrix' ) { fixCoords( data, -1 ); } } else { data = this.output[ ndx ]; } return data; }; function Key ( time ) { this.targets = []; this.time = time; }; Key.prototype.addTarget = function ( fullSid, transform, member, data ) { this.targets.push( { sid: fullSid, member: member, transform: transform, data: data } ); }; Key.prototype.apply = function ( opt_sid ) { for ( var i = 0; i < this.targets.length; ++i ) { var target = this.targets[ i ]; if ( !opt_sid || target.sid === opt_sid ) { target.transform.update( target.data, target.member ); } } }; Key.prototype.getTarget = function ( fullSid ) { for ( var i = 0; i < this.targets.length; ++i ) { if ( this.targets[ i ].sid === fullSid ) { return this.targets[ i ]; } } return null; }; Key.prototype.hasTarget = function ( fullSid ) { for ( var i = 0; i < this.targets.length; ++i ) { if ( this.targets[ i ].sid === fullSid ) { return true; } } return false; }; // TODO: Currently only doing linear interpolation. Should support full COLLADA spec. Key.prototype.interpolate = function ( nextKey, time ) { for ( var i = 0, l = this.targets.length; i < l; i ++ ) { var target = this.targets[ i ], nextTarget = nextKey.getTarget( target.sid ), data; if ( target.transform.type !== 'matrix' && nextTarget ) { var scale = ( time - this.time ) / ( nextKey.time - this.time ), nextData = nextTarget.data, prevData = target.data; if ( scale < 0 ) scale = 0; if ( scale > 1 ) scale = 1; if ( prevData.length ) { data = []; for ( var j = 0; j < prevData.length; ++j ) { data[ j ] = prevData[ j ] + ( nextData[ j ] - prevData[ j ] ) * scale; } } else { data = prevData + ( nextData - prevData ) * scale; } } else { data = target.data; } target.transform.update( data, target.member ); } }; // Camera function Camera() { this.id = ""; this.name = ""; this.technique = ""; }; Camera.prototype.parse = function ( element ) { this.id = element.getAttribute( 'id' ); this.name = element.getAttribute( 'name' ); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'optics': this.parseOptics( child ); break; default: break; } } return this; }; Camera.prototype.parseOptics = function ( element ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { if ( element.childNodes[ i ].nodeName == 'technique_common' ) { var technique = element.childNodes[ i ]; for ( var j = 0; j < technique.childNodes.length; j ++ ) { this.technique = technique.childNodes[ j ].nodeName; if ( this.technique == 'perspective' ) { var perspective = technique.childNodes[ j ]; for ( var k = 0; k < perspective.childNodes.length; k ++ ) { var param = perspective.childNodes[ k ]; switch ( param.nodeName ) { case 'yfov': this.yfov = param.textContent; break; case 'xfov': this.xfov = param.textContent; break; case 'znear': this.znear = param.textContent; break; case 'zfar': this.zfar = param.textContent; break; case 'aspect_ratio': this.aspect_ratio = param.textContent; break; } } } else if ( this.technique == 'orthographic' ) { var orthographic = technique.childNodes[ j ]; for ( var k = 0; k < orthographic.childNodes.length; k ++ ) { var param = orthographic.childNodes[ k ]; switch ( param.nodeName ) { case 'xmag': this.xmag = param.textContent; break; case 'ymag': this.ymag = param.textContent; break; case 'znear': this.znear = param.textContent; break; case 'zfar': this.zfar = param.textContent; break; case 'aspect_ratio': this.aspect_ratio = param.textContent; break; } } } } } } return this; }; function InstanceCamera() { this.url = ""; }; InstanceCamera.prototype.parse = function ( element ) { this.url = element.getAttribute('url').replace(/^#/, ''); return this; }; // Light function Light() { this.id = ""; this.name = ""; this.technique = ""; }; Light.prototype.parse = function ( element ) { this.id = element.getAttribute( 'id' ); this.name = element.getAttribute( 'name' ); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; if ( child.nodeType != 1 ) continue; switch ( child.nodeName ) { case 'technique_common': this.parseCommon( child ); break; case 'technique': this.parseTechnique( child ); break; default: break; } } return this; }; Light.prototype.parseCommon = function ( element ) { for ( var i = 0; i < element.childNodes.length; i ++ ) { switch ( element.childNodes[ i ].nodeName ) { case 'directional': case 'point': case 'spot': case 'ambient': this.technique = element.childNodes[ i ].nodeName; var light = element.childNodes[ i ]; for ( var j = 0; j < light.childNodes.length; j ++ ) { var child = light.childNodes[j]; switch ( child.nodeName ) { case 'color': var rgba = _floats( child.textContent ); this.color = new THREE.Color(0); this.color.setRGB( rgba[0], rgba[1], rgba[2] ); this.color.a = rgba[3]; break; case 'falloff_angle': this.falloff_angle = parseFloat( child.textContent ); break; } } } } return this; }; Light.prototype.parseTechnique = function ( element ) { this.profile = element.getAttribute( 'profile' ); for ( var i = 0; i < element.childNodes.length; i ++ ) { var child = element.childNodes[ i ]; switch ( child.nodeName ) { case 'intensity': this.intensity = parseFloat(child.textContent); break; } } return this; }; function InstanceLight() { this.url = ""; }; InstanceLight.prototype.parse = function ( element ) { this.url = element.getAttribute('url').replace(/^#/, ''); return this; }; function _source( element ) { var id = element.getAttribute( 'id' ); if ( sources[ id ] != undefined ) { return sources[ id ]; } sources[ id ] = ( new Source(id )).parse( element ); return sources[ id ]; }; function _nsResolver( nsPrefix ) { if ( nsPrefix == "dae" ) { return "http://www.collada.org/2005/11/COLLADASchema"; } return null; }; function _bools( str ) { var raw = _strings( str ); var data = []; for ( var i = 0, l = raw.length; i < l; i ++ ) { data.push( (raw[i] == 'true' || raw[i] == '1') ? true : false ); } return data; }; function _floats( str ) { var raw = _strings(str); var data = []; for ( var i = 0, l = raw.length; i < l; i ++ ) { data.push( parseFloat( raw[ i ] ) ); } return data; }; function _ints( str ) { var raw = _strings( str ); var data = []; for ( var i = 0, l = raw.length; i < l; i ++ ) { data.push( parseInt( raw[ i ], 10 ) ); } return data; }; function _strings( str ) { return ( str.length > 0 ) ? _trimString( str ).split( /\s+/ ) : []; }; function _trimString( str ) { return str.replace( /^\s+/, "" ).replace( /\s+$/, "" ); }; function _attr_as_float( element, name, defaultValue ) { if ( element.hasAttribute( name ) ) { return parseFloat( element.getAttribute( name ) ); } else { return defaultValue; } }; function _attr_as_int( element, name, defaultValue ) { if ( element.hasAttribute( name ) ) { return parseInt( element.getAttribute( name ), 10) ; } else { return defaultValue; } }; function _attr_as_string( element, name, defaultValue ) { if ( element.hasAttribute( name ) ) { return element.getAttribute( name ); } else { return defaultValue; } }; function _format_float( f, num ) { if ( f === undefined ) { var s = '0.'; while ( s.length < num + 2 ) { s += '0'; } return s; } num = num || 2; var parts = f.toString().split( '.' ); parts[ 1 ] = parts.length > 1 ? parts[ 1 ].substr( 0, num ) : "0"; while( parts[ 1 ].length < num ) { parts[ 1 ] += '0'; } return parts.join( '.' ); }; function extractDoubleSided( obj, element ) { obj.doubleSided = false; var node = element.querySelectorAll('extra double_sided')[0]; if ( node ) { if ( node && parseInt( node.textContent, 10 ) === 1 ) { obj.doubleSided = true; } } }; // Up axis conversion function setUpConversion() { if ( !options.convertUpAxis || colladaUp === options.upAxis ) { upConversion = null; } else { switch ( colladaUp ) { case 'X': upConversion = options.upAxis === 'Y' ? 'XtoY' : 'XtoZ'; break; case 'Y': upConversion = options.upAxis === 'X' ? 'YtoX' : 'YtoZ'; break; case 'Z': upConversion = options.upAxis === 'X' ? 'ZtoX' : 'ZtoY'; break; } } }; function fixCoords( data, sign ) { if ( !options.convertUpAxis || colladaUp === options.upAxis ) { return; } switch ( upConversion ) { case 'XtoY': var tmp = data[ 0 ]; data[ 0 ] = sign * data[ 1 ]; data[ 1 ] = tmp; break; case 'XtoZ': var tmp = data[ 2 ]; data[ 2 ] = data[ 1 ]; data[ 1 ] = data[ 0 ]; data[ 0 ] = tmp; break; case 'YtoX': var tmp = data[ 0 ]; data[ 0 ] = data[ 1 ]; data[ 1 ] = sign * tmp; break; case 'YtoZ': var tmp = data[ 1 ]; data[ 1 ] = sign * data[ 2 ]; data[ 2 ] = tmp; break; case 'ZtoX': var tmp = data[ 0 ]; data[ 0 ] = data[ 1 ]; data[ 1 ] = data[ 2 ]; data[ 2 ] = tmp; break; case 'ZtoY': var tmp = data[ 1 ]; data[ 1 ] = data[ 2 ]; data[ 2 ] = sign * tmp; break; } }; function getConvertedVec3( data, offset ) { var arr = [ data[ offset ], data[ offset + 1 ], data[ offset + 2 ] ]; fixCoords( arr, -1 ); return new THREE.Vector3( arr[ 0 ], arr[ 1 ], arr[ 2 ] ); }; function getConvertedMat4( data ) { if ( options.convertUpAxis ) { // First fix rotation and scale // Columns first var arr = [ data[ 0 ], data[ 4 ], data[ 8 ] ]; fixCoords( arr, -1 ); data[ 0 ] = arr[ 0 ]; data[ 4 ] = arr[ 1 ]; data[ 8 ] = arr[ 2 ]; arr = [ data[ 1 ], data[ 5 ], data[ 9 ] ]; fixCoords( arr, -1 ); data[ 1 ] = arr[ 0 ]; data[ 5 ] = arr[ 1 ]; data[ 9 ] = arr[ 2 ]; arr = [ data[ 2 ], data[ 6 ], data[ 10 ] ]; fixCoords( arr, -1 ); data[ 2 ] = arr[ 0 ]; data[ 6 ] = arr[ 1 ]; data[ 10 ] = arr[ 2 ]; // Rows second arr = [ data[ 0 ], data[ 1 ], data[ 2 ] ]; fixCoords( arr, -1 ); data[ 0 ] = arr[ 0 ]; data[ 1 ] = arr[ 1 ]; data[ 2 ] = arr[ 2 ]; arr = [ data[ 4 ], data[ 5 ], data[ 6 ] ]; fixCoords( arr, -1 ); data[ 4 ] = arr[ 0 ]; data[ 5 ] = arr[ 1 ]; data[ 6 ] = arr[ 2 ]; arr = [ data[ 8 ], data[ 9 ], data[ 10 ] ]; fixCoords( arr, -1 ); data[ 8 ] = arr[ 0 ]; data[ 9 ] = arr[ 1 ]; data[ 10 ] = arr[ 2 ]; // Now fix translation arr = [ data[ 3 ], data[ 7 ], data[ 11 ] ]; fixCoords( arr, -1 ); data[ 3 ] = arr[ 0 ]; data[ 7 ] = arr[ 1 ]; data[ 11 ] = arr[ 2 ]; } return new THREE.Matrix4( data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15] ); }; function getConvertedIndex( index ) { if ( index > -1 && index < 3 ) { var members = ['X', 'Y', 'Z'], indices = { X: 0, Y: 1, Z: 2 }; index = getConvertedMember( members[ index ] ); index = indices[ index ]; } return index; }; function getConvertedMember( member ) { if ( options.convertUpAxis ) { switch ( member ) { case 'X': switch ( upConversion ) { case 'XtoY': case 'XtoZ': case 'YtoX': member = 'Y'; break; case 'ZtoX': member = 'Z'; break; } break; case 'Y': switch ( upConversion ) { case 'XtoY': case 'YtoX': case 'ZtoX': member = 'X'; break; case 'XtoZ': case 'YtoZ': case 'ZtoY': member = 'Z'; break; } break; case 'Z': switch ( upConversion ) { case 'XtoZ': member = 'X'; break; case 'YtoZ': case 'ZtoX': case 'ZtoY': member = 'Y'; break; } break; } } return member; }; return { load: load, parse: parse, setPreferredShading: setPreferredShading, applySkin: applySkin, geometries : geometries, options: options }; }; // Copyright (c) 2013 Fabrice Robinet // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* The Abstract Loader has two modes: #1: [static] load all the JSON at once [as of now] #2: [stream] stream and parse JSON progressively [not yet supported] Whatever is the mechanism used to parse the JSON (#1 or #2), The loader starts by resolving the paths to binaries and referenced json files (by replace the value of the path property with an absolute path if it was relative). In case #1: it is guaranteed to call the concrete loader implementation methods in a order that solves the dependencies between the entries. only the nodes requires an extra pass to set up the hirerarchy. In case #2: the concrete implementation will have to solve the dependencies. no order is guaranteed. When case #1 is used the followed dependency order is: scenes -> nodes -> meshes -> materials -> techniques -> shaders -> buffers -> cameras -> lights The readers starts with the leafs, i.e: shaders, techniques, materials, meshes, buffers, cameras, lights, nodes, scenes For each called handle method called the client should return true if the next handle can be call right after returning, or false if a callback on client side will notify the loader that the next handle method can be called. */ var global = window; (function (root, factory) { if (typeof exports === 'object') { // Node. Does not work with strict CommonJS, but // only CommonJS-like enviroments that support module.exports, // like Node. factory(module.exports); } else if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define([], function () { return factory(root); }); } else { // Browser globals factory(root); } }(this, function (root) { "use strict"; var categoriesDepsOrder = ["buffers", "bufferViews", "images", "videos", "samplers", "textures", "shaders", "programs", "techniques", "materials", "accessors", "meshes", "cameras", "lights", "skins", "nodes", "scenes", "animations"]; var glTFParser = Object.create(Object.prototype, { _rootDescription: { value: null, writable: true }, rootDescription: { set: function(value) { this._rootDescription = value; }, get: function() { return this._rootDescription; } }, baseURL: { value: null, writable: true }, //detect absolute path following the same protocol than window.location _isAbsolutePath: { value: function(path) { var isAbsolutePathRegExp = new RegExp("^"+window.location.protocol, "i"); return path.match(isAbsolutePathRegExp) ? true : false; } }, resolvePathIfNeeded: { value: function(path) { if (this._isAbsolutePath(path)) { return path; } return this.baseURL + path; } }, _resolvePathsForCategories: { value: function(categories) { categories.forEach( function(category) { var descriptions = this.json[category]; if (descriptions) { var descriptionKeys = Object.keys(descriptions); descriptionKeys.forEach( function(descriptionKey) { var description = descriptions[descriptionKey]; description.path = this.resolvePathIfNeeded(description.path); }, this); } }, this); } }, _json: { value: null, writable: true }, json: { enumerable: true, get: function() { return this._json; }, set: function(value) { if (this._json !== value) { this._json = value; this._resolvePathsForCategories(["buffers", "shaders", "images", "videos"]); } } }, _path: { value: null, writable: true }, getEntryDescription: { value: function (entryID, entryType) { var entries = null; var category = entryType; entries = this.rootDescription[category]; if (!entries) { console.log("ERROR:CANNOT find expected category named:"+category); return null; } return entries ? entries[entryID] : null; } }, _stepToNextCategory: { value: function() { this._state.categoryIndex = this.getNextCategoryIndex(this._state.categoryIndex + 1); if (this._state.categoryIndex !== -1) { this._state.categoryState.index = 0; return true; } return false; } }, _stepToNextDescription: { enumerable: false, value: function() { var categoryState = this._state.categoryState; var keys = categoryState.keys; if (!keys) { console.log("INCONSISTENCY ERROR"); return false; } categoryState.index++; categoryState.keys = null; if (categoryState.index >= keys.length) { return this._stepToNextCategory(); } return false; } }, hasCategory: { value: function(category) { return this.rootDescription[category] ? true : false; } }, _handleState: { value: function() { var methodForType = { "buffers" : this.handleBuffer, "bufferViews" : this.handleBufferView, "shaders" : this.handleShader, "programs" : this.handleProgram, "techniques" : this.handleTechnique, "materials" : this.handleMaterial, "meshes" : this.handleMesh, "cameras" : this.handleCamera, "lights" : this.handleLight, "nodes" : this.handleNode, "scenes" : this.handleScene, "images" : this.handleImage, "animations" : this.handleAnimation, "accessors" : this.handleAccessor, "skins" : this.handleSkin, "samplers" : this.handleSampler, "textures" : this.handleTexture, "videos" : this.handleVideo }; var success = true; while (this._state.categoryIndex !== -1) { var category = categoriesDepsOrder[this._state.categoryIndex]; var categoryState = this._state.categoryState; var keys = categoryState.keys; if (!keys) { categoryState.keys = keys = Object.keys(this.rootDescription[category]); if (keys) { if (keys.length == 0) { this._stepToNextDescription(); continue; } } } var type = category; var entryID = keys[categoryState.index]; var description = this.getEntryDescription(entryID, type); if (!description) { if (this.handleError) { this.handleError("INCONSISTENCY ERROR: no description found for entry "+entryID); success = false; break; } } else { if (methodForType[type]) { if (methodForType[type].call(this, entryID, description, this._state.userInfo) === false) { success = false; break; } } this._stepToNextDescription(); } } if (this.handleLoadCompleted) { this.handleLoadCompleted(success); } } }, _loadJSONIfNeeded: { enumerable: true, value: function(callback) { var self = this; //FIXME: handle error if (!this._json) { var jsonPath = this._path; var i = jsonPath.lastIndexOf("/"); this.baseURL = (i !== 0) ? jsonPath.substring(0, i + 1) : ''; var jsonfile = new XMLHttpRequest(); jsonfile.open("GET", jsonPath, true); jsonfile.addEventListener( 'load', function ( event ) { self.json = JSON.parse(jsonfile.responseText); if (callback) { callback(self.json); } }, false ); jsonfile.send(null); } else { if (callback) { callback(this.json); } } } }, /* load JSON and assign it as description to the reader */ _buildLoader: { value: function(callback) { var self = this; function JSONReady(json) { self.rootDescription = json; if (callback) callback(this); } this._loadJSONIfNeeded(JSONReady); } }, _state: { value: null, writable: true }, _getEntryType: { value: function(entryID) { var rootKeys = categoriesDepsOrder; for (var i = 0 ; i < rootKeys.length ; i++) { var rootValues = this.rootDescription[rootKeys[i]]; if (rootValues) { return rootKeys[i]; } } return null; } }, getNextCategoryIndex: { value: function(currentIndex) { for (var i = currentIndex ; i < categoriesDepsOrder.length ; i++) { if (this.hasCategory(categoriesDepsOrder[i])) { return i; } } return -1; } }, load: { enumerable: true, value: function(userInfo, options) { var self = this; this._buildLoader(function loaderReady(reader) { var startCategory = self.getNextCategoryIndex.call(self,0); if (startCategory !== -1) { self._state = { "userInfo" : userInfo, "options" : options, "categoryIndex" : startCategory, "categoryState" : { "index" : "0" } }; self._handleState(); } }); } }, initWithPath: { value: function(path) { this._path = path; this._json = null; return this; } }, //this is meant to be global and common for all instances _knownURLs: { writable: true, value: {} }, //to be invoked by subclass, so that ids can be ensured to not overlap loaderContext: { value: function() { if (typeof this._knownURLs[this._path] === "undefined") { this._knownURLs[this._path] = Object.keys(this._knownURLs).length; } return "__" + this._knownURLs[this._path]; } }, initWithJSON: { value: function(json, baseURL) { this.json = json; this.baseURL = baseURL; if (!baseURL) { console.log("WARNING: no base URL passed to Reader:initWithJSON"); } return this; } } }); if(root) { root.glTFParser = glTFParser; } return glTFParser; })); /** * @author Tony Parisi / http://www.tonyparisi.com/ */ THREE.glTFLoader = function (showStatus) { this.useBufferGeometry = (THREE.glTFLoader.useBufferGeometry !== undefined ) ? THREE.glTFLoader.useBufferGeometry : true; this.meshesRequested = 0; this.meshesLoaded = 0; this.pendingMeshes = []; this.animationsRequested = 0; this.animationsLoaded = 0; this.animations = []; this.shadersRequested = 0; this.shadersLoaded = 0; this.shaders = {}; THREE.Loader.call( this, showStatus ); } THREE.glTFLoader.prototype = new THREE.Loader(); THREE.glTFLoader.prototype.constructor = THREE.glTFLoader; THREE.glTFLoader.prototype.load = function( url, callback ) { var theLoader = this; // Utilities function RgbArraytoHex(colorArray) { if(!colorArray) return 0xFFFFFFFF; var r = Math.floor(colorArray[0] * 255), g = Math.floor(colorArray[1] * 255), b = Math.floor(colorArray[2] * 255), a = 255; var color = (a << 24) + (r << 16) + (g << 8) + b; return color; } function convertAxisAngleToQuaternion(rotations, count) { var q = new THREE.Quaternion; var axis = new THREE.Vector3; var euler = new THREE.Vector3; var i; for (i = 0; i < count; i++) { axis.set(rotations[i * 4], rotations[i * 4 + 1], rotations[i * 4 + 2]).normalize(); var angle = rotations[i * 4 + 3]; q.setFromAxisAngle(axis, angle); rotations[i * 4] = q.x; rotations[i * 4 + 1] = q.y; rotations[i * 4 + 2] = q.z; rotations[i * 4 + 3] = q.w; } } function componentsPerElementForGLType(glType) { switch (glType) { case WebGLRenderingContext.FLOAT : case WebGLRenderingContext.UNSIGNED_BYTE : case WebGLRenderingContext.UNSIGNED_SHORT : return 1; case WebGLRenderingContext.FLOAT_VEC2 : return 2; case WebGLRenderingContext.FLOAT_VEC3 : return 3; case WebGLRenderingContext.FLOAT_VEC4 : return 4; case WebGLRenderingContext.FLOAT_MAT4 : return 16; default: return null; } } function LoadTexture(src) { if(!src) { return null; } return THREE.ImageUtils.loadTexture(src); } // Geometry processing var ClassicGeometry = function() { if (theLoader.useBufferGeometry) { this.geometry = new THREE.BufferGeometry; } else { this.geometry = new THREE.Geometry; } this.totalAttributes = 0; this.loadedAttributes = 0; this.indicesLoaded = false; this.finished = false; this.onload = null; this.uvs = null; this.indexArray = null; }; ClassicGeometry.prototype.constructor = ClassicGeometry; ClassicGeometry.prototype.buildArrayGeometry = function() { // Build indexed mesh var geometry = this.geometry; var normals = geometry.normals; var indexArray = this.indexArray; var uvs = this.uvs; var a, b, c; var i, l; var faceNormals = null; var faceTexcoords = null; for(i = 0, l = this.indexArray.length; i < l; i += 3) { a = indexArray[i]; b = indexArray[i+1]; c = indexArray[i+2]; if(normals) { faceNormals = [normals[a], normals[b], normals[c]]; } geometry.faces.push( new THREE.Face3( a, b, c, faceNormals, null, null ) ); if(uvs) { geometry.faceVertexUvs[0].push([ uvs[a], uvs[b], uvs[c] ]); } } // Allow Three.js to calculate some values for us geometry.computeBoundingBox(); geometry.computeBoundingSphere(); geometry.computeCentroids(); geometry.computeFaceNormals(); if(!normals) { geometry.computeVertexNormals(); } } ClassicGeometry.prototype.buildBufferGeometry = function() { // Build indexed mesh var geometry = this.geometry; geometry.attributes.index = { itemSize: 1, array : this.indexArray }; var offset = { start: 0, index: 0, count: this.indexArray.length }; geometry.offsets.push( offset ); geometry.computeBoundingSphere(); } ClassicGeometry.prototype.checkFinished = function() { if(this.indexArray && this.loadedAttributes === this.totalAttributes) { if (theLoader.useBufferGeometry) { this.buildBufferGeometry(); } else { this.buildArrayGeometry(); } this.finished = true; if(this.onload) { this.onload(); } } }; // Delegate for processing index buffers var IndicesDelegate = function() {}; IndicesDelegate.prototype.handleError = function(errorCode, info) { // FIXME: report error console.log("ERROR(IndicesDelegate):"+errorCode+":"+info); }; IndicesDelegate.prototype.convert = function(resource, ctx) { return new Uint16Array(resource, 0, ctx.indices.count); }; IndicesDelegate.prototype.resourceAvailable = function(glResource, ctx) { var geometry = ctx.geometry; geometry.indexArray = glResource; geometry.checkFinished(); return true; }; var indicesDelegate = new IndicesDelegate(); var IndicesContext = function(indices, geometry) { this.indices = indices; this.geometry = geometry; }; // Delegate for processing vertex attribute buffers var VertexAttributeDelegate = function() {}; VertexAttributeDelegate.prototype.handleError = function(errorCode, info) { // FIXME: report error console.log("ERROR(VertexAttributeDelegate):"+errorCode+":"+info); }; VertexAttributeDelegate.prototype.convert = function(resource, ctx) { return resource; }; VertexAttributeDelegate.prototype.arrayResourceAvailable = function(glResource, ctx) { var geom = ctx.geometry; var attribute = ctx.attribute; var semantic = ctx.semantic; var floatArray; var i, l; //FIXME: Float32 is assumed here, but should be checked. if(semantic == "POSITION") { // TODO: Should be easy to take strides into account here floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type)); for(i = 0, l = floatArray.length; i < l; i += 3) { geom.geometry.vertices.push( new THREE.Vector3( floatArray[i], floatArray[i+1], floatArray[i+2] ) ); } } else if(semantic == "NORMAL") { geom.geometry.normals = []; floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type)); for(i = 0, l = floatArray.length; i < l; i += 3) { geom.geometry.normals.push( new THREE.Vector3( floatArray[i], floatArray[i+1], floatArray[i+2] ) ); } } else if ((semantic == "TEXCOORD_0") || (semantic == "TEXCOORD" )) { geom.uvs = []; floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type)); for(i = 0, l = floatArray.length; i < l; i += 2) { geom.uvs.push( new THREE.Vector2( floatArray[i], 1.0 - floatArray[i+1] ) ); } } else if (semantic == "WEIGHT") { nComponents = componentsPerElementForGLType(attribute.type); floatArray = new Float32Array(glResource, 0, attribute.count * nComponents); for(i = 0, l = floatArray.length; i < l; i += 4) { geom.geometry.skinWeights.push( new THREE.Vector4( floatArray[i], floatArray[i+1], floatArray[i+2], floatArray[i+3] ) ); } } else if (semantic == "JOINT") { nComponents = componentsPerElementForGLType(attribute.type); floatArray = new Float32Array(glResource, 0, attribute.count * nComponents); for(i = 0, l = floatArray.length; i < l; i += 4) { geom.geometry.skinIndices.push( new THREE.Vector4( floatArray[i], floatArray[i+1], floatArray[i+2], floatArray[i+3] ) ); } } } VertexAttributeDelegate.prototype.bufferResourceAvailable = function(glResource, ctx) { var geom = ctx.geometry; var attribute = ctx.attribute; var semantic = ctx.semantic; var floatArray; var i, l; var nComponents; //FIXME: Float32 is assumed here, but should be checked. if(semantic == "POSITION") { // TODO: Should be easy to take strides into account here floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type)); geom.geometry.attributes.position = { itemSize: 3, array : floatArray }; } else if(semantic == "NORMAL") { floatArray = new Float32Array(glResource, 0, attribute.count * componentsPerElementForGLType(attribute.type)); geom.geometry.attributes.normal = { itemSize: 3, array : floatArray }; } else if ((semantic == "TEXCOORD_0") || (semantic == "TEXCOORD" )) { nComponents = componentsPerElementForGLType(attribute.type); floatArray = new Float32Array(glResource, 0, attribute.count * nComponents); // N.B.: flip Y value... should we just set texture.flipY everywhere? for (i = 0; i < floatArray.length / 2; i++) { floatArray[i*2+1] = 1.0 - floatArray[i*2+1]; } geom.geometry.attributes.uv = { itemSize: nComponents, array : floatArray }; } else if (semantic == "WEIGHT") { nComponents = componentsPerElementForGLType(attribute.type); floatArray = new Float32Array(glResource, 0, attribute.count * nComponents); geom.geometry.attributes.skinWeight = { itemSize: nComponents, array : floatArray }; } else if (semantic == "JOINT") { nComponents = componentsPerElementForGLType(attribute.type); floatArray = new Float32Array(glResource, 0, attribute.count * nComponents); geom.geometry.attributes.skinIndex = { itemSize: nComponents, array : floatArray }; } } VertexAttributeDelegate.prototype.resourceAvailable = function(glResource, ctx) { if (theLoader.useBufferGeometry) { this.bufferResourceAvailable(glResource, ctx); } else { this.arrayResourceAvailable(glResource, ctx); } var geom = ctx.geometry; geom.loadedAttributes++; geom.checkFinished(); return true; }; var vertexAttributeDelegate = new VertexAttributeDelegate(); var VertexAttributeContext = function(attribute, semantic, geometry) { this.attribute = attribute; this.semantic = semantic; this.geometry = geometry; }; var Mesh = function() { this.primitives = []; this.materialsPending = []; this.loadedGeometry = 0; this.onCompleteCallbacks = []; }; Mesh.prototype.addPrimitive = function(geometry, material) { var self = this; geometry.onload = function() { self.loadedGeometry++; self.checkComplete(); }; this.primitives.push({ geometry: geometry, material: material, mesh: null }); }; Mesh.prototype.onComplete = function(callback) { this.onCompleteCallbacks.push(callback); this.checkComplete(); }; Mesh.prototype.checkComplete = function() { var self = this; if(this.onCompleteCallbacks.length && this.primitives.length == this.loadedGeometry) { this.onCompleteCallbacks.forEach(function(callback) { callback(self); }); this.onCompleteCallbacks = []; } }; Mesh.prototype.attachToNode = function(threeNode) { // Assumes that the geometry is complete this.primitives.forEach(function(primitive) { /*if(!primitive.mesh) { primitive.mesh = new THREE.Mesh(primitive.geometry, primitive.material); }*/ var material = primitive.material; if (!(material instanceof THREE.Material)) { material = theLoader.createShaderMaterial(material); } var threeMesh = new THREE.Mesh(primitive.geometry.geometry, material); threeMesh.castShadow = true; threeNode.add(threeMesh); }); }; // Delayed-loaded material var Material = function(params) { this.params = params; }; // Delegate for processing animation parameter buffers var AnimationParameterDelegate = function() {}; AnimationParameterDelegate.prototype.handleError = function(errorCode, info) { // FIXME: report error console.log("ERROR(AnimationParameterDelegate):"+errorCode+":"+info); }; AnimationParameterDelegate.prototype.convert = function(resource, ctx) { var parameter = ctx.parameter; var glResource = null; switch (parameter.type) { case WebGLRenderingContext.FLOAT : case WebGLRenderingContext.FLOAT_VEC2 : case WebGLRenderingContext.FLOAT_VEC3 : case WebGLRenderingContext.FLOAT_VEC4 : glResource = new Float32Array(resource, 0, parameter.count * componentsPerElementForGLType(parameter.type)); break; default: break; } return glResource; }; AnimationParameterDelegate.prototype.resourceAvailable = function(glResource, ctx) { var animation = ctx.animation; var parameter = ctx.parameter; parameter.data = glResource; animation.handleParameterLoaded(parameter); return true; }; var animationParameterDelegate = new AnimationParameterDelegate(); var AnimationParameterContext = function(parameter, animation) { this.parameter = parameter; this.animation = animation; }; // Animations var Animation = function() { // create Three.js keyframe here this.totalParameters = 0; this.loadedParameters = 0; this.parameters = {}; this.finishedLoading = false; this.onload = null; }; Animation.prototype.constructor = Animation; Animation.prototype.handleParameterLoaded = function(parameter) { this.parameters[parameter.name] = parameter; this.loadedParameters++; this.checkFinished(); }; Animation.prototype.checkFinished = function() { if(this.loadedParameters === this.totalParameters) { // Build animation this.finishedLoading = true; if (this.onload) { this.onload(); } } }; // Delegate for processing inverse bind matrices buffer var InverseBindMatricesDelegate = function() {}; InverseBindMatricesDelegate.prototype.handleError = function(errorCode, info) { // FIXME: report error console.log("ERROR(InverseBindMatricesDelegate):"+errorCode+":"+info); }; InverseBindMatricesDelegate.prototype.convert = function(resource, ctx) { var parameter = ctx.parameter; var glResource = null; switch (parameter.type) { case WebGLRenderingContext.FLOAT_MAT4 : glResource = new Float32Array(resource, 0, parameter.count * componentsPerElementForGLType(parameter.type)); break; default: break; } return glResource; }; InverseBindMatricesDelegate.prototype.resourceAvailable = function(glResource, ctx) { var skin = ctx.skin; skin.inverseBindMatrices = glResource; return true; }; var inverseBindMatricesDelegate = new InverseBindMatricesDelegate(); var InverseBindMatricesContext = function(param, skin) { this.parameter = param; this.skin = skin; }; // Delegate for processing shaders from external files var ShaderDelegate = function() {}; ShaderDelegate.prototype.handleError = function(errorCode, info) { // FIXME: report error console.log("ERROR(ShaderDelegate):"+errorCode+":"+info); }; ShaderDelegate.prototype.convert = function(resource, ctx) { return resource; } ShaderDelegate.prototype.resourceAvailable = function(data, ctx) { theLoader.shadersLoaded++; theLoader.shaders[ctx.id] = data; return true; }; var shaderDelegate = new ShaderDelegate(); var ShaderContext = function(id, path) { this.id = id; this.path = path; }; // Resource management var ResourceEntry = function(entryID, object, description) { this.entryID = entryID; this.object = object; this.description = description; }; var Resources = function() { this._entries = {}; }; Resources.prototype.setEntry = function(entryID, object, description) { if (!entryID) { console.error("No EntryID provided, cannot store", description); return; } if (this._entries[entryID]) { console.warn("entry["+entryID+"] is being overwritten"); } this._entries[entryID] = new ResourceEntry(entryID, object, description ); }; Resources.prototype.getEntry = function(entryID) { return this._entries[entryID]; }; Resources.prototype.clearEntries = function() { this._entries = {}; }; var LoadDelegate = function() { } LoadDelegate.prototype.loadCompleted = function(callback, obj) { callback.call(Window, obj); } // Loader var ThreeGLTFLoader = Object.create(glTFParser, { load: { enumerable: true, value: function(userInfo, options) { this.resources = new Resources(); this.cameras = []; this.lights = []; this.animations = []; this.joints = {}; this.skeltons = {}; this.loaderUtils = THREE.GLTFLoaderUtils(); glTFParser.load.call(this, userInfo, options); } }, cameras: { enumerable: true, writable: true, value : [] }, lights: { enumerable: true, writable: true, value : [] }, animations: { enumerable: true, writable: true, value : [] }, // Implement WebGLTFLoader handlers handleBuffer: { value: function(entryID, description, userInfo) { this.resources.setEntry(entryID, null, description); description.type = "ArrayBuffer"; return true; } }, handleBufferView: { value: function(entryID, description, userInfo) { this.resources.setEntry(entryID, null, description); var buffer = this.resources.getEntry(description.buffer); description.type = "ArrayBufferView"; var bufferViewEntry = this.resources.getEntry(entryID); bufferViewEntry.buffer = buffer; return true; } }, handleShader: { value: function(entryID, description, userInfo) { this.resources.setEntry(entryID, null, description); var shaderRequest = { id : entryID, path : description.path, }; var shaderContext = new ShaderContext(entryID, description.path); // theLoader.shadersRequested++; // this.loaderUtils.getFile(shaderRequest, shaderDelegate, shaderContext); return true; } }, handleProgram: { value: function(entryID, description, userInfo) { this.resources.setEntry(entryID, null, description); return true; } }, handleTechnique: { value: function(entryID, description, userInfo) { this.resources.setEntry(entryID, null, description); return true; } }, createShaderMaterial : { value: function(material) { var fragmentShader = theLoader.shaders[material.params.fragmentShader]; if (!fragmentShader) { console.log("ERROR: Missing fragment shader definition:", material.params.fragmentShader); return new THREE.MeshPhongMaterial; } var vertexShader = theLoader.shaders[material.params.vertexShader]; if (!fragmentShader) { console.log("ERROR: Missing vertex shader definition:", material.params.vertexShader); return new THREE.MeshPhongMaterial; } var uniforms = {}; var shaderMaterial = new THREE.ShaderMaterial( { fragmentShader: fragmentShader, vertexShader: vertexShader, uniforms: uniforms, } ); return new THREE.MeshPhongMaterial(material.params); } }, createShaderParams : { value: function(materialId, values, params, instanceProgram) { var program = this.resources.getEntry(instanceProgram.program); if (program) { params.fragmentShader = program.description.fragmentShader; params.vertexShader = program.description.vertexShader; params.attributes = instanceProgram.attributes; params.uniforms = instanceProgram.uniforms; } } }, threeJSMaterialType : { value: function(materialId, technique, values, params) { var materialType = THREE.MeshPhongMaterial; var defaultPass = null; if (technique && technique.description && technique.description.passes) defaultPass = technique.description.passes.defaultPass; if (defaultPass) { if (defaultPass.details && defaultPass.details.commonProfile) { var profile = technique.description.passes.defaultPass.details.commonProfile; if (profile) { switch (profile.lightingModel) { case 'Blinn' : case 'Phong' : materialType = THREE.MeshPhongMaterial; break; case 'Lambert' : materialType = THREE.MeshLambertMaterial; break; default : materialType = THREE.MeshBasicMaterial; break; } if (profile.extras && profile.extras.doubleSided) { params.side = THREE.DoubleSide; } } } else if (defaultPass.instanceProgram) { var instanceProgram = defaultPass.instanceProgram; this.createShaderParams(materialId, values, params, instanceProgram); var loadshaders = true; if (loadshaders) { materialType = Material; } } } var texturePath = null; var textureParams = null; var diffuse = values.diffuse; if (diffuse) { var texture = diffuse; if (texture) { var textureEntry = this.resources.getEntry(texture); if (textureEntry) { { var imageEntry = this.resources.getEntry(textureEntry.description.source); if (imageEntry) { texturePath = imageEntry.description.path; } var samplerEntry = this.resources.getEntry(textureEntry.description.sampler); if (samplerEntry) { textureParams = samplerEntry.description; } } } } } var texture = LoadTexture(texturePath); if (texture && textureParams) { if (textureParams.wrapS == WebGLRenderingContext.REPEAT) texture.wrapS = THREE.RepeatWrapping; if (textureParams.wrapT == WebGLRenderingContext.REPEAT) texture.wrapT = THREE.RepeatWrapping; if (textureParams.magFilter == WebGLRenderingContext.LINEAR) texture.magFilter = THREE.LinearFilter; // if (textureParams.minFilter == "LINEAR") // texture.minFilter = THREE.LinearFilter; params.map = texture; } var envMapPath = null; var envMapParams = null; var reflective = values.reflective; if (reflective) { var texture = reflective; if (texture) { var textureEntry = this.resources.getEntry(texture); if (textureEntry) { { var imageEntry = this.resources.getEntry(textureEntry.description.source); if (imageEntry) { envMapPath = imageEntry.description.path; } var samplerEntry = this.resources.getEntry(textureEntry.description.sampler); if (samplerEntry) { envMapParams = samplerEntry.description; } } } } } var texture = LoadTexture(envMapPath); if (texture && envMapParams) { if (envMapParams.wrapS == WebGLRenderingContext.REPEAT) texture.wrapS = THREE.RepeatWrapping; if (envMapParams.wrapT == WebGLRenderingContext.REPEAT) texture.wrapT = THREE.RepeatWrapping; if (envMapParams.magFilter == WebGLRenderingContext.LINEAR) texture.magFilter = THREE.LinearFilter; // if (envMapParams.minFilter == WebGLRenderingContext.LINEAR) // texture.minFilter = THREE.LinearFilter; params.envMap = texture; } var shininess = values.shininesss || values.shininess; // N.B.: typo in converter! if (shininess) { shininess = shininess; } var diffuseColor = !texturePath ? diffuse : null; var opacity = 1.0; if (values.hasOwnProperty("transparency")) { var USE_A_ONE = true; // for now, hack because file format isn't telling us opacity = USE_A_ONE ? values.transparency : (1.0 - values.transparency); } // if (diffuseColor) diffuseColor = [0, 1, 0]; params.color = RgbArraytoHex(diffuseColor); params.opacity = opacity; params.transparent = opacity < 1.0; // hack hack hack if (texturePath && texturePath.toLowerCase().indexOf(".png") != -1) params.transparent = true; if (!(shininess === undefined)) { params.shininess = shininess; } if (!(values.ambient === undefined) && !(typeof(values.ambient) == 'string')) { params.ambient = RgbArraytoHex(values.ambient); } if (!(values.emission === undefined)) { params.emissive = RgbArraytoHex(values.emission); } if (!(values.specular === undefined)) { params.specular = RgbArraytoHex(values.specular); } return materialType; } }, handleMaterial: { value: function(entryID, description, userInfo) { //this should be rewritten using the meta datas that actually create the shader. //here we will infer what needs to be pass to Three.js by looking inside the technique parameters. var technique = this.resources.getEntry(description.instanceTechnique.technique); var materialParams = {}; var values = description.instanceTechnique.values; var materialType = this.threeJSMaterialType(entryID, technique, values, materialParams); var material = new materialType(materialParams); this.resources.setEntry(entryID, material, description); return true; } }, handleMesh: { value: function(entryID, description, userInfo) { var mesh = new Mesh(); this.resources.setEntry(entryID, mesh, description); var primitivesDescription = description.primitives; if (!primitivesDescription) { //FIXME: not implemented in delegate console.log("MISSING_PRIMITIVES for mesh:"+ entryID); return false; } for (var i = 0 ; i < primitivesDescription.length ; i++) { var primitiveDescription = primitivesDescription[i]; if (primitiveDescription.primitive === WebGLRenderingContext.TRIANGLES) { var geometry = new ClassicGeometry(); var materialEntry = this.resources.getEntry(primitiveDescription.material); mesh.addPrimitive(geometry, materialEntry.object); var indices = this.resources.getEntry(primitiveDescription.indices); var bufferEntry = this.resources.getEntry(indices.description.bufferView); var indicesObject = { bufferView : bufferEntry, byteOffset : indices.description.byteOffset, count : indices.description.count, id : indices.entryID, type : indices.description.type }; var indicesContext = new IndicesContext(indicesObject, geometry); var alreadyProcessedIndices = this.loaderUtils.getBuffer(indicesObject, indicesDelegate, indicesContext); /*if(alreadyProcessedIndices) { indicesDelegate.resourceAvailable(alreadyProcessedIndices, indicesContext); }*/ // Load Vertex Attributes var allAttributes = Object.keys(primitiveDescription.attributes); allAttributes.forEach( function(semantic) { geometry.totalAttributes++; var attribute; var attributeID = primitiveDescription.attributes[semantic]; var attributeEntry = this.resources.getEntry(attributeID); if (!attributeEntry) { //let's just use an anonymous object for the attribute attribute = description.attributes[attributeID]; attribute.id = attributeID; this.resources.setEntry(attributeID, attribute, attribute); var bufferEntry = this.resources.getEntry(attribute.bufferView); attributeEntry = this.resources.getEntry(attributeID); } else { attribute = attributeEntry.object; attribute.id = attributeID; var bufferEntry = this.resources.getEntry(attribute.bufferView); } var attributeObject = { bufferView : bufferEntry, byteOffset : attribute.byteOffset, byteStride : attribute.byteStride, count : attribute.count, max : attribute.max, min : attribute.min, type : attribute.type, id : attributeID }; var attribContext = new VertexAttributeContext(attributeObject, semantic, geometry); var alreadyProcessedAttribute = this.loaderUtils.getBuffer(attributeObject, vertexAttributeDelegate, attribContext); /*if(alreadyProcessedAttribute) { vertexAttributeDelegate.resourceAvailable(alreadyProcessedAttribute, attribContext); }*/ }, this); } } return true; } }, handleCamera: { value: function(entryID, description, userInfo) { var camera; if (description.type == "perspective") { var znear = description.perspective.znear; var zfar = description.perspective.zfar; var yfov = description.perspective.yfov; var xfov = description.perspective.xfov; var aspect_ratio = description.perspective.aspect_ratio; if (!aspect_ratio) aspect_ratio = 1; if (yfov === undefined) { if (xfov) { // According to COLLADA spec... // aspect_ratio = xfov / yfov yfov = xfov / aspect_ratio; } } if (yfov) { camera = new THREE.PerspectiveCamera(yfov, aspect_ratio, znear, zfar); } } else { camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, znear, zfar ); } if (camera) { this.resources.setEntry(entryID, camera, description); } return true; } }, handleLight: { value: function(entryID, description, userInfo) { var light = null; var type = description.type; if (type && description[type]) { var lparams = description[type]; var color = RgbArraytoHex(lparams.color); switch (type) { case "directional" : light = new THREE.DirectionalLight(color); light.position.set(0, 0, 1); break; case "point" : light = new THREE.PointLight(color); break; case "spot " : light = new THREE.SpotLight(color); light.position.set(0, 0, 1); break; case "ambient" : light = new THREE.AmbientLight(color); break; } } if (light) { this.resources.setEntry(entryID, light, description); } return true; } }, addPendingMesh: { value: function(mesh, threeNode) { theLoader.pendingMeshes.push({ mesh: mesh, node: threeNode }); } }, handleNode: { value: function(entryID, description, userInfo) { var threeNode = null; if (description.jointId) { threeNode = new THREE.Bone(); threeNode.jointId = description.jointId; this.joints[description.jointId] = entryID; } else { threeNode = new THREE.Object3D(); } threeNode.name = description.name; this.resources.setEntry(entryID, threeNode, description); var m = description.matrix; if(m) { threeNode.matrixAutoUpdate = false; threeNode.applyMatrix(new THREE.Matrix4( m[0], m[4], m[8], m[12], m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15] )); } else { var t = description.translation; var r = description.rotation; var s = description.scale; var position = t ? new THREE.Vector3(t[0], t[1], t[2]) : new THREE.Vector3; if (r) { convertAxisAngleToQuaternion(r, 1); } var rotation = r ? new THREE.Quaternion(r[0], r[1], r[2], r[3]) : new THREE.Quaternion; var scale = s ? new THREE.Vector3(s[0], s[1], s[2]) : new THREE.Vector3; var matrix = new THREE.Matrix4; matrix.compose(position, rotation, scale); threeNode.matrixAutoUpdate = false; threeNode.applyMatrix(matrix); } var self = this; // Iterate through all node meshes and attach the appropriate objects //FIXME: decision needs to be made between these 2 ways, probably meshes will be discarded. var meshEntry; if (description.mesh) { meshEntry = this.resources.getEntry(description.mesh); theLoader.meshesRequested++; meshEntry.object.onComplete(function(mesh) { self.addPendingMesh(mesh, threeNode); theLoader.meshesLoaded++; theLoader.checkComplete(); }); } if (description.meshes) { description.meshes.forEach( function(meshID) { meshEntry = this.resources.getEntry(meshID); theLoader.meshesRequested++; meshEntry.object.onComplete(function(mesh) { self.addPendingMesh(mesh, threeNode); theLoader.meshesLoaded++; theLoader.checkComplete(); }); }, this); } if (description.instanceSkin) { var skinEntry = this.resources.getEntry(description.instanceSkin.skin); if (skinEntry) { var skin = skinEntry.object; description.instanceSkin.skin = skin; threeNode.instanceSkin = description.instanceSkin; var sources = description.instanceSkin.sources; skin.meshes = []; sources.forEach( function(meshID) { meshEntry = this.resources.getEntry(meshID); theLoader.meshesRequested++; meshEntry.object.onComplete(function(mesh) { skin.meshes.push(mesh); theLoader.meshesLoaded++; theLoader.checkComplete(); }); }, this); } } if (description.camera) { var cameraEntry = this.resources.getEntry(description.camera); if (cameraEntry) { threeNode.add(cameraEntry.object); this.cameras.push(cameraEntry.object); } } if (description.light) { var lightEntry = this.resources.getEntry(description.light); if (lightEntry) { threeNode.add(lightEntry.object); this.lights.push(lightEntry.object); } } return true; } }, buildNodeHirerachy: { value: function(nodeEntryId, parentThreeNode) { var nodeEntry = this.resources.getEntry(nodeEntryId); var threeNode = nodeEntry.object; parentThreeNode.add(threeNode); var children = nodeEntry.description.children; if (children) { children.forEach( function(childID) { this.buildNodeHirerachy(childID, threeNode); }, this); } return threeNode; } }, buildSkin: { value: function(node) { var skin = node.instanceSkin.skin; if (skin) { node.instanceSkin.skeletons.forEach(function(skeleton) { var nodeEntry = this.resources.getEntry(skeleton); if (nodeEntry) { var rootSkeleton = nodeEntry.object; var dobones = true; var i, len = skin.meshes.length; for (i = 0; i < len; i++) { var mesh = skin.meshes[i]; var threeMesh = null; mesh.primitives.forEach(function(primitive) { var material = primitive.material; if (!(material instanceof THREE.Material)) { material = this.createShaderMaterial(material); } threeMesh = new THREE.SkinnedMesh(primitive.geometry.geometry, material, false); threeMesh.add(rootSkeleton); var geometry = primitive.geometry.geometry; var j; if (geometry.vertices) { for ( j = 0; j < geometry.vertices.length; j ++ ) { geometry.vertices[j].applyMatrix4( skin.bindShapeMatrix ); } } else if (geometry.attributes.position) { var a = geometry.attributes.position.array; var v = new THREE.Vector3; for ( j = 0; j < a.length / 3; j++ ) { v.set(a[j * 3], a[j * 3 + 1], a[j * 3 + 2]); v.applyMatrix4( skin.bindShapeMatrix ); a[j * 3] = v.x; a[j * 3 + 1] = v.y; a[j * 3 + 2] = v.z; } } if (threeMesh && dobones) { material.skinning = true; threeMesh.boneInverses = []; var jointsIds = skin.jointsIds; var joints = []; var i, len = jointsIds.length; for (i = 0; i < len; i++) { var jointId = jointsIds[i]; var nodeForJoint = this.joints[jointId]; var joint = this.resources.getEntry(nodeForJoint).object; if (joint) { joint.skin = threeMesh; joints.push(joint); threeMesh.bones.push(joint); var m = skin.inverseBindMatrices; var mat = new THREE.Matrix4( m[i * 16 + 0], m[i * 16 + 4], m[i * 16 + 8], m[i * 16 + 12], m[i * 16 + 1], m[i * 16 + 5], m[i * 16 + 9], m[i * 16 + 13], m[i * 16 + 2], m[i * 16 + 6], m[i * 16 + 10], m[i * 16 + 14], m[i * 16 + 3], m[i * 16 + 7], m[i * 16 + 11], m[i * 16 + 15] ); threeMesh.boneInverses.push(mat); threeMesh.pose(); } else { console.log("WARNING: jointId:"+jointId+" cannot be found in skeleton:"+skeleton); } } } if (threeMesh) { threeMesh.castShadow = true; node.add(threeMesh); } }, this); } } }, this); } } }, buildSkins: { value: function(node) { if (node.instanceSkin) this.buildSkin(node); var children = node.children; if (children) { children.forEach( function(child) { this.buildSkins(child); }, this); } } }, createMeshAnimations : { value : function(root) { this.buildSkins(root); } }, handleScene: { value: function(entryID, description, userInfo) { if (!description.nodes) { console.log("ERROR: invalid file required nodes property is missing from scene"); return false; } description.nodes.forEach( function(nodeUID) { this.buildNodeHirerachy(nodeUID, userInfo.rootObj); }, this); if (this.delegate) { this.delegate.loadCompleted(userInfo.callback, userInfo.rootObj); } return true; } }, handleImage: { value: function(entryID, description, userInfo) { this.resources.setEntry(entryID, null, description); return true; } }, addNodeAnimationChannel : { value : function(name, channel, interp) { if (!this.nodeAnimationChannels) this.nodeAnimationChannels = {}; if (!this.nodeAnimationChannels[name]) { this.nodeAnimationChannels[name] = []; } this.nodeAnimationChannels[name].push(interp); }, }, createAnimations : { value : function() { for (var name in this.nodeAnimationChannels) { var nodeAnimationChannels = this.nodeAnimationChannels[name]; var i, len = nodeAnimationChannels.length; //console.log(" animation channels for node " + name); //for (i = 0; i < len; i++) { // console.log(nodeAnimationChannels[i]); //} var anim = new THREE.glTFAnimation(nodeAnimationChannels); anim.name = "animation_" + name; this.animations.push(anim); } } }, buildAnimation: { value : function(animation) { var interps = []; var i, len = animation.channels.length; for (i = 0; i < len; i++) { var channel = animation.channels[i]; var sampler = animation.samplers[channel.sampler]; if (sampler) { var input = animation.parameters[sampler.input]; if (input && input.data) { var output = animation.parameters[sampler.output]; if (output && output.data) { var target = channel.target; var node = this.resources.getEntry(target.id); if (node) { var path = target.path; if (path == "rotation") { convertAxisAngleToQuaternion(output.data, output.count); } var interp = { keys : input.data, values : output.data, count : input.count, target : node.object, path : path, type : sampler.interpolation }; this.addNodeAnimationChannel(target.id, channel, interp); interps.push(interp); } } } } } } }, handleAnimation: { value: function(entryID, description, userInfo) { var self = this; theLoader.animationsRequested++; var animation = new Animation(); animation.name = entryID; animation.onload = function() { // self.buildAnimation(animation); theLoader.animationsLoaded++; theLoader.animations.push(animation); theLoader.checkComplete(); }; animation.channels = description.channels; animation.samplers = description.samplers; this.resources.setEntry(entryID, animation, description); var parameters = description.parameters; if (!parameters) { //FIXME: not implemented in delegate console.log("MISSING_PARAMETERS for animation:"+ entryID); return false; } // Load parameter buffers var params = Object.keys(parameters); params.forEach( function(param) { animation.totalParameters++; var parameter = parameters[param]; var accessor = this.resources.getEntry(parameter); if (!accessor) debugger; accessor = accessor.object; var bufferView = this.resources.getEntry(accessor.bufferView); var paramObject = { bufferView : bufferView, byteOffset : accessor.byteOffset, count : accessor.count, type : accessor.type, id : accessor.bufferView, name : param }; var paramContext = new AnimationParameterContext(paramObject, animation); var alreadyProcessedAttribute = this.loaderUtils.getBuffer(paramObject, animationParameterDelegate, paramContext); /*if(alreadyProcessedAttribute) { vertexAttributeDelegate.resourceAvailable(alreadyProcessedAttribute, attribContext); }*/ }, this); return true; } }, handleAccessor: { value: function(entryID, description, userInfo) { // Save attribute entry this.resources.setEntry(entryID, description, description); return true; } }, handleSkin: { value: function(entryID, description, userInfo) { // Save skin entry var skin = { }; var m = description.bindShapeMatrix; skin.bindShapeMatrix = new THREE.Matrix4( m[0], m[4], m[8], m[12], m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15] ); skin.jointsIds = description.joints; var inverseBindMatricesDescription = description.inverseBindMatrices; skin.inverseBindMatricesDescription = inverseBindMatricesDescription; skin.inverseBindMatricesDescription.id = entryID + "_inverseBindMatrices"; var bufferEntry = this.resources.getEntry(inverseBindMatricesDescription.bufferView); var paramObject = { bufferView : bufferEntry, byteOffset : inverseBindMatricesDescription.byteOffset, count : inverseBindMatricesDescription.count, type : inverseBindMatricesDescription.type, id : inverseBindMatricesDescription.bufferView, name : skin.inverseBindMatricesDescription.id }; var context = new InverseBindMatricesContext(paramObject, skin); var alreadyProcessedAttribute = this.loaderUtils.getBuffer(paramObject, inverseBindMatricesDelegate, context); var bufferView = this.resources.getEntry(skin.inverseBindMatricesDescription.bufferView); skin.inverseBindMatricesDescription.bufferView = bufferView.object; this.resources.setEntry(entryID, skin, description); return true; } }, handleSampler: { value: function(entryID, description, userInfo) { // Save attribute entry this.resources.setEntry(entryID, description, description); return true; } }, handleTexture: { value: function(entryID, description, userInfo) { // Save attribute entry this.resources.setEntry(entryID, null, description); return true; } }, handleError: { value: function(msg) { throw new Error(msg); return true; } }, _delegate: { value: new LoadDelegate, writable: true }, delegate: { enumerable: true, get: function() { return this._delegate; }, set: function(value) { this._delegate = value; } } }); // Loader var Context = function(rootObj, callback) { this.rootObj = rootObj; this.callback = callback; }; var rootObj = new THREE.Object3D(); var self = this; var loader = Object.create(ThreeGLTFLoader); this.loader = loader; this.callback = callback; this.rootObj = rootObj; loader.initWithPath(url); loader.load(new Context(rootObj, function(obj) { }), null); return rootObj; } THREE.glTFLoader.prototype.callLoadedCallback = function() { var result = { scene : this.rootObj, cameras : this.loader.cameras, animations : this.loader.animations, }; this.callback(result); } THREE.glTFLoader.prototype.checkComplete = function() { if (this.meshesLoaded == this.meshesRequested && this.shadersLoaded == this.shadersRequested && this.animationsLoaded == this.animationsRequested) { for (var i = 0; i < this.pendingMeshes.length; i++) { var pending = this.pendingMeshes[i]; pending.mesh.attachToNode(pending.node); } for (var i = 0; i < this.animationsLoaded; i++) { var animation = this.animations[i]; this.loader.buildAnimation(animation); } this.loader.createAnimations(); this.loader.createMeshAnimations(this.rootObj); this.callLoadedCallback(); } } /** * @author Tony Parisi / http://www.tonyparisi.com/ */ THREE.GLTFLoaderUtils = function() { var utils = Object.create(Object, { // errors MISSING_DESCRIPTION: { value: "MISSING_DESCRIPTION" }, INVALID_PATH: { value: "INVALID_PATH" }, INVALID_TYPE: { value: "INVALID_TYPE" }, XMLHTTPREQUEST_STATUS_ERROR: { value: "XMLHTTPREQUEST_STATUS_ERROR" }, NOT_FOUND: { value: "NOT_FOUND" }, // misc constants ARRAY_BUFFER: { value: "ArrayBuffer" }, _streams : { value:{}, writable: true }, _streamsStatus: { value: {}, writable: true }, _resources: { value: {}, writable: true }, _resourcesStatus: { value: {}, writable: true }, // initialization init: { value: function() { this._streams = {}; this._streamsStatus = {}; this._resources = {}; this._resourcesStatus = {}; } }, //manage entries _containsResource: { enumerable: false, value: function(resourceID) { return this._resources[resourceID] ? true : false; } }, _storeResource: { enumerable: false, value: function(resourceID, resource) { if (!resourceID) { console.log("ERROR: entry does not contain id, cannot store"); return; } if (this._containsResource[resourceID]) { console.log("WARNING: resource:"+resourceID+" is already stored, overriding"); } this._resources[resourceID] = resource; } }, _getResource: { enumerable: false, value: function(resourceID) { return this._resources[resourceID]; } }, _loadStream: { value: function(path, type, delegate) { var self = this; if (!type) { delegate.handleError(THREE.GLTFLoaderUtils.INVALID_TYPE, null); return; } if (!path) { delegate.handleError(THREE.GLTFLoaderUtils.INVALID_PATH); return; } var xhr = new XMLHttpRequest(); xhr.open('GET', path, true); xhr.responseType = (type === this.ARRAY_BUFFER) ? "arraybuffer" : "text"; //if this is not specified, 1 "big blob" scenes fails to load. xhr.setRequestHeader("If-Modified-Since", "Sat, 01 Jan 1970 00:00:00 GMT"); xhr.addEventListener( 'load', function ( event ) { delegate.streamAvailable(path, xhr.response); }, false ); xhr.addEventListener( 'error', function ( event ) { delegate.handleError(THREE.GLTFLoaderUtils.XMLHTTPREQUEST_STATUS_ERROR, xhr.status); }, false ); xhr.send(null); } }, send: { value: 0, writable: true }, requested: { value: 0, writable: true }, _handleRequest: { value: function(request) { var resourceStatus = this._resourcesStatus[request.id]; if (resourceStatus) { this._resourcesStatus[request.id]++; } else { this._resourcesStatus[request.id] = 1; } var streamStatus = this._streamsStatus[request.path]; if (streamStatus && streamStatus.status === "loading" ) { streamStatus.requests.push(request); return; } this._streamsStatus[request.path] = { status : "loading", requests : [request] }; var self = this; var processResourceDelegate = {}; processResourceDelegate.streamAvailable = function(path, res_) { var streamStatus = self._streamsStatus[path]; var requests = streamStatus.requests; // console.log("Stream available: ", path, requests.length); requests.forEach( function(req_) { var subArray = res_.slice(req_.range[0], req_.range[1]); var convertedResource = req_.delegate.convert(subArray, req_.ctx); self._storeResource(req_.id, convertedResource); req_.delegate.resourceAvailable(convertedResource, req_.ctx); --self._resourcesStatus[req_.id]; }, this); delete self._streamsStatus[path]; }; processResourceDelegate.handleError = function(errorCode, info) { request.delegate.handleError(errorCode, info); } this._loadStream(request.path, request.type, processResourceDelegate); } }, _elementSizeForGLType: { value: function(glType) { switch (glType) { case WebGLRenderingContext.FLOAT : return Float32Array.BYTES_PER_ELEMENT; case WebGLRenderingContext.UNSIGNED_BYTE : return Uint8Array.BYTES_PER_ELEMENT; case WebGLRenderingContext.UNSIGNED_SHORT : return Uint16Array.BYTES_PER_ELEMENT; case WebGLRenderingContext.FLOAT_VEC2 : return Float32Array.BYTES_PER_ELEMENT * 2; case WebGLRenderingContext.FLOAT_VEC3 : return Float32Array.BYTES_PER_ELEMENT * 3; case WebGLRenderingContext.FLOAT_VEC4 : return Float32Array.BYTES_PER_ELEMENT * 4; case WebGLRenderingContext.FLOAT_MAT3 : return Float32Array.BYTES_PER_ELEMENT * 9; case WebGLRenderingContext.FLOAT_MAT4 : return Float32Array.BYTES_PER_ELEMENT * 16; default: return null; } } }, _handleWrappedBufferViewResourceLoading: { value: function(wrappedBufferView, delegate, ctx) { var bufferView = wrappedBufferView.bufferView; var buffer = bufferView.buffer; var byteOffset = wrappedBufferView.byteOffset + bufferView.description.byteOffset; var range = [byteOffset , (this._elementSizeForGLType(wrappedBufferView.type) * wrappedBufferView.count) + byteOffset]; this._handleRequest({ "id" : wrappedBufferView.id, "range" : range, "type" : buffer.description.type, "path" : buffer.description.path, "delegate" : delegate, "ctx" : ctx }, null); } }, getBuffer: { value: function(wrappedBufferView, delegate, ctx) { var savedBuffer = this._getResource(wrappedBufferView.id); if (savedBuffer) { return savedBuffer; } else { this._handleWrappedBufferViewResourceLoading(wrappedBufferView, delegate, ctx); } return null; } }, getFile: { value: function(request, delegate, ctx) { request.delegate = delegate; request.ctx = ctx; this._handleRequest({ "id" : request.id, "path" : request.path, "range" : [0], "type" : "text", "delegate" : delegate, "ctx" : ctx }, null); return null; } }, }); utils.init(); return utils; } /** * @author Tony Parisi / http://www.tonyparisi.com/ */ THREE.glTFAnimator = ( function () { var animators = []; return { add : function(animator) { animators.push(animator); }, remove: function(animator) { var i = animators.indexOf(animator); if ( i !== -1 ) { animators.splice( i, 1 ); } }, update : function() { for (i = 0; i < animators.length; i++) { animators[i].update(); } }, }; })(); // Construction/initialization THREE.glTFAnimation = function(interps) { this.running = false; this.loop = false; this.duration = 0; this.direction = THREE.glTFAnimation.FORWARD_DIRECTION; this.startTime = 0; this.interps = []; if (interps) { this.createInterpolators(interps); } } THREE.glTFAnimation.prototype.createInterpolators = function(interps) { var i, len = interps.length; for (i = 0; i < len; i++) { var interp = new THREE.glTFInterpolator(interps[i]); this.interps.push(interp); this.duration = Math.max(this.duration, interp.duration); } } // Start/stop THREE.glTFAnimation.prototype.play = function() { if (this.running) return; this.startTime = Date.now(); this.running = true; THREE.glTFAnimator.add(this); } THREE.glTFAnimation.prototype.stop = function() { this.running = false; THREE.glTFAnimator.remove(this); } // Update - drive key frame evaluation THREE.glTFAnimation.prototype.update = function() { if (!this.running) return; var now = Date.now(); var deltat = (now - this.startTime) / 1000; var t = deltat % this.duration; var nCycles = Math.floor(deltat / this.duration); if (this.direction == THREE.glTFAnimation.REVERSE_DIRECTION) { t = this.duration - t; } if (nCycles >= 1 && !this.loop) { this.running = false; var i, len = this.interps.length; for (i = 0; i < len; i++) { if (this.direction == THREE.glTFAnimation.REVERSE_DIRECTION) this.interps[i].interp(0); else this.interps[i].interp(this.duration); } this.stop(); return; } else { var i, len = this.interps.length; for (i = 0; i < len; i++) { this.interps[i].interp(t); } } } //Interpolator class //Construction/initialization THREE.glTFInterpolator = function(param) { this.keys = param.keys; this.values = param.values; this.count = param.count; this.type = param.type; this.path = param.path; this.isRot = false; var node = param.target; node.updateMatrix(); node.matrixAutoUpdate = true; this.targetNode = node; switch (param.path) { case "translation" : this.target = node.position; this.originalValue = node.position.clone(); break; case "rotation" : this.target = node.quaternion; this.originalValue = node.quaternion.clone(); this.isRot = true; break; case "scale" : this.target = node.scale; this.originalValue = node.scale.clone(); break; } this.duration = this.keys[this.count - 1]; this.vec1 = new THREE.Vector3; this.vec2 = new THREE.Vector3; this.vec3 = new THREE.Vector3; this.quat1 = new THREE.Quaternion; this.quat2 = new THREE.Quaternion; this.quat3 = new THREE.Quaternion; } //Interpolation and tweening methods THREE.glTFInterpolator.prototype.interp = function(t) { var i, j; if (t == this.keys[0]) { if (this.isRot) { this.quat3.set(this.values[0], this.values[1], this.values[2], this.values[3]); } else { this.vec3.set(this.values[0], this.values[1], this.values[2]); } } else if (t < this.keys[0]) { if (this.isRot) { this.quat1.set(this.originalValue.x, this.originalValue.y, this.originalValue.z, this.originalValue.w); this.quat2.set(this.values[0], this.values[1], this.values[2], this.values[3]); THREE.Quaternion.slerp(this.quat1, this.quat2, this.quat3, t / this.keys[0]); } else { this.vec3.set(this.originalValue.x, this.originalValue.y, this.originalValue.z); this.vec2.set(this.values[0], this.values[1], this.values[2]); this.vec3.lerp(this.vec2, t / this.keys[0]); } } else if (t >= this.keys[this.count - 1]) { if (this.isRot) { this.quat3.set(this.values[(this.count - 1) * 4], this.values[(this.count - 1) * 4 + 1], this.values[(this.count - 1) * 4 + 2], this.values[(this.count - 1) * 4 + 3]); } else { this.vec3.set(this.values[(this.count - 1) * 3], this.values[(this.count - 1) * 3 + 1], this.values[(this.count - 1) * 3 + 2]); } } else { for (i = 0; i < this.count - 1; i++) { var key1 = this.keys[i]; var key2 = this.keys[i + 1]; if (t >= key1 && t <= key2) { if (this.isRot) { this.quat1.set(this.values[i * 4], this.values[i * 4 + 1], this.values[i * 4 + 2], this.values[i * 4 + 3]); this.quat2.set(this.values[(i + 1) * 4], this.values[(i + 1) * 4 + 1], this.values[(i + 1) * 4 + 2], this.values[(i + 1) * 4 + 3]); THREE.Quaternion.slerp(this.quat1, this.quat2, this.quat3, (t - key1) / (key2 - key1)); } else { this.vec3.set(this.values[i * 3], this.values[i * 3 + 1], this.values[i * 3 + 2]); this.vec2.set(this.values[(i + 1) * 3], this.values[(i + 1) * 3 + 1], this.values[(i + 1) * 3 + 2]); this.vec3.lerp(this.vec2, (t - key1) / (key2 - key1)); } } } } if (this.target) { this.copyValue(this.target); } } THREE.glTFInterpolator.prototype.copyValue = function(target) { if (this.isRot) { target.copy(this.quat3); } else { target.copy(this.vec3); } } THREE.glTFAnimation.FORWARD_DIRECTION = 0; THREE.glTFAnimation.REVERSE_DIRECTION = 1; /** * @author alteredq / http://alteredqualia.com/ */ THREE.EffectComposer = function ( renderer, renderTarget ) { this.renderer = renderer; if ( renderTarget === undefined ) { var width = window.innerWidth || 1; var height = window.innerHeight || 1; if (renderer._renderer) { width = renderer._renderer.domElement.offsetWidth; // / renderer._renderer.devicePixelRatio; height = renderer._renderer.domElement.offsetHeight; // / renderer._renderer.devicePixelRatio; } else { width = renderer.domElement.offsetWidth; // / renderer.devicePixelRatio; height = renderer.domElement.offsetHeight; // / renderer.devicePixelRatio; } var parameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false }; renderTarget = new THREE.WebGLRenderTarget( width, height, parameters ); } this.renderTarget1 = renderTarget; this.renderTarget2 = renderTarget.clone(); this.writeBuffer = this.renderTarget1; this.readBuffer = this.renderTarget2; this.passes = []; if ( THREE.CopyShader === undefined ) console.error( "THREE.EffectComposer relies on THREE.CopyShader" ); this.copyPass = new THREE.ShaderPass( THREE.CopyShader ); }; THREE.EffectComposer.prototype = { swapBuffers: function() { var tmp = this.readBuffer; this.readBuffer = this.writeBuffer; this.writeBuffer = tmp; }, addPass: function ( pass ) { this.passes.push( pass ); }, insertPass: function ( pass, index ) { this.passes.splice( index, 0, pass ); }, render: function ( delta ) { this.writeBuffer = this.renderTarget1; this.readBuffer = this.renderTarget2; var maskActive = false; var pass, i, il = this.passes.length; for ( i = 0; i < il; i ++ ) { pass = this.passes[ i ]; if ( !pass.enabled ) continue; if (this.renderer instanceof THREE.VREffect) { if (pass instanceof THREE.RenderPass) { pass.render( this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive ); } else { pass.render( this.renderer._renderer, this.writeBuffer, this.readBuffer, delta, maskActive ); } } else { pass.render( this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive ); } if ( pass.needsSwap ) { if ( maskActive ) { var context = this.renderer.context; context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff ); this.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, delta ); context.stencilFunc( context.EQUAL, 1, 0xffffffff ); } this.swapBuffers(); } if ( pass instanceof THREE.MaskPass ) { maskActive = true; } else if ( pass instanceof THREE.ClearMaskPass ) { maskActive = false; } } }, reset: function ( renderTarget ) { if ( renderTarget === undefined ) { renderTarget = this.renderTarget1.clone(); renderTarget.width = window.innerWidth; renderTarget.height = window.innerHeight; } this.renderTarget1 = renderTarget; this.renderTarget2 = renderTarget.clone(); this.writeBuffer = this.renderTarget1; this.readBuffer = this.renderTarget2; }, setSize: function ( width, height ) { var renderTarget = this.renderTarget1.clone(); renderTarget.width = width; renderTarget.height = height; this.reset( renderTarget ); } }; /** * @author alteredq / http://alteredqualia.com/ */ THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount, grayscale ) { if ( THREE.FilmShader === undefined ) console.error( "THREE.FilmPass relies on THREE.FilmShader" ); var shader = THREE.FilmShader; this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); this.material = new THREE.ShaderMaterial( { uniforms: this.uniforms, vertexShader: shader.vertexShader, fragmentShader: shader.fragmentShader } ); if ( grayscale !== undefined ) this.uniforms.grayscale.value = grayscale; if ( noiseIntensity !== undefined ) this.uniforms.nIntensity.value = noiseIntensity; if ( scanlinesIntensity !== undefined ) this.uniforms.sIntensity.value = scanlinesIntensity; if ( scanlinesCount !== undefined ) this.uniforms.sCount.value = scanlinesCount; this.enabled = true; this.renderToScreen = false; this.needsSwap = true; this.camera = new THREE.OrthographicCamera( -1, 1, 1, -1, 0, 1 ); this.scene = new THREE.Scene(); this.quad = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), null ); this.scene.add( this.quad ); }; THREE.FilmPass.prototype = { render: function ( renderer, writeBuffer, readBuffer, delta ) { this.uniforms[ "tDiffuse" ].value = readBuffer; this.uniforms[ "time" ].value += delta; this.quad.material = this.material; if ( this.renderToScreen ) { renderer.render( this.scene, this.camera ); } else { renderer.render( this.scene, this.camera, writeBuffer, false ); } } }; /** * @author alteredq / http://alteredqualia.com/ */ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) { strength = ( strength !== undefined ) ? strength : 1; kernelSize = ( kernelSize !== undefined ) ? kernelSize : 25; sigma = ( sigma !== undefined ) ? sigma : 4.0; resolution = ( resolution !== undefined ) ? resolution : 256; // render targets var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat }; this.renderTargetX = new THREE.WebGLRenderTarget( resolution, resolution, pars ); this.renderTargetY = new THREE.WebGLRenderTarget( resolution, resolution, pars ); // copy material if ( THREE.CopyShader === undefined ) console.error( "THREE.BloomPass relies on THREE.CopyShader" ); var copyShader = THREE.CopyShader; this.copyUniforms = THREE.UniformsUtils.clone( copyShader.uniforms ); this.copyUniforms[ "opacity" ].value = strength; this.materialCopy = new THREE.ShaderMaterial( { uniforms: this.copyUniforms, vertexShader: copyShader.vertexShader, fragmentShader: copyShader.fragmentShader, blending: THREE.AdditiveBlending, transparent: true } ); // convolution material if ( THREE.ConvolutionShader === undefined ) console.error( "THREE.BloomPass relies on THREE.ConvolutionShader" ); var convolutionShader = THREE.ConvolutionShader; this.convolutionUniforms = THREE.UniformsUtils.clone( convolutionShader.uniforms ); this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurx; this.convolutionUniforms[ "cKernel" ].value = THREE.ConvolutionShader.buildKernel( sigma ); this.materialConvolution = new THREE.ShaderMaterial( { uniforms: this.convolutionUniforms, vertexShader: convolutionShader.vertexShader, fragmentShader: convolutionShader.fragmentShader, defines: { "KERNEL_SIZE_FLOAT": kernelSize.toFixed( 1 ), "KERNEL_SIZE_INT": kernelSize.toFixed( 0 ) } } ); this.enabled = true; this.needsSwap = false; this.clear = false; this.camera = new THREE.OrthographicCamera( -1, 1, 1, -1, 0, 1 ); this.scene = new THREE.Scene(); this.quad = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), null ); this.scene.add( this.quad ); }; THREE.BloomPass.prototype = { render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { if ( maskActive ) renderer.context.disable( renderer.context.STENCIL_TEST ); // Render quad with blured scene into texture (convolution pass 1) this.quad.material = this.materialConvolution; this.convolutionUniforms[ "tDiffuse" ].value = readBuffer; this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurX; renderer.render( this.scene, this.camera, this.renderTargetX, true ); // Render quad with blured scene into texture (convolution pass 2) this.convolutionUniforms[ "tDiffuse" ].value = this.renderTargetX; this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurY; renderer.render( this.scene, this.camera, this.renderTargetY, true ); // Render original scene with superimposed blur to texture this.quad.material = this.materialCopy; this.copyUniforms[ "tDiffuse" ].value = this.renderTargetY; if ( maskActive ) renderer.context.enable( renderer.context.STENCIL_TEST ); renderer.render( this.scene, this.camera, readBuffer, this.clear ); } }; THREE.BloomPass.blurX = new THREE.Vector2( 0.001953125, 0.0 ); THREE.BloomPass.blurY = new THREE.Vector2( 0.0, 0.001953125 ); /** * @author alteredq / http://alteredqualia.com/ */ THREE.MaskPass = function ( scene, camera ) { this.scene = scene; this.camera = camera; this.enabled = true; this.clear = true; this.needsSwap = false; this.inverse = false; }; THREE.MaskPass.prototype = { render: function ( renderer, writeBuffer, readBuffer, delta ) { var context = renderer.context; // don't update color or depth context.colorMask( false, false, false, false ); context.depthMask( false ); // set up stencil var writeValue, clearValue; if ( this.inverse ) { writeValue = 0; clearValue = 1; } else { writeValue = 1; clearValue = 0; } context.enable( context.STENCIL_TEST ); context.stencilOp( context.REPLACE, context.REPLACE, context.REPLACE ); context.stencilFunc( context.ALWAYS, writeValue, 0xffffffff ); context.clearStencil( clearValue ); // draw into the stencil buffer renderer.render( this.scene, this.camera, readBuffer, this.clear ); renderer.render( this.scene, this.camera, writeBuffer, this.clear ); // re-enable update of color and depth context.colorMask( true, true, true, true ); context.depthMask( true ); // only render where stencil is set to 1 context.stencilFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1 context.stencilOp( context.KEEP, context.KEEP, context.KEEP ); } }; THREE.ClearMaskPass = function () { this.enabled = true; }; THREE.ClearMaskPass.prototype = { render: function ( renderer, writeBuffer, readBuffer, delta ) { var context = renderer.context; context.disable( context.STENCIL_TEST ); } }; /** * @author alteredq / http://alteredqualia.com/ */ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) { this.scene = scene; this.camera = camera; this.overrideMaterial = overrideMaterial; this.clearColor = clearColor; this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1; this.oldClearColor = new THREE.Color(); this.oldClearAlpha = 1; this.enabled = true; this.clear = true; this.needsSwap = false; }; THREE.RenderPass.prototype = { render: function ( renderer, writeBuffer, readBuffer, delta ) { this.scene.overrideMaterial = this.overrideMaterial; if ( this.clearColor ) { this.oldClearColor.copy( renderer.getClearColor() ); this.oldClearAlpha = renderer.getClearAlpha(); renderer.setClearColor( this.clearColor, this.clearAlpha ); } renderer.render( this.scene, this.camera, readBuffer, this.clear ); if ( this.clearColor ) { renderer.setClearColor( this.oldClearColor, this.oldClearAlpha ); } this.scene.overrideMaterial = null; } }; /** * @author alteredq / http://alteredqualia.com/ */ THREE.ShaderPass = function ( shader, textureID ) { this.textureID = ( textureID !== undefined ) ? textureID : "tDiffuse"; this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); this.material = new THREE.ShaderMaterial( { uniforms: this.uniforms, vertexShader: shader.vertexShader, fragmentShader: shader.fragmentShader } ); this.renderToScreen = false; this.enabled = true; this.needsSwap = true; this.clear = false; this.camera = new THREE.OrthographicCamera( -1, 1, 1, -1, 0, 1 ); this.scene = new THREE.Scene(); this.quad = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), null ); this.scene.add( this.quad ); }; THREE.ShaderPass.prototype = { render: function ( renderer, writeBuffer, readBuffer, delta ) { if ( this.uniforms[ this.textureID ] ) { this.uniforms[ this.textureID ].value = readBuffer; } this.quad.material = this.material; if ( this.renderToScreen ) { renderer.render( this.scene, this.camera ); } else { renderer.render( this.scene, this.camera, writeBuffer, this.clear ); } } }; /** * @author alteredq / http://alteredqualia.com/ * @authod mrdoob / http://mrdoob.com/ * @authod arodic / http://aleksandarrodic.com/ */ /* * Adapted for Vizi * @authod tparisi / http://tonyparisi.com/ */ THREE.StereoEffect = function ( renderer ) { // API this.separation = 0.0635 / 2; // internals var _width, _height; var _position = new THREE.Vector3(); var _quaternion = new THREE.Quaternion(); var _scale = new THREE.Vector3(); var _cameraL = new THREE.PerspectiveCamera(); var _cameraR = new THREE.PerspectiveCamera(); // initialization renderer.autoClear = false; this.setSize = function ( width, height ) { _width = width / 2; _height = height; renderer.setSize( width, height ); }; this.render = function ( scene, camera ) { var scenes, cameras; if (scene instanceof Array) { scenes = scene; } else { scenes = [ scene ]; } if (camera instanceof Array) { cameras = camera; } else { cameras = [ camera ]; } var i, len = scenes.length; for (i = 0; i < len; i++) { var scene = scenes[i]; var camera = cameras[i]; scene.updateMatrixWorld(); if ( camera.parent === undefined ) camera.updateMatrixWorld(); camera.matrixWorld.decompose( _position, _quaternion, _scale ); if (i == 0) { renderer.setClearColor( 0, 0 ); renderer.autoClearColor = true; } else { renderer.setClearColor( 0, 1 ); renderer.autoClearColor = false; } // left _cameraL.fov = camera.fov; _cameraL.aspect = 0.5 * camera.aspect; _cameraL.near = camera.near; _cameraL.far = camera.far; _cameraL.updateProjectionMatrix(); _cameraL.position.copy( _position ); _cameraL.quaternion.copy( _quaternion ); _cameraL.translateX( - this.separation ); _cameraL.updateMatrixWorld(); // right _cameraR.near = camera.near; _cameraR.far = camera.far; _cameraR.projectionMatrix = _cameraL.projectionMatrix; _cameraR.position.copy( _position ); _cameraR.quaternion.copy( _quaternion ); _cameraR.translateX( this.separation ); _cameraR.updateMatrixWorld(); // renderer.setViewport( 0, 0, _width * 2, _height ); // renderer.clear(); renderer.setViewport( 0, 0, _width, _height ); renderer.render( scene, _cameraL ); renderer.setViewport( _width, 0, _width, _height ); renderer.render( scene, _cameraR ); } }; }; /** * @author dmarcos / https://github.com/dmarcos * * It handles stereo rendering * If mozGetVRDevices and getVRDevices APIs are not available it gracefuly falls back to a * regular renderer * * The HMD supported is the Oculus DK1 and The Web API doesn't currently allow * to query for the display resolution (only the chrome API allows it). * The dimensions of the screen are temporarly hardcoded (1280 x 800). * * For VR mode to work it has to be used with the Oculus enabled builds of Firefox or Chrome: * * Firefox: * * OSX: http://people.mozilla.com/~vladimir/vr/firefox-33.0a1.en-US.mac.dmg * WIN: http://people.mozilla.com/~vladimir/vr/firefox-33.0a1.en-US.win64-x86_64.zip * * Chrome builds: * * https://drive.google.com/folderview?id=0BzudLt22BqGRbW9WTHMtOWMzNjQ&usp=sharing#list * */ THREE.VREffect = function ( renderer, done ) { this.FULLSCREEN_WIDTH = 1280; this.FULLSCREEN_HEIGHT = 800; this._renderer = renderer; this._init = function() { var self = this; if ( !navigator.mozGetVRDevices && !navigator.getVRDevices ) { if ( done ) { done("Your browser is not VR Ready"); } return; } if ( navigator.getVRDevices ) { navigator.getVRDevices().then( gotVRDevices ); } else { navigator.mozGetVRDevices( gotVRDevices ); } function gotVRDevices( devices ) { var vrHMD; var error; for ( var i = 0; i < devices.length; ++i ) { if ( devices[i] instanceof HMDVRDevice ) { vrHMD = devices[i]; self._vrHMD = vrHMD; self.leftEyeTranslation = vrHMD.getEyeTranslation( "left" ); self.rightEyeTranslation = vrHMD.getEyeTranslation( "right" ); self.leftEyeFOV = vrHMD.getRecommendedEyeFieldOfView( "left" ); self.rightEyeFOV = vrHMD.getRecommendedEyeFieldOfView( "right" ); self.leftEyeMatrix = (new THREE.Matrix4()).makeTranslation(self.leftEyeTranslation.x, self.leftEyeTranslation.y, self.leftEyeTranslation.z); self.rightEyeMatrix = (new THREE.Matrix4()).makeTranslation(self.rightEyeTranslation.x, self.rightEyeTranslation.y, self.rightEyeTranslation.z); var geom = new THREE.BoxGeometry; var material = new THREE.MeshBasicMaterial({color:0x0000ff}); self.cube = new THREE.Mesh(geom, material); self.dummyScene = new THREE.Scene; self.dummyScene.add(self.cube); break; // We keep the first we encounter } } if ( done ) { if ( !vrHMD ) { error = 'HMD not available'; } done( error ); } } }; this._init(); this.render = function ( scene, camera ) { var renderer = this._renderer; var vrHMD = this._vrHMD; renderer.enableScissorTest( false ); // VR render mode if HMD is available if ( vrHMD ) { this.renderStereo.apply( this, arguments ); return; } // Regular render mode if not HMD renderer.render.apply( this._renderer , arguments ); }; this.renderStereo = function( scene, camera, renderTarget, forceClear ) { var cameraLeft; var cameraRight; var leftEyeTranslation = this.leftEyeTranslation; var rightEyeTranslation = this.rightEyeTranslation; var renderer = this._renderer; var rendererWidth = renderer.domElement.width / renderer.devicePixelRatio; var rendererHeight = renderer.domElement.height / renderer.devicePixelRatio; var eyeDivisionLine = rendererWidth / 2; var scenes, cameras; if (scene instanceof Array) { scenes = scene; } else { scenes = [ scene ]; } if (camera instanceof Array) { cameras = camera; } else { cameras = [ camera ]; } var i, len = scenes.length; for (i = 0; i < len; i++) { var scene = scenes[i]; var camera = cameras[i]; if (i == 0) { renderer.setClearColor( 0, 0 ); renderer.autoClearColor = true; } else { renderer.setClearColor( 0, 1 ); renderer.autoClearColor = false; } scene.updateMatrix(); scene.updateMatrixWorld(); if (camera.matrixAutoUpdate) { camera.updateMatrix(); camera.updateMatrixWorld(); } cameraLeft = camera.clone(); cameraRight = camera.clone(); cameraLeft.matrixAutoUpdate = false; cameraRight.matrixAutoUpdate = false; cameraLeft.projectionMatrix = this.FovToProjection( this.leftEyeFOV ); cameraRight.projectionMatrix = this.FovToProjection( this.rightEyeFOV ); cameraLeft.matrixWorld.multiply(this.leftEyeMatrix); cameraRight.matrixWorld.multiply(this.rightEyeMatrix); // render something to scene HACK otherwise viewport isn't getting set? renderer.setViewport( 0, 0, rendererWidth, rendererHeight ); renderer.setScissor( 0, 0, rendererHeight, rendererHeight ); renderer.render(this.dummyScene, camera, renderTarget, forceClear ); // Initial clear renderer.enableScissorTest( true ); // render left eye renderer.setViewport( 0, 0, eyeDivisionLine, rendererHeight ); renderer.setScissor( 0, 0, eyeDivisionLine, rendererHeight ); // renderer.clear(); renderer.render( scene, cameraLeft, renderTarget, forceClear ); // render right eye renderer.enableScissorTest( true ); renderer.setViewport( eyeDivisionLine, 0, eyeDivisionLine, rendererHeight ); renderer.setScissor( eyeDivisionLine, 0, eyeDivisionLine, rendererHeight ); // renderer.clear(); renderer.render( scene, cameraRight, renderTarget, forceClear ); renderer.enableScissorTest( false ); renderer.setViewport( 0, 0, rendererWidth, rendererHeight ); renderer.setScissor( 0, 0, rendererWidth, rendererHeight ); } }; this.setFullScreen = function( enable ) { var renderer = this._renderer; var vrHMD = this._vrHMD; var canvasOriginalSize = this._canvasOriginalSize; if (!vrHMD) { return; } // If state doesn't change we do nothing if ( enable === this._fullScreen ) { return; } this._fullScreen = !!enable; // VR Mode disabled if ( !enable ) { // Restores canvas original size renderer.setSize( canvasOriginalSize.width, canvasOriginalSize.height ); return; } // VR Mode enabled this._canvasOriginalSize = { width: renderer.domElement.width, height: renderer.domElement.height }; // Hardcoded Rift display size renderer.setSize( this.FULLSCREEN_WIDTH, this.FULLSCREEN_HEIGHT, false ); this.startFullscreen(); }; this.startFullscreen = function() { var self = this; var renderer = this._renderer; var vrHMD = this._vrHMD; var canvas = renderer.domElement; var fullScreenChange = canvas.mozRequestFullScreen? 'mozfullscreenchange' : 'webkitfullscreenchange'; document.addEventListener( fullScreenChange, onFullScreenChanged, false ); function onFullScreenChanged() { if ( !document.mozFullScreenElement && !document.webkitFullScreenElement ) { self.setFullScreen( false ); } } if ( canvas.mozRequestFullScreen ) { canvas.mozRequestFullScreen( { vrDisplay: vrHMD } ); } else { canvas.webkitRequestFullscreen( { vrDisplay: vrHMD } ); } }; this.FovToNDCScaleOffset = function( fov ) { var pxscale = 2.0 / (fov.leftTan + fov.rightTan); var pxoffset = (fov.leftTan - fov.rightTan) * pxscale * 0.5; var pyscale = 2.0 / (fov.upTan + fov.downTan); var pyoffset = (fov.upTan - fov.downTan) * pyscale * 0.5; return { scale: [pxscale, pyscale], offset: [pxoffset, pyoffset] }; }; this.FovPortToProjection = function( fov, rightHanded /* = true */, zNear /* = 0.01 */, zFar /* = 10000.0 */ ) { rightHanded = rightHanded === undefined ? true : rightHanded; zNear = zNear === undefined ? 0.01 : zNear; zFar = zFar === undefined ? 100000.0 : zFar; var handednessScale = rightHanded ? -1.0 : 1.0; // start with an identity matrix var mobj = new THREE.Matrix4(); var m = mobj.elements; // and with scale/offset info for normalized device coords var scaleAndOffset = this.FovToNDCScaleOffset(fov); // X result, map clip edges to [-w,+w] m[0*4+0] = scaleAndOffset.scale[0]; m[0*4+1] = 0.0; m[0*4+2] = scaleAndOffset.offset[0] * handednessScale; m[0*4+3] = 0.0; // Y result, map clip edges to [-w,+w] // Y offset is negated because this proj matrix transforms from world coords with Y=up, // but the NDC scaling has Y=down (thanks D3D?) m[1*4+0] = 0.0; m[1*4+1] = scaleAndOffset.scale[1]; m[1*4+2] = -scaleAndOffset.offset[1] * handednessScale; m[1*4+3] = 0.0; // Z result (up to the app) m[2*4+0] = 0.0; m[2*4+1] = 0.0; m[2*4+2] = zFar / (zNear - zFar) * -handednessScale; m[2*4+3] = (zFar * zNear) / (zNear - zFar); // W result (= Z in) m[3*4+0] = 0.0; m[3*4+1] = 0.0; m[3*4+2] = handednessScale; m[3*4+3] = 0.0; mobj.transpose(); return mobj; }; this.FovToProjection = function( fov, rightHanded /* = true */, zNear /* = 0.01 */, zFar /* = 10000.0 */ ) { var fovPort = { upTan: Math.tan(fov.upDegrees * Math.PI / 180.0), downTan: Math.tan(fov.downDegrees * Math.PI / 180.0), leftTan: Math.tan(fov.leftDegrees * Math.PI / 180.0), rightTan: Math.tan(fov.rightDegrees * Math.PI / 180.0) }; return this.FovPortToProjection(fovPort, rightHanded, zNear, zFar); }; };/** * @author alteredq / http://alteredqualia.com/ * * Convolution shader * ported from o3d sample to WebGL / GLSL * http://o3d.googlecode.com/svn/trunk/samples/convolution.html */ THREE.ConvolutionShader = { defines: { "KERNEL_SIZE_FLOAT": "25.0", "KERNEL_SIZE_INT": "25", }, uniforms: { "tDiffuse": { type: "t", value: null }, "uImageIncrement": { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) }, "cKernel": { type: "fv1", value: [] } }, vertexShader: [ "uniform vec2 uImageIncrement;", "varying vec2 vUv;", "void main() {", "vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join("\n"), fragmentShader: [ "uniform float cKernel[ KERNEL_SIZE_INT ];", "uniform sampler2D tDiffuse;", "uniform vec2 uImageIncrement;", "varying vec2 vUv;", "void main() {", "vec2 imageCoord = vUv;", "vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );", "for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {", "sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];", "imageCoord += uImageIncrement;", "}", "gl_FragColor = sum;", "}" ].join("\n"), buildKernel: function ( sigma ) { // We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway. function gauss( x, sigma ) { return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) ); } var i, values, sum, halfWidth, kMaxKernelSize = 25, kernelSize = 2 * Math.ceil( sigma * 3.0 ) + 1; if ( kernelSize > kMaxKernelSize ) kernelSize = kMaxKernelSize; halfWidth = ( kernelSize - 1 ) * 0.5; values = new Array( kernelSize ); sum = 0.0; for ( i = 0; i < kernelSize; ++i ) { values[ i ] = gauss( i - halfWidth, sigma ); sum += values[ i ]; } // normalize the kernel for ( i = 0; i < kernelSize; ++i ) values[ i ] /= sum; return values; } }; /** * @author alteredq / http://alteredqualia.com/ * * Full-screen textured quad shader */ THREE.CopyShader = { uniforms: { "tDiffuse": { type: "t", value: null }, "opacity": { type: "f", value: 1.0 } }, vertexShader: [ "varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join("\n"), fragmentShader: [ "uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = opacity * texel;", "}" ].join("\n") }; /** * @author alteredq / http://alteredqualia.com/ * * Dot screen shader * based on glfx.js sepia shader * https://github.com/evanw/glfx.js */ THREE.DotScreenShader = { uniforms: { "tDiffuse": { type: "t", value: null }, "tSize": { type: "v2", value: new THREE.Vector2( 256, 256 ) }, "center": { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) }, "angle": { type: "f", value: 1.57 }, "scale": { type: "f", value: 1.0 } }, vertexShader: [ "varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join("\n"), fragmentShader: [ "uniform vec2 center;", "uniform float angle;", "uniform float scale;", "uniform vec2 tSize;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "float pattern() {", "float s = sin( angle ), c = cos( angle );", "vec2 tex = vUv * tSize - center;", "vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;", "return ( sin( point.x ) * sin( point.y ) ) * 4.0;", "}", "void main() {", "vec4 color = texture2D( tDiffuse, vUv );", "float average = ( color.r + color.g + color.b ) / 3.0;", "gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );", "}" ].join("\n") }; /** * @author alteredq / http://alteredqualia.com/ * * Dot screen shader * based on glfx.js sepia shader * https://github.com/evanw/glfx.js */ THREE.DotScreenRGBShader = { uniforms: { "tDiffuse": { type: "t", value: null }, "tSize": { type: "v2", value: new THREE.Vector2( 256, 256 ) }, "center": { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) }, "angle": { type: "f", value: 1.57 }, "scale": { type: "f", value: 1.0 } }, vertexShader: [ "varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join("\n"), fragmentShader: [ "uniform vec2 center;", "uniform float angle;", "uniform float scale;", "uniform vec2 tSize;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "float pattern() {", "float s = sin( angle ), c = cos( angle );", "vec2 tex = vUv * tSize - center;", "vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;", "return ( sin( point.x ) * sin( point.y ) ) * 4.0;", "}", "void main() {", "vec4 color = texture2D( tDiffuse, vUv );", "float r = color.r * 10.0 - 5.0 + pattern();", "float g = color.g * 10.0 - 5.0 + pattern();", "float b = color.b * 10.0 - 5.0 + pattern();", "gl_FragColor = vec4( r, g, b, color.a );", "}" ].join("\n") }; /** * @author alteredq / http://alteredqualia.com/ * * Film grain & scanlines shader * * - ported from HLSL to WebGL / GLSL * http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html * * Screen Space Static Postprocessor * * Produces an analogue noise overlay similar to a film grain / TV static * * Original implementation and noise algorithm * Pat 'Hawthorne' Shearon * * Optimized scanlines + noise version with intensity scaling * Georg 'Leviathan' Steinrohder * * This version is provided under a Creative Commons Attribution 3.0 License * http://creativecommons.org/licenses/by/3.0/ */ THREE.FilmShader = { uniforms: { "tDiffuse": { type: "t", value: null }, "time": { type: "f", value: 0.0 }, "nIntensity": { type: "f", value: 0.5 }, "sIntensity": { type: "f", value: 0.05 }, "sCount": { type: "f", value: 4096 }, "grayscale": { type: "i", value: 1 } }, vertexShader: [ "varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join("\n"), fragmentShader: [ // control parameter "uniform float time;", "uniform bool grayscale;", // noise effect intensity value (0 = no effect, 1 = full effect) "uniform float nIntensity;", // scanlines effect intensity value (0 = no effect, 1 = full effect) "uniform float sIntensity;", // scanlines effect count value (0 = no effect, 4096 = full effect) "uniform float sCount;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", // sample the source "vec4 cTextureScreen = texture2D( tDiffuse, vUv );", // make some noise "float x = vUv.x * vUv.y * time * 1000.0;", "x = mod( x, 13.0 ) * mod( x, 123.0 );", "float dx = mod( x, 0.01 );", // add noise "vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );", // get us a sine and cosine "vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );", // add scanlines "cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;", // interpolate between source and result by intensity "cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );", // convert to grayscale if desired "if( grayscale ) {", "cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );", "}", "gl_FragColor = vec4( cResult, cTextureScreen.a );", "}" ].join("\n") }; /** * @author alteredq / http://alteredqualia.com/ * @author davidedc / http://www.sketchpatch.net/ * * NVIDIA FXAA by Timothy Lottes * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html * - WebGL port by @supereggbert * http://www.glge.org/demos/fxaa/ */ THREE.FXAAShader = { uniforms: { "tDiffuse": { type: "t", value: null }, "resolution": { type: "v2", value: new THREE.Vector2( 1 / 1024, 1 / 512 ) } }, vertexShader: [ "varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join("\n"), fragmentShader: [ "uniform sampler2D tDiffuse;", "uniform vec2 resolution;", "varying vec2 vUv;", "#define FXAA_REDUCE_MIN (1.0/128.0)", "#define FXAA_REDUCE_MUL (1.0/8.0)", "#define FXAA_SPAN_MAX 8.0", "void main() {", "vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;", "vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;", "vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;", "vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;", "vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );", "vec3 rgbM = rgbaM.xyz;", "vec3 luma = vec3( 0.299, 0.587, 0.114 );", "float lumaNW = dot( rgbNW, luma );", "float lumaNE = dot( rgbNE, luma );", "float lumaSW = dot( rgbSW, luma );", "float lumaSE = dot( rgbSE, luma );", "float lumaM = dot( rgbM, luma );", "float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );", "float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );", "vec2 dir;", "dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));", "dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));", "float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );", "float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );", "dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),", "max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),", "dir * rcpDirMin)) * resolution;", "vec4 rgbA = (1.0/2.0) * (", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));", "vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));", "float lumaB = dot(rgbB, vec4(luma, 0.0));", "if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {", "gl_FragColor = rgbA;", "} else {", "gl_FragColor = rgbB;", "}", "}" ].join("\n") }; /** * @author felixturner / http://airtight.cc/ * * RGB Shift Shader * Shifts red and blue channels from center in opposite directions * Ported from http://kriss.cx/tom/2009/05/rgb-shift/ * by Tom Butterworth / http://kriss.cx/tom/ * * amount: shift distance (1 is width of input) * angle: shift angle in radians */ THREE.RGBShiftShader = { uniforms: { "tDiffuse": { type: "t", value: null }, "amount": { type: "f", value: 0.005 }, "angle": { type: "f", value: 0.0 } }, vertexShader: [ "varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" ].join("\n"), fragmentShader: [ "uniform sampler2D tDiffuse;", "uniform float amount;", "uniform float angle;", "varying vec2 vUv;", "void main() {", "vec2 offset = amount * vec2( cos(angle), sin(angle));", "vec4 cr = texture2D(tDiffuse, vUv + offset);", "vec4 cga = texture2D(tDiffuse, vUv);", "vec4 cb = texture2D(tDiffuse, vUv - offset);", "gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);", "}" ].join("\n") }; // ShaderParticleGroup 0.5.0 // // (c) 2013 Luke Moody (http://www.github.com/squarefeet) & Lee Stemkoski (http://www.adelphi.edu/~stemkoski/) // Based on Lee Stemkoski's original work (https://github.com/stemkoski/stemkoski.github.com/blob/master/Three.js/js/ParticleEngine.js). // // ShaderParticleGroup may be freely distributed under the MIT license (See LICENSE.txt) function ShaderParticleGroup( options ) { var that = this; that.fixedTimeStep = parseFloat( options.fixedTimeStep || 0.016 ); // Uniform properties ( applied to all particles ) that.maxAge = parseFloat( options.maxAge || 3 ); that.texture = options.texture || null; that.hasPerspective = parseInt( typeof options.hasPerspective === 'number' ? options.hasPerspective : 1, 10 ); that.colorize = parseInt( options.colorize || 1, 10 ); // Material properties that.blending = typeof options.blending === 'number' ? options.blending : THREE.AdditiveBlending; that.transparent = options.transparent || true; that.alphaTest = options.alphaTest || 0.5; that.depthWrite = options.depthWrite || false; that.depthTest = options.depthTest || true; // Create uniforms that.uniforms = { duration: { type: 'f', value: that.maxAge }, texture: { type: 't', value: that.texture }, hasPerspective: { type: 'i', value: that.hasPerspective }, colorize: { type: 'i', value: that.colorize } }; // Create a map of attributes that will hold values for each particle in this group. that.attributes = { acceleration: { type: 'v3', value: [] }, velocity: { type: 'v3', value: [] }, alive: { type: 'f', value: [] }, age: { type: 'f', value: [] }, size: { type: 'f', value: [] }, sizeEnd: { type: 'f', value: [] }, customColor: { type: 'c', value: [] }, customColorEnd: { type: 'c', value: [] }, opacity: { type: 'f', value: [] }, opacityMiddle: { type: 'f', value: [] }, opacityEnd: { type: 'f', value: [] } }; // Emitters (that aren't static) will be added to this array for // processing during the `tick()` function. that.emitters = []; // Create properties for use by the emitter pooling functions. that._pool = []; that._poolCreationSettings = null; that._createNewWhenPoolEmpty = 0; that.maxAgeMilliseconds = that.maxAge * 1000; // Create an empty geometry to hold the particles. // Each particle is a vertex pushed into this geometry's // vertices array. that.geometry = new THREE.Geometry(); // Create the shader material using the properties we set above. that.material = new THREE.ShaderMaterial({ uniforms: that.uniforms, attributes: that.attributes, vertexShader: ShaderParticleGroup.shaders.vertex, fragmentShader: ShaderParticleGroup.shaders.fragment, blending: that.blending, transparent: that.transparent, alphaTest: that.alphaTest, depthWrite: that.depthWrite, depthTest: that.depthTest }); // And finally create the ParticleSystem. It's got its `dynamic` property // set so that THREE.js knows to update it on each frame. that.mesh = new THREE.PointCloud( that.geometry, that.material ); that.mesh.sortParticles = true; that.mesh.dynamic = true; } ShaderParticleGroup.prototype = { /** * Given a base vector and a spread range vector, create * a new THREE.Vector3 instance with randomised values. * * @private * * @param {THREE.Vector3} base * @param {THREE.Vector3} spread * @return {THREE.Vector3} */ _randomVector3: function( base, spread ) { var v = new THREE.Vector3(); v.copy( base ); v.x += Math.random() * spread.x - (spread.x/2); v.y += Math.random() * spread.y - (spread.y/2); v.z += Math.random() * spread.z - (spread.z/2); return v; }, /** * Create a new THREE.Color instance and given a base vector and * spread range vector, assign random values. * * Note that THREE.Color RGB values are in the range of 0 - 1, not 0 - 255. * * @private * * @param {THREE.Vector3} base * @param {THREE.Vector3} spread * @return {THREE.Color} */ _randomColor: function( base, spread ) { var v = new THREE.Color(); v.copy( base ); v.r += (Math.random() * spread.x) - (spread.x/2); v.g += (Math.random() * spread.y) - (spread.y/2); v.b += (Math.random() * spread.z) - (spread.z/2); v.r = Math.max( 0, Math.min( v.r, 1 ) ); v.g = Math.max( 0, Math.min( v.g, 1 ) ); v.b = Math.max( 0, Math.min( v.b, 1 ) ); return v; }, /** * Create a random Number value based on an initial value and * a spread range * * @private * * @param {Number} base * @param {Number} spread * @return {Number} */ _randomFloat: function( base, spread ) { return base + spread * (Math.random() - 0.5); }, /** * Create a new THREE.Vector3 instance and project it onto a random point * on a sphere with radius `radius`. * * @param {THREE.Vector3} base * @param {Number} radius * @param {THREE.Vector3} scale * * @private * * @return {THREE.Vector3} */ _randomVector3OnSphere: function( base, radius, scale ) { var z = 2 * Math.random() - 1; var t = 6.2832 * Math.random(); var r = Math.sqrt( 1 - z*z ); var vec = new THREE.Vector3( r * Math.cos(t), r * Math.sin(t), z ); vec.multiplyScalar( radius ); if( scale ) { vec.multiply( scale ); } vec.add( base ); return vec; }, /** * Create a new THREE.Vector3 instance, and given a base position, and various * other values, project it onto a random point on a sphere with radius `radius`. * * @param {THREE.Vector3} base * @param {THREE.Vector3} position * @param {Number} speed * @param {Number} speedSpread * @param {THREE.Vector3} scale * * @private * * @return {THREE.Vector3} */ _randomVelocityVector3OnSphere: function( base, position, speed, speedSpread, scale ) { var direction = new THREE.Vector3().subVectors( base, position ); direction.normalize().multiplyScalar( this._randomFloat( speed, speedSpread ) ); if( scale ) { direction.multiply( scale ); } return direction; }, /** * Given a base vector and a spread vector, randomise the given vector * accordingly. * * @param {THREE.Vector3} vector * @param {THREE.Vector3} base * @param {THREE.Vector3} spread * * @private * * @return {[type]} */ _randomizeExistingVector3: function( vector, base, spread ) { vector.set( Math.random() * base.x - spread.x, Math.random() * base.y - spread.y, Math.random() * base.z - spread.z ); }, /** * Tells the age and alive attributes (and the geometry vertices) * that they need updating by THREE.js's internal tick functions. * * @private * * @return {this} */ _flagUpdate: function() { var that = this; // Set flags to update (causes less garbage than // ```ParticleSystem.sortParticles = true``` in THREE.r58 at least) that.attributes.age.needsUpdate = true; that.attributes.alive.needsUpdate = true; that.geometry.verticesNeedUpdate = true; return that; }, /** * Add an emitter to this particle group. Once added, an emitter will be automatically * updated when ShaderParticleGroup#tick() is called. * * @param {ShaderParticleEmitter} emitter * @return {this} */ addEmitter: function( emitter ) { var that = this; if( emitter.duration ) { emitter.numParticles = emitter.particlesPerSecond * (that.maxAge < emitter.emitterDuration ? that.maxAge : emitter.emitterDuration) | 0; } else { emitter.numParticles = emitter.particlesPerSecond * that.maxAge | 0; } emitter.numParticles = Math.ceil(emitter.numParticles); var vertices = that.geometry.vertices, start = vertices.length, end = emitter.numParticles + start, a = that.attributes, acceleration = a.acceleration.value, velocity = a.velocity.value, alive = a.alive.value, age = a.age.value, size = a.size.value, sizeEnd = a.sizeEnd.value, customColor = a.customColor.value, customColorEnd = a.customColorEnd.value, opacity = a.opacity.value, opacityMiddle = a.opacityMiddle.value, opacityEnd = a.opacityEnd.value; emitter.particleIndex = parseFloat( start ); // Create the values for( var i = start; i < end; ++i ) { if( emitter.type === 'sphere' ) { vertices[i] = that._randomVector3OnSphere( emitter.position, emitter.radius, emitter.radiusScale ); velocity[i] = that._randomVelocityVector3OnSphere( vertices[i], emitter.position, emitter.speed, emitter.speedSpread, emitter.radiusScale, emitter.radius ); } else { vertices[i] = that._randomVector3( emitter.position, emitter.positionSpread ); velocity[i] = that._randomVector3( emitter.velocity, emitter.velocitySpread ); } acceleration[i] = that._randomVector3( emitter.acceleration, emitter.accelerationSpread ); // Fix for bug #1 (https://github.com/squarefeet/ShaderParticleEngine/issues/1) // For some stupid reason I was limiting the size value to a minimum of 0.1. Derp. size[i] = that._randomFloat( emitter.size, emitter.sizeSpread ); sizeEnd[i] = emitter.sizeEnd; age[i] = 0.0; alive[i] = emitter.static ? 1.0 : 0.0; customColor[i] = that._randomColor( emitter.colorStart, emitter.colorSpread ); customColorEnd[i] = emitter.colorEnd; opacity[i] = emitter.opacityStart; opacityMiddle[i] = emitter.opacityMiddle; opacityEnd[i] = emitter.opacityEnd; } // Cache properties on the emitter so we can access // them from its tick function. emitter.verticesIndex = parseFloat( start ); emitter.attributes = that.attributes; emitter.vertices = that.geometry.vertices; emitter.maxAge = that.maxAge; // Save this emitter in an array for processing during this.tick() if( !emitter.static ) { that.emitters.push( emitter ); } return that; }, /** * The main particle group update function. Call this once per frame. * * @param {Number} dt * @return {this} */ tick: function( dt ) { var that = this, emitters = that.emitters, numEmitters = emitters.length; dt = dt || that.fixedTimeStep; if( numEmitters === 0 ) return; for( var i = 0; i < numEmitters; ++i ) { emitters[i].tick( dt ); } that._flagUpdate(); return that; }, /** * Fetch a single emitter instance from the pool. * If there are no objects in the pool, a new emitter will be * created if specified. * * @return {ShaderParticleEmitter | null} */ getFromPool: function() { var that = this, pool = that._pool, createNew = that._createNewWhenPoolEmpty; if( pool.length ) { return pool.pop(); } else if( createNew ) { return new ShaderParticleEmitter( that._poolCreationSettings ); } return null; }, /** * Release an emitter into the pool. * * @param {ShaderParticleEmitter} emitter * @return {this} */ releaseIntoPool: function( emitter ) { if( !(emitter instanceof ShaderParticleEmitter) ) { console.error( 'Will not add non-emitter to particle group pool:', emitter ); return; } emitter.reset(); this._pool.unshift( emitter ); return this; }, /** * Get the pool array * * @return {Array} */ getPool: function() { return this._pool; }, /** * Add a pool of emitters to this particle group * * @param {Number} numEmitters The number of emitters to add to the pool. * @param {Object} emitterSettings An object describing the settings to pass to each emitter. * @param {Boolean} createNew Should a new emitter be created if the pool runs out? * @return {this} */ addPool: function( numEmitters, emitterSettings, createNew ) { var that = this, emitter; // Save relevant settings and flags. that._poolCreationSettings = emitterSettings; that._createNewWhenPoolEmpty = !!createNew; // Create the emitters, add them to this group and the pool. for( var i = 0; i < numEmitters; ++i ) { emitter = new ShaderParticleEmitter( emitterSettings ); that.addEmitter( emitter ); that.releaseIntoPool( emitter ); } return that; }, /** * Internal method. Sets a single emitter to be alive * * @private * * @param {THREE.Vector3} pos * @return {this} */ _triggerSingleEmitter: function( pos ) { var that = this, emitter = that.getFromPool(); if( emitter === null ) { console.log('ShaderParticleGroup pool ran out.'); return; } // TODO: Should an instanceof check happen here? Or maybe at least a typeof? if( pos ) { emitter.position.copy( pos ); } emitter.enable(); setTimeout( function() { emitter.disable(); that.releaseIntoPool( emitter ); }, that.maxAgeMilliseconds ); return that; }, /** * Set a given number of emitters as alive, with an optional position * vector3 to move them to. * * @param {Number} numEmitters * @param {THREE.Vector3} position * @return {this} */ triggerPoolEmitter: function( numEmitters, position ) { var that = this; if( typeof numEmitters === 'number' && numEmitters > 1) { for( var i = 0; i < numEmitters; ++i ) { that._triggerSingleEmitter( position ); } } else { that._triggerSingleEmitter( position ); } return that; } }; // The all-important shaders ShaderParticleGroup.shaders = { vertex: [ 'uniform float duration;', 'uniform int hasPerspective;', 'attribute vec3 customColor;', 'attribute vec3 customColorEnd;', 'attribute float opacity;', 'attribute float opacityMiddle;', 'attribute float opacityEnd;', 'attribute vec3 acceleration;', 'attribute vec3 velocity;', 'attribute float alive;', 'attribute float age;', 'attribute float size;', 'attribute float sizeEnd;', 'varying vec4 vColor;', // Linearly lerp a float 'float Lerp( float start, float end, float amount ) {', 'return (start + ((end - start) * amount));', '}', // Linearly lerp a vector3 'vec3 Lerp( vec3 start, vec3 end, float amount ) {', 'return (start + ((end - start) * amount));', '}', // Integrate acceleration into velocity and apply it to the particle's position 'vec4 GetPos() {', 'vec3 newPos = vec3( position );', // Move acceleration & velocity vectors to the value they // should be at the current age 'vec3 a = acceleration * age;', 'vec3 v = velocity * age;', // Move velocity vector to correct values at this age 'v = v + (a * age);', // Add velocity vector to the newPos vector 'newPos = newPos + v;', // Convert the newPos vector into world-space 'vec4 mvPosition = modelViewMatrix * vec4( newPos, 1.0 );', 'return mvPosition;', '}', 'void main() {', 'float positionInTime = (age / duration);', 'float halfDuration = (duration / 2.0);', 'if( alive > 0.5 ) {', // Integrate color "tween" 'vec3 color = vec3( customColor );', 'if( customColor != customColorEnd ) {', 'color = Lerp( customColor, customColorEnd, positionInTime );', '}', // Store the color of this particle in the varying vColor, // so frag shader can access it. 'if( opacity == opacityMiddle && opacityMiddle == opacityEnd ) {', 'vColor = vec4( color, opacity );', '}', 'else if( positionInTime < 0.5 ) {', 'vColor = vec4( color, Lerp( opacity, opacityMiddle, age / halfDuration ) );', '}', 'else if( positionInTime > 0.5 ) {', 'vColor = vec4( color, Lerp( opacityMiddle, opacityEnd, (age - halfDuration) / halfDuration ) );', '}', 'else {', 'vColor = vec4( color, opacityMiddle );', '}', // Get the position of this particle so we can use it // when we calculate any perspective that might be required. 'vec4 pos = GetPos();', // Determine point size . 'float pointSize = Lerp( size, sizeEnd, positionInTime );', 'if( hasPerspective == 1 ) {', 'pointSize = pointSize * ( 300.0 / length( pos.xyz ) );', '}', // Set particle size and position 'gl_PointSize = pointSize;', 'gl_Position = projectionMatrix * pos;', '}', 'else {', // Hide particle and set its position to the (maybe) glsl // equivalent of Number.POSITIVE_INFINITY 'vColor = vec4( customColor, 0.0 );', 'gl_Position = vec4(1e20, 1e20, 1e20, 0);', '}', '}', ].join('\n'), fragment: [ 'uniform sampler2D texture;', 'uniform int colorize;', 'varying vec4 vColor;', 'void main() {', 'float c = cos(0.0);', 'float s = sin(0.0);', 'vec2 rotatedUV = vec2(c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5,', 'c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5);', 'vec4 rotatedTexture = texture2D( texture, rotatedUV );', 'if( colorize == 1 ) {', 'gl_FragColor = vColor * rotatedTexture;', '}', 'else {', 'gl_FragColor = rotatedTexture;', '}', '}' ].join('\n') }; ; // ShaderParticleEmitter 0.5.0 // // (c) 2013 Luke Moody (http://www.github.com/squarefeet) & Lee Stemkoski (http://www.adelphi.edu/~stemkoski/) // Based on Lee Stemkoski's original work (https://github.com/stemkoski/stemkoski.github.com/blob/master/Three.js/js/ParticleEngine.js). // // ShaderParticleEmitter may be freely distributed under the MIT license (See LICENSE.txt) function ShaderParticleEmitter( options ) { // If no options are provided, fallback to an empty object. options = options || {}; // Helps with minification. Not as easy to read the following code, // but should still be readable enough! var that = this; that.particlesPerSecond = typeof options.particlesPerSecond === 'number' ? options.particlesPerSecond : 100; that.type = (options.type === 'cube' || options.type === 'sphere') ? options.type : 'cube'; that.position = options.position instanceof THREE.Vector3 ? options.position : new THREE.Vector3(); that.positionSpread = options.positionSpread instanceof THREE.Vector3 ? options.positionSpread : new THREE.Vector3(); // These two properties are only used when this.type === 'sphere' that.radius = typeof options.radius === 'number' ? options.radius : 10; that.radiusScale = options.radiusScale instanceof THREE.Vector3 ? options.radiusScale : new THREE.Vector3(1, 1, 1); that.acceleration = options.acceleration instanceof THREE.Vector3 ? options.acceleration : new THREE.Vector3(); that.accelerationSpread = options.accelerationSpread instanceof THREE.Vector3 ? options.accelerationSpread : new THREE.Vector3(); that.velocity = options.velocity instanceof THREE.Vector3 ? options.velocity : new THREE.Vector3(); that.velocitySpread = options.velocitySpread instanceof THREE.Vector3 ? options.velocitySpread : new THREE.Vector3(); // And again here; only used when this.type === 'sphere' that.speed = parseFloat( typeof options.speed === 'number' ? options.speed : 0 ); that.speedSpread = parseFloat( typeof options.speedSpread === 'number' ? options.speedSpread : 0 ); that.size = parseFloat( typeof options.size === 'number' ? options.size : 10.0 ); that.sizeSpread = parseFloat( typeof options.sizeSpread === 'number' ? options.sizeSpread : 0 ); that.sizeEnd = parseFloat( typeof options.sizeEnd === 'number' ? options.sizeEnd : 10.0 ); that.colorStart = options.colorStart instanceof THREE.Color ? options.colorStart : new THREE.Color( 'white' ); that.colorEnd = options.colorEnd instanceof THREE.Color ? options.colorEnd : new THREE.Color( 'blue' ); that.colorSpread = options.colorSpread instanceof THREE.Vector3 ? options.colorSpread : new THREE.Vector3(); that.opacityStart = parseFloat( typeof options.opacityStart !== 'undefined' ? options.opacityStart : 1 ); that.opacityEnd = parseFloat( typeof options.opacityEnd === 'number' ? options.opacityEnd : 0 ); that.opacityMiddle = parseFloat( typeof options.opacityMiddle !== 'undefined' ? options.opacityMiddle : Math.abs(that.opacityEnd + that.opacityStart) / 2 ); that.emitterDuration = typeof options.emitterDuration === 'number' ? options.emitterDuration : null; that.alive = parseInt( typeof options.alive === 'number' ? options.alive : 1, 10); that.static = typeof options.static === 'number' ? options.static : 0; // The following properties are used internally, and mostly set when this emitter // is added to a particle group. that.numParticles = 0; that.attributes = null; that.vertices = null; that.verticesIndex = 0; that.age = 0.0; that.maxAge = 0.0; that.particleIndex = 0.0; that.userData = {}; } ShaderParticleEmitter.prototype = { /** * Reset a particle's position. Accounts for emitter type and spreads. * * @private * * @param {THREE.Vector3} p */ _resetParticle: function( p ) { var that = this, spread = that.positionSpread, type = that.type; // Optimise for no position spread or radius if( ( type === 'cube' && spread.x === 0 && spread.y === 0 && spread.z === 0 ) || ( type === 'sphere' && that.radius === 0 ) ) { p.copy( that.position ); } // If there is a position spread, then get a new position based on this spread. else if( type === 'cube' ) { that._randomizeExistingVector3( p, that.position, spread ); } else if( type === 'sphere') { that._randomizeExistingVector3OnSphere( p, that.position, that.radius ); } }, /** * Given an existing particle vector, randomise it based on base and spread vectors * * @private * * @param {THREE.Vector3} v * @param {THREE.Vector3} base * @param {THREE.Vector3} spread */ _randomizeExistingVector3: function( v, base, spread ) { var r = Math.random; v.copy( base ); v.x += r() * spread.x - (spread.x/2); v.y += r() * spread.y - (spread.y/2); v.z += r() * spread.z - (spread.z/2); }, /** * Given an existing particle vector, project it onto a random point on a * sphere with radius `radius` and position `base`. * * @private * * @param {THREE.Vector3} v * @param {THREE.Vector3} base * @param {Number} radius */ _randomizeExistingVector3OnSphere: function( v, base, radius ) { var rand = Math.random; var z = 2 * rand() - 1; var t = 6.2832 * rand(); var r = Math.sqrt( 1 - z*z ); var x = ((r * Math.cos(t)) * radius); var y = ((r * Math.sin(t)) * radius); z *= radius; v.set(x, y, z).multiply( this.radiusScale ); v.add( base ); }, // This function is called by the instance of `ShaderParticleEmitter` that // this emitter has been added to. /** * Update this emitter's particle's positions. Called by the ShaderParticleGroup * that this emitter belongs to. * * @param {Number} dt */ tick: function( dt ) { if( this.static ) { return; } // Cache some values for quicker access in loops. var that = this, a = that.attributes, alive = a.alive.value, age = a.age.value, start = that.verticesIndex, numParticles = that.numParticles, end = start + numParticles, pps = that.particlesPerSecond, ppsdt = pps * dt, m = that.maxAge, emitterAge = that.age, duration = that.emitterDuration, pIndex = that.particleIndex; // Loop through all the particles in this emitter and // determine whether they're still alive and need advancing // or if they should be dead and therefore marked as such // and pushed into the recycled vertices array for reuse. for( var i = start; i < end; ++i ) { if( alive[ i ] === 1.0 ) { age[ i ] += dt; } if( age[ i ] >= m ) { age[ i ] = 0.0; alive[ i ] = 0.0; } } // If the emitter is dead, reset any particles that are in // the recycled vertices array and reset the age of the // emitter to zero ready to go again if required, then // exit this function. if( that.alive === 0 ) { that.age = 0.0; return; } // If the emitter has a specified lifetime and we've exceeded it, // mark the emitter as dead and exit this function. if( typeof duration === 'number' && emitterAge > duration ) { that.alive = 0; that.age = 0.0; return; } var n = Math.min( end, pIndex + ppsdt ); for( i = pIndex | 0; i < n; ++i ) { if( alive[ i ] !== 1.0 ) { alive[ i ] = 1.0; that._resetParticle( that.vertices[ i ] ); } } that.particleIndex += ppsdt; if( pIndex >= start + that.numParticles ) { that.particleIndex = parseFloat( start, 10 ); } // Add the delta time value to the age of the emitter. that.age += dt; }, /** * Reset this emitter back to its starting position. * If `force` is truthy, then reset all particles in this * emitter as well, even if they're currently alive. * * @param {Boolean} force * @return {this} */ reset: function( force ) { var that = this; that.age = 0.0; that.alive = 0; if( force ) { var start = that.verticesIndex, end = that.verticesIndex + that.numParticles, a = that.attributes, alive = a.alive.value, age = a.age.value; for( var i = start; i < end; ++i ) { alive[ i ] = 0.0; age[ i ] = 0.0; } } return that; }, /** * Enable this emitter. */ enable: function() { this.alive = 1; }, /** * Disable this emitter. */ disable: function() { this.alive = 0; } };// tween.js - http://github.com/sole/tween.js 'use strict';var TWEEN=TWEEN||function(){var a=[];return{REVISION:"10",getAll:function(){return a},removeAll:function(){a=[]},add:function(c){a.push(c)},remove:function(c){c=a.indexOf(c);-1!==c&&a.splice(c,1)},update:function(c){if(0===a.length)return!1;for(var b=0,d=a.length,c=void 0!==c?c:void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();b(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return 1>(a*=2)?0.5*a*a*a:0.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return 1>(a*=2)?0.5*a*a*a*a:-0.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a* a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return 1>(a*=2)?0.5*a*a*a*a*a:0.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return 0.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0===a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:1>(a*=2)?0.5*Math.pow(1024,a-1):0.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1- Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return 1>(a*=2)?-0.5*(Math.sqrt(1-a*a)-1):0.5*(Math.sqrt(1-(a-=2)*a)+1)}},Elastic:{In:function(a){var c,b=0.1;if(0===a)return 0;if(1===a)return 1;!b||1>b?(b=1,c=0.1):c=0.4*Math.asin(1/b)/(2*Math.PI);return-(b*Math.pow(2,10*(a-=1))*Math.sin((a-c)*2*Math.PI/0.4))},Out:function(a){var c,b=0.1;if(0===a)return 0;if(1===a)return 1;!b||1>b?(b=1,c=0.1):c=0.4*Math.asin(1/b)/(2*Math.PI);return b*Math.pow(2,-10*a)*Math.sin((a-c)* 2*Math.PI/0.4)+1},InOut:function(a){var c,b=0.1;if(0===a)return 0;if(1===a)return 1;!b||1>b?(b=1,c=0.1):c=0.4*Math.asin(1/b)/(2*Math.PI);return 1>(a*=2)?-0.5*b*Math.pow(2,10*(a-=1))*Math.sin((a-c)*2*Math.PI/0.4):0.5*b*Math.pow(2,-10*(a-=1))*Math.sin((a-c)*2*Math.PI/0.4)+1}},Back:{In:function(a){return a*a*(2.70158*a-1.70158)},Out:function(a){return--a*a*(2.70158*a+1.70158)+1},InOut:function(a){return 1>(a*=2)?0.5*a*a*(3.5949095*a-2.5949095):0.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)}},Bounce:{In:function(a){return 1- TWEEN.Easing.Bounce.Out(1-a)},Out:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375},InOut:function(a){return 0.5>a?0.5*TWEEN.Easing.Bounce.In(2*a):0.5*TWEEN.Easing.Bounce.Out(2*a-1)+0.5}}}; TWEEN.Interpolation={Linear:function(a,c){var b=a.length-1,d=b*c,e=Math.floor(d),g=TWEEN.Interpolation.Utils.Linear;return 0>c?g(a[0],a[1],d):1b?b:e+1],d-e)},Bezier:function(a,c){var b=0,d=a.length-1,e=Math.pow,g=TWEEN.Interpolation.Utils.Bernstein,i;for(i=0;i<=d;i++)b+=e(1-c,d-i)*e(c,i)*a[i]*g(d,i);return b},CatmullRom:function(a,c){var b=a.length-1,d=b*c,e=Math.floor(d),g=TWEEN.Interpolation.Utils.CatmullRom;return a[0]===a[b]?(0>c&&(e=Math.floor(d=b*(1+c))),g(a[(e- 1+b)%b],a[e],a[(e+1)%b],a[(e+2)%b],d-e)):0>c?a[0]-(g(a[0],a[0],a[1],a[1],-d)-a[0]):1":{"x_min":36.109375,"x_max":792,"ha":828,"o":"m 792 352 l 36 17 l 36 168 l 594 420 l 36 672 l 36 823 l 792 487 l 792 352 "},"v":{"x_min":0,"x_max":740.28125,"ha":828,"o":"m 740 749 l 473 0 l 266 0 l 0 749 l 222 749 l 373 211 l 529 749 l 740 749 "},"τ":{"x_min":0.28125,"x_max":618.734375,"ha":699,"o":"m 618 593 l 409 593 l 409 0 l 210 0 l 210 593 l 0 593 l 0 749 l 618 749 l 618 593 "},"ξ":{"x_min":0,"x_max":640,"ha":715,"o":"m 640 -14 q 619 -157 640 -84 q 563 -299 599 -230 l 399 -299 q 442 -194 433 -223 q 468 -85 468 -126 q 440 -25 468 -41 q 368 -10 412 -10 q 333 -11 355 -10 q 302 -13 311 -13 q 91 60 179 -13 q 0 259 0 138 q 56 426 0 354 q 201 530 109 493 q 106 594 144 553 q 65 699 65 642 q 94 787 65 747 q 169 856 123 828 l 22 856 l 22 1013 l 597 1013 l 597 856 l 497 857 q 345 840 398 857 q 257 736 257 812 q 366 614 257 642 q 552 602 416 602 l 552 446 l 513 446 q 313 425 379 446 q 199 284 199 389 q 312 162 199 184 q 524 136 418 148 q 640 -14 640 105 "},"&":{"x_min":-1,"x_max":910.109375,"ha":1007,"o":"m 910 -1 l 676 -1 l 607 83 q 291 -47 439 -47 q 50 100 135 -47 q -1 273 -1 190 q 51 431 -1 357 q 218 568 104 505 q 151 661 169 629 q 120 769 120 717 q 201 951 120 885 q 382 1013 276 1013 q 555 957 485 1013 q 635 789 635 894 q 584 644 635 709 q 468 539 548 597 l 615 359 q 664 527 654 440 l 844 527 q 725 223 824 359 l 910 -1 m 461 787 q 436 848 461 826 q 381 870 412 870 q 325 849 349 870 q 301 792 301 829 q 324 719 301 757 q 372 660 335 703 q 430 714 405 680 q 461 787 461 753 m 500 214 l 318 441 q 198 286 198 363 q 225 204 198 248 q 347 135 268 135 q 425 153 388 135 q 500 214 462 172 "},"Λ":{"x_min":0,"x_max":894.453125,"ha":974,"o":"m 894 0 l 666 0 l 447 757 l 225 0 l 0 0 l 344 1013 l 547 1013 l 894 0 "},"I":{"x_min":41,"x_max":249,"ha":365,"o":"m 249 0 l 41 0 l 41 1013 l 249 1013 l 249 0 "},"G":{"x_min":0,"x_max":971,"ha":1057,"o":"m 971 -1 l 829 -1 l 805 118 q 479 -29 670 -29 q 126 133 261 -29 q 0 509 0 286 q 130 884 0 737 q 493 1040 268 1040 q 790 948 659 1040 q 961 698 920 857 l 736 698 q 643 813 709 769 q 500 857 578 857 q 285 746 364 857 q 213 504 213 644 q 285 263 213 361 q 505 154 365 154 q 667 217 598 154 q 761 374 736 280 l 548 374 l 548 548 l 971 548 l 971 -1 "},"ΰ":{"x_min":0,"x_max":655,"ha":767,"o":"m 583 810 l 454 810 l 454 952 l 583 952 l 583 810 m 186 810 l 57 809 l 57 952 l 186 952 l 186 810 m 516 1039 l 315 823 l 216 823 l 338 1039 l 516 1039 m 655 417 q 567 55 655 146 q 326 -25 489 -25 q 59 97 137 -25 q 0 369 0 192 l 0 748 l 200 748 l 201 369 q 218 222 201 269 q 326 142 245 142 q 439 247 410 142 q 455 422 455 304 l 455 748 l 655 748 l 655 417 "},"`":{"x_min":0,"x_max":190,"ha":288,"o":"m 190 654 l 0 654 l 0 830 q 55 970 0 909 q 190 1040 110 1031 l 190 969 q 111 922 134 952 q 88 836 88 892 l 190 836 l 190 654 "},"·":{"x_min":0,"x_max":207,"ha":304,"o":"m 207 528 l 0 528 l 0 735 l 207 735 l 207 528 "},"Υ":{"x_min":-0.21875,"x_max":836.171875,"ha":914,"o":"m 836 1013 l 532 376 l 532 0 l 322 0 l 322 376 l 0 1013 l 208 1013 l 427 576 l 626 1013 l 836 1013 "},"r":{"x_min":0,"x_max":431.9375,"ha":513,"o":"m 431 564 q 269 536 320 564 q 200 395 200 498 l 200 0 l 0 0 l 0 748 l 183 748 l 183 618 q 285 731 224 694 q 431 768 345 768 l 431 564 "},"x":{"x_min":0,"x_max":738.890625,"ha":826,"o":"m 738 0 l 504 0 l 366 238 l 230 0 l 0 0 l 252 382 l 11 749 l 238 749 l 372 522 l 502 749 l 725 749 l 488 384 l 738 0 "},"μ":{"x_min":0,"x_max":647,"ha":754,"o":"m 647 0 l 477 0 l 477 68 q 411 9 448 30 q 330 -11 374 -11 q 261 3 295 -11 q 199 43 226 18 l 199 -278 l 0 -278 l 0 749 l 199 749 l 199 358 q 216 222 199 268 q 322 152 244 152 q 435 240 410 152 q 448 401 448 283 l 448 749 l 647 749 l 647 0 "},"h":{"x_min":0,"x_max":669,"ha":782,"o":"m 669 0 l 469 0 l 469 390 q 449 526 469 472 q 353 607 420 607 q 248 554 295 607 q 201 441 201 501 l 201 0 l 0 0 l 0 1013 l 201 1013 l 201 665 q 303 743 245 715 q 425 772 362 772 q 609 684 542 772 q 669 484 669 605 l 669 0 "},".":{"x_min":0,"x_max":206,"ha":303,"o":"m 206 0 l 0 0 l 0 207 l 206 207 l 206 0 "},"φ":{"x_min":-1,"x_max":921,"ha":990,"o":"m 542 -278 l 367 -278 l 367 -22 q 99 92 200 -22 q -1 376 -1 206 q 72 627 -1 520 q 288 769 151 742 l 288 581 q 222 495 243 550 q 202 378 202 439 q 240 228 202 291 q 367 145 285 157 l 367 776 l 515 776 q 807 667 694 776 q 921 379 921 558 q 815 93 921 209 q 542 -22 709 -22 l 542 -278 m 542 145 q 672 225 625 145 q 713 381 713 291 q 671 536 713 470 q 542 611 624 611 l 542 145 "},";":{"x_min":0,"x_max":208,"ha":306,"o":"m 208 528 l 0 528 l 0 735 l 208 735 l 208 528 m 208 6 q 152 -151 208 -89 q 0 -238 96 -212 l 0 -158 q 87 -100 61 -136 q 113 0 113 -65 l 0 0 l 0 207 l 208 207 l 208 6 "},"f":{"x_min":0,"x_max":424,"ha":525,"o":"m 424 609 l 300 609 l 300 0 l 107 0 l 107 609 l 0 609 l 0 749 l 107 749 q 145 949 107 894 q 328 1019 193 1019 l 424 1015 l 424 855 l 362 855 q 312 841 324 855 q 300 797 300 827 q 300 773 300 786 q 300 749 300 761 l 424 749 l 424 609 "},"“":{"x_min":0,"x_max":468,"ha":567,"o":"m 190 631 l 0 631 l 0 807 q 55 947 0 885 q 190 1017 110 1010 l 190 947 q 88 813 88 921 l 190 813 l 190 631 m 468 631 l 278 631 l 278 807 q 333 947 278 885 q 468 1017 388 1010 l 468 947 q 366 813 366 921 l 468 813 l 468 631 "},"A":{"x_min":0,"x_max":966.671875,"ha":1069,"o":"m 966 0 l 747 0 l 679 208 l 286 208 l 218 0 l 0 0 l 361 1013 l 600 1013 l 966 0 m 623 376 l 480 810 l 340 376 l 623 376 "},"6":{"x_min":57,"x_max":771,"ha":828,"o":"m 744 734 l 544 734 q 500 802 533 776 q 425 828 466 828 q 315 769 359 828 q 264 571 264 701 q 451 638 343 638 q 691 537 602 638 q 771 315 771 449 q 683 79 771 176 q 420 -29 586 -29 q 134 123 227 -29 q 57 455 57 250 q 184 865 57 721 q 452 988 293 988 q 657 916 570 988 q 744 734 744 845 m 426 128 q 538 178 498 128 q 578 300 578 229 q 538 422 578 372 q 415 479 493 479 q 303 430 342 479 q 264 313 264 381 q 308 184 264 240 q 426 128 352 128 "},"‘":{"x_min":0,"x_max":190,"ha":289,"o":"m 190 631 l 0 631 l 0 807 q 55 947 0 885 q 190 1017 110 1010 l 190 947 q 88 813 88 921 l 190 813 l 190 631 "},"ϊ":{"x_min":-55,"x_max":337,"ha":389,"o":"m 337 810 l 208 810 l 208 952 l 337 952 l 337 810 m 74 810 l -55 810 l -55 952 l 74 952 l 74 810 m 242 0 l 42 0 l 42 748 l 242 748 l 242 0 "},"π":{"x_min":0.5,"x_max":838.890625,"ha":938,"o":"m 838 593 l 750 593 l 750 0 l 549 0 l 549 593 l 287 593 l 287 0 l 88 0 l 88 593 l 0 593 l 0 749 l 838 749 l 838 593 "},"ά":{"x_min":-1,"x_max":722,"ha":835,"o":"m 722 0 l 531 0 l 530 101 q 433 8 491 41 q 304 -25 375 -25 q 72 104 157 -25 q -1 372 -1 216 q 72 643 -1 530 q 308 775 158 775 q 433 744 375 775 q 528 656 491 713 l 528 749 l 722 749 l 722 0 m 361 601 q 233 527 277 601 q 196 375 196 464 q 232 224 196 288 q 358 144 277 144 q 487 217 441 144 q 528 370 528 281 q 489 523 528 457 q 361 601 443 601 m 579 1039 l 377 823 l 279 823 l 401 1039 l 579 1039 "},"O":{"x_min":0,"x_max":994,"ha":1094,"o":"m 497 -29 q 133 127 272 -29 q 0 505 0 277 q 131 883 0 733 q 497 1040 270 1040 q 860 883 721 1040 q 994 505 994 733 q 862 127 994 277 q 497 -29 723 -29 m 497 154 q 710 266 631 154 q 780 506 780 365 q 710 745 780 647 q 497 857 631 857 q 283 747 361 857 q 213 506 213 647 q 282 266 213 365 q 497 154 361 154 "},"n":{"x_min":0,"x_max":669,"ha":782,"o":"m 669 0 l 469 0 l 469 452 q 442 553 469 513 q 352 601 412 601 q 245 553 290 601 q 200 441 200 505 l 200 0 l 0 0 l 0 748 l 194 748 l 194 659 q 289 744 230 713 q 416 775 349 775 q 600 700 531 775 q 669 509 669 626 l 669 0 "},"3":{"x_min":61,"x_max":767,"ha":828,"o":"m 767 290 q 653 51 767 143 q 402 -32 548 -32 q 168 48 262 -32 q 61 300 61 140 l 250 300 q 298 173 250 219 q 405 132 343 132 q 514 169 471 132 q 563 282 563 211 q 491 405 563 369 q 343 432 439 432 l 343 568 q 472 592 425 568 q 534 701 534 626 q 493 793 534 758 q 398 829 453 829 q 306 789 344 829 q 268 669 268 749 l 80 669 q 182 909 80 823 q 410 986 274 986 q 633 916 540 986 q 735 719 735 840 q 703 608 735 656 q 615 522 672 561 q 727 427 687 486 q 767 290 767 369 "},"9":{"x_min":58,"x_max":769,"ha":828,"o":"m 769 492 q 646 90 769 232 q 384 -33 539 -33 q 187 35 271 -33 q 83 224 98 107 l 282 224 q 323 154 286 182 q 404 127 359 127 q 513 182 471 127 q 563 384 563 248 q 475 335 532 355 q 372 315 418 315 q 137 416 224 315 q 58 642 58 507 q 144 877 58 781 q 407 984 239 984 q 694 827 602 984 q 769 492 769 699 m 416 476 q 525 521 488 476 q 563 632 563 566 q 521 764 563 709 q 403 826 474 826 q 297 773 337 826 q 258 649 258 720 q 295 530 258 577 q 416 476 339 476 "},"l":{"x_min":41,"x_max":240,"ha":363,"o":"m 240 0 l 41 0 l 41 1013 l 240 1013 l 240 0 "},"¤":{"x_min":40.265625,"x_max":727.203125,"ha":825,"o":"m 727 792 l 594 659 q 620 552 620 609 q 598 459 620 504 l 725 331 l 620 224 l 491 352 q 382 331 443 331 q 273 352 322 331 l 144 224 l 40 330 l 167 459 q 147 552 147 501 q 172 658 147 608 l 40 794 l 147 898 l 283 759 q 383 776 330 776 q 482 759 434 776 l 620 898 l 727 792 m 383 644 q 308 617 334 644 q 283 551 283 590 q 309 489 283 517 q 381 462 335 462 q 456 488 430 462 q 482 554 482 515 q 455 616 482 588 q 383 644 429 644 "},"κ":{"x_min":0,"x_max":691.84375,"ha":779,"o":"m 691 0 l 479 0 l 284 343 l 196 252 l 196 0 l 0 0 l 0 749 l 196 749 l 196 490 l 440 749 l 677 749 l 416 479 l 691 0 "},"4":{"x_min":53,"x_max":775.21875,"ha":828,"o":"m 775 213 l 660 213 l 660 0 l 470 0 l 470 213 l 53 213 l 53 384 l 416 958 l 660 958 l 660 370 l 775 370 l 775 213 m 474 364 l 474 786 l 204 363 l 474 364 "},"p":{"x_min":0,"x_max":722,"ha":824,"o":"m 415 -26 q 287 4 346 -26 q 192 92 228 34 l 192 -298 l 0 -298 l 0 750 l 192 750 l 192 647 q 289 740 230 706 q 416 775 347 775 q 649 645 566 775 q 722 375 722 534 q 649 106 722 218 q 415 -26 564 -26 m 363 603 q 232 529 278 603 q 192 375 192 465 q 230 222 192 286 q 360 146 276 146 q 487 221 441 146 q 526 371 526 285 q 488 523 526 458 q 363 603 443 603 "},"‡":{"x_min":0,"x_max":809,"ha":894,"o":"m 299 621 l 0 621 l 0 804 l 299 804 l 299 1011 l 509 1011 l 509 804 l 809 804 l 809 621 l 509 621 l 509 387 l 809 387 l 809 205 l 509 205 l 509 0 l 299 0 l 299 205 l 0 205 l 0 387 l 299 387 l 299 621 "},"ψ":{"x_min":0,"x_max":875,"ha":979,"o":"m 522 142 q 657 274 620 163 q 671 352 671 316 l 671 748 l 875 748 l 875 402 q 806 134 875 240 q 525 -22 719 -1 l 525 -278 l 349 -278 l 349 -22 q 65 135 152 -1 q 0 402 0 238 l 0 748 l 204 748 l 204 352 q 231 240 204 295 q 353 142 272 159 l 353 922 l 524 922 l 522 142 "},"η":{"x_min":0,"x_max":669,"ha":779,"o":"m 669 -278 l 469 -278 l 469 390 q 448 526 469 473 q 348 606 417 606 q 244 553 288 606 q 201 441 201 501 l 201 0 l 0 0 l 0 749 l 201 749 l 201 665 q 301 744 244 715 q 423 774 359 774 q 606 685 538 774 q 669 484 669 603 l 669 -278 "}},"cssFontWeight":"bold","ascender":1216,"underlinePosition":-100,"cssFontStyle":"normal","boundingBox":{"yMin":-333,"xMin":-162,"yMax":1216,"xMax":1681},"resolution":1000,"original_font_information":{"postscript_name":"Helvetiker-Bold","version_string":"Version 1.00 2004 initial release","vendor_url":"http://www.magenta.gr","full_font_name":"Helvetiker Bold","font_family_name":"Helvetiker","copyright":"Copyright (c) Magenta ltd, 2004.","description":"","trademark":"","designer":"","designer_url":"","unique_font_identifier":"Magenta ltd:Helvetiker Bold:22-10-104","license_url":"http://www.ellak.gr/fonts/MgOpen/license.html","license_description":"Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license (\"Fonts\") and associated documentation files (the \"Font Software\"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word \"MgOpen\", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r\n\r\nThis License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the \"MgOpen\" name.\r\n\r\nThe Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r\n\r\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.","manufacturer_name":"Magenta ltd","font_sub_family_name":"Bold"},"descender":-334,"familyName":"Helvetiker","lineHeight":1549,"underlineThickness":50});if (_typeface_js && _typeface_js.loadFace) _typeface_js.loadFace({"glyphs":{"ο":{"x_min":0,"x_max":712,"ha":815,"o":"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},"S":{"x_min":0,"x_max":788,"ha":890,"o":"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{"x_min":343,"x_max":449,"ha":792,"o":"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{"x_min":183.25,"x_max":608.328125,"ha":792,"o":"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},"Τ":{"x_min":-0.4375,"x_max":777.453125,"ha":839,"o":"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},"y":{"x_min":0,"x_max":684.78125,"ha":771,"o":"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},"Π":{"x_min":0,"x_max":803,"ha":917,"o":"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},"ΐ":{"x_min":-111,"x_max":339,"ha":361,"o":"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},"g":{"x_min":0,"x_max":686,"ha":838,"o":"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{"x_min":0,"x_max":442,"ha":539,"o":"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"–":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},"Κ":{"x_min":0,"x_max":819.5625,"ha":893,"o":"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},"ƒ":{"x_min":-46.265625,"x_max":392,"ha":513,"o":"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},"e":{"x_min":0,"x_max":714,"ha":813,"o":"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},"ό":{"x_min":0,"x_max":712,"ha":815,"o":"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},"J":{"x_min":0,"x_max":588,"ha":699,"o":"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{"x_min":-1,"x_max":503,"ha":601,"o":"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{"x_min":-3,"x_max":1008,"ha":1106,"o":"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},"ώ":{"x_min":0,"x_max":922,"ha":1030,"o":"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{"x_min":193.0625,"x_max":598.609375,"ha":792,"o":"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{"x_min":0,"x_max":507.203125,"ha":604,"o":"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},"D":{"x_min":0,"x_max":828,"ha":935,"o":"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"∙":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"ÿ":{"x_min":0,"x_max":47,"ha":125,"o":"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},"w":{"x_min":0,"x_max":1009.71875,"ha":1100,"o":"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},"$":{"x_min":0,"x_max":700,"ha":793,"o":"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{"x_min":-0.015625,"x_max":425.0625,"ha":522,"o":"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},"µ":{"x_min":0,"x_max":697.21875,"ha":747,"o":"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},"Ι":{"x_min":42,"x_max":181,"ha":297,"o":"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},"Ύ":{"x_min":0,"x_max":1144.5,"ha":1214,"o":"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"’":{"x_min":0,"x_max":139,"ha":236,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},"Ν":{"x_min":0,"x_max":801,"ha":915,"o":"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{"x_min":8.71875,"x_max":350.390625,"ha":478,"o":"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},"Q":{"x_min":0,"x_max":968,"ha":1072,"o":"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},"ς":{"x_min":1,"x_max":676.28125,"ha":740,"o":"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},"M":{"x_min":0,"x_max":954,"ha":1067,"o":"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},"Ψ":{"x_min":0,"x_max":1006,"ha":1094,"o":"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},"C":{"x_min":0,"x_max":886,"ha":944,"o":"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{"x_min":0,"x_max":138,"ha":236,"o":"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{"x_min":0,"x_max":480.5625,"ha":578,"o":"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},"X":{"x_min":-0.015625,"x_max":854.15625,"ha":940,"o":"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{"x_min":0,"x_max":963.890625,"ha":1061,"o":"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},"ι":{"x_min":42,"x_max":284,"ha":361,"o":"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},"Ά":{"x_min":0,"x_max":906.953125,"ha":982,"o":"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{"x_min":0,"x_max":318,"ha":415,"o":"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},"ε":{"x_min":0,"x_max":634.71875,"ha":714,"o":"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},"Δ":{"x_min":0,"x_max":952.78125,"ha":1028,"o":"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{"x_min":0,"x_max":481,"ha":578,"o":"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"‰":{"x_min":-3,"x_max":1672,"ha":1821,"o":"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},"a":{"x_min":0,"x_max":698.609375,"ha":794,"o":"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"—":{"x_min":0,"x_max":941.671875,"ha":1039,"o":"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{"x_min":8.71875,"x_max":780.953125,"ha":792,"o":"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},"N":{"x_min":0,"x_max":801,"ha":914,"o":"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},"ρ":{"x_min":0,"x_max":712,"ha":797,"o":"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"2":{"x_min":59,"x_max":731,"ha":792,"o":"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},"¯":{"x_min":0,"x_max":941.671875,"ha":938,"o":"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},"Z":{"x_min":0,"x_max":779,"ha":849,"o":"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},"u":{"x_min":0,"x_max":617,"ha":729,"o":"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},"k":{"x_min":0,"x_max":612.484375,"ha":697,"o":"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},"Η":{"x_min":0,"x_max":803,"ha":917,"o":"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},"Α":{"x_min":0,"x_max":906.953125,"ha":985,"o":"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},"s":{"x_min":0,"x_max":604,"ha":697,"o":"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},"B":{"x_min":0,"x_max":778,"ha":876,"o":"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"…":{"x_min":0,"x_max":614,"ha":708,"o":"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{"x_min":0,"x_max":607,"ha":704,"o":"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},"H":{"x_min":0,"x_max":803,"ha":915,"o":"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},"ν":{"x_min":0,"x_max":675,"ha":761,"o":"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},"c":{"x_min":1,"x_max":701.390625,"ha":775,"o":"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{"x_min":0,"x_max":566.671875,"ha":678,"o":"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},"β":{"x_min":0,"x_max":660,"ha":745,"o":"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},"Μ":{"x_min":0,"x_max":954,"ha":1068,"o":"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},"Ό":{"x_min":0.109375,"x_max":1120,"ha":1217,"o":"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"Ή":{"x_min":0,"x_max":1158,"ha":1275,"o":"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"•":{"x_min":0,"x_max":663.890625,"ha":775,"o":"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"¥":{"x_min":0.1875,"x_max":819.546875,"ha":886,"o":"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{"x_min":0,"x_max":318.0625,"ha":415,"o":"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},"U":{"x_min":0,"x_max":796,"ha":904,"o":"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},"γ":{"x_min":0.5,"x_max":744.953125,"ha":822,"o":"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},"α":{"x_min":0,"x_max":765.5625,"ha":809,"o":"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},"F":{"x_min":0,"x_max":683.328125,"ha":717,"o":"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"­":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"Χ":{"x_min":0,"x_max":854.171875,"ha":935,"o":"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{"x_min":116,"x_max":674,"ha":792,"o":"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"†":{"x_min":0,"x_max":777,"ha":835,"o":"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{"x_min":0,"x_max":347,"ha":444,"o":"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},"V":{"x_min":0,"x_max":862.71875,"ha":940,"o":"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},"Ξ":{"x_min":0,"x_max":734.71875,"ha":763,"o":"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{"x_min":0,"x_max":0,"ha":853},"Ϋ":{"x_min":0.328125,"x_max":819.515625,"ha":889,"o":"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"0":{"x_min":73,"x_max":715,"ha":792,"o":"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},"”":{"x_min":0,"x_max":347,"ha":454,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{"x_min":0,"x_max":1260,"ha":1357,"o":"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},"Ί":{"x_min":0,"x_max":499,"ha":613,"o":"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},"i":{"x_min":14,"x_max":136,"ha":275,"o":"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},"Β":{"x_min":0,"x_max":778,"ha":877,"o":"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},"υ":{"x_min":0,"x_max":617,"ha":725,"o":"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{"x_min":0,"x_max":275,"ha":372,"o":"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},"m":{"x_min":0,"x_max":1019,"ha":1128,"o":"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},"χ":{"x_min":8.328125,"x_max":780.5625,"ha":815,"o":"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},"8":{"x_min":55,"x_max":736,"ha":792,"o":"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},"ί":{"x_min":42,"x_max":326.71875,"ha":361,"o":"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},"Ζ":{"x_min":0,"x_max":779.171875,"ha":850,"o":"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},"R":{"x_min":0,"x_max":781.953125,"ha":907,"o":"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},"o":{"x_min":0,"x_max":713,"ha":821,"o":"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},"5":{"x_min":54.171875,"x_max":738,"ha":792,"o":"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},"7":{"x_min":58.71875,"x_max":730.953125,"ha":792,"o":"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},"K":{"x_min":0,"x_max":819.46875,"ha":906,"o":"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},"d":{"x_min":0,"x_max":683,"ha":796,"o":"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{"x_min":-109,"x_max":247,"ha":232,"o":"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},"E":{"x_min":0,"x_max":736.109375,"ha":789,"o":"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"Y":{"x_min":0,"x_max":820,"ha":886,"o":"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},"\"":{"x_min":0,"x_max":299,"ha":396,"o":"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"‹":{"x_min":17.984375,"x_max":773.609375,"ha":792,"o":"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"„":{"x_min":0,"x_max":364,"ha":467,"o":"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},"δ":{"x_min":1,"x_max":710,"ha":810,"o":"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},"έ":{"x_min":0,"x_max":634.71875,"ha":714,"o":"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},"ω":{"x_min":0,"x_max":922,"ha":1031,"o":"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{"x_min":0,"x_max":96,"ha":251,"o":"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{"x_min":11,"x_max":781,"ha":792,"o":"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{"x_min":343,"x_max":449,"ha":792,"o":"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"ϋ":{"x_min":0,"x_max":617,"ha":725,"o":"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{"x_min":0,"x_max":593,"ha":690,"o":"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},"b":{"x_min":0,"x_max":685,"ha":783,"o":"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},"q":{"x_min":0,"x_max":683,"ha":876,"o":"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},"Ω":{"x_min":-0.171875,"x_max":969.5625,"ha":1068,"o":"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},"ύ":{"x_min":0,"x_max":617,"ha":725,"o":"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},"z":{"x_min":-0.015625,"x_max":613.890625,"ha":697,"o":"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"™":{"x_min":0,"x_max":894,"ha":1000,"o":"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},"ή":{"x_min":0.78125,"x_max":697,"ha":810,"o":"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},"Θ":{"x_min":0,"x_max":960,"ha":1056,"o":"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{"x_min":-3,"x_max":1008,"ha":1106,"o":"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{"x_min":0,"x_max":833,"ha":931,"o":"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},"Ε":{"x_min":0,"x_max":736.21875,"ha":778,"o":"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{"x_min":0,"x_max":450,"ha":547,"o":"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{"x_min":0,"x_max":273.609375,"ha":371,"o":"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},"L":{"x_min":0,"x_max":645.828125,"ha":696,"o":"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},"σ":{"x_min":0,"x_max":803.390625,"ha":894,"o":"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},"ζ":{"x_min":0,"x_max":573,"ha":642,"o":"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},"θ":{"x_min":0,"x_max":674,"ha":778,"o":"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},"Ο":{"x_min":0,"x_max":958,"ha":1054,"o":"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},"Γ":{"x_min":0,"x_max":705.28125,"ha":749,"o":"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{"x_min":0,"x_max":0,"ha":375},"%":{"x_min":-3,"x_max":1089,"ha":1186,"o":"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},"P":{"x_min":0,"x_max":726,"ha":806,"o":"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},"Έ":{"x_min":0,"x_max":1078.21875,"ha":1118,"o":"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"Ώ":{"x_min":0.125,"x_max":1136.546875,"ha":1235,"o":"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},"_":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},"Ϊ":{"x_min":-110,"x_max":246,"ha":275,"o":"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{"x_min":23,"x_max":768,"ha":792,"o":"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{"x_min":0,"x_max":1050,"ha":1149,"o":"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},"Ρ":{"x_min":0,"x_max":720,"ha":783,"o":"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{"x_min":0,"x_max":139,"ha":236,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},"ª":{"x_min":0,"x_max":350,"ha":397,"o":"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"΅":{"x_min":0,"x_max":450,"ha":553,"o":"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},"T":{"x_min":0,"x_max":777,"ha":835,"o":"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},"Φ":{"x_min":0,"x_max":915,"ha":997,"o":"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"⁋":{"x_min":0,"x_max":0,"ha":694},"j":{"x_min":-77.78125,"x_max":167,"ha":349,"o":"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},"Σ":{"x_min":0,"x_max":756.953125,"ha":819,"o":"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"1":{"x_min":215.671875,"x_max":574,"ha":792,"o":"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},"›":{"x_min":18.0625,"x_max":774,"ha":792,"o":"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{"x_min":17.984375,"x_max":773.609375,"ha":792,"o":"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{"x_min":0,"x_max":704.484375,"ha":801,"o":"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},"t":{"x_min":0,"x_max":367,"ha":458,"o":"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{"x_min":0,"x_max":706,"ha":803,"o":"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},"λ":{"x_min":0,"x_max":750,"ha":803,"o":"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},"W":{"x_min":0,"x_max":1263.890625,"ha":1351,"o":"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{"x_min":18.0625,"x_max":774,"ha":792,"o":"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"v":{"x_min":0,"x_max":675.15625,"ha":761,"o":"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},"τ":{"x_min":0.28125,"x_max":644.5,"ha":703,"o":"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},"ξ":{"x_min":0,"x_max":624.9375,"ha":699,"o":"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{"x_min":-3,"x_max":894.25,"ha":992,"o":"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},"Λ":{"x_min":0,"x_max":862.5,"ha":942,"o":"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},"I":{"x_min":41,"x_max":180,"ha":293,"o":"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},"G":{"x_min":0,"x_max":921,"ha":1011,"o":"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},"ΰ":{"x_min":0,"x_max":617,"ha":725,"o":"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{"x_min":0,"x_max":138.890625,"ha":236,"o":"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"Υ":{"x_min":0.328125,"x_max":819.515625,"ha":889,"o":"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},"r":{"x_min":0,"x_max":355.5625,"ha":432,"o":"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},"x":{"x_min":0,"x_max":675,"ha":764,"o":"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},"μ":{"x_min":0,"x_max":696.609375,"ha":747,"o":"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},"h":{"x_min":0,"x_max":615,"ha":724,"o":"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"φ":{"x_min":-2,"x_max":878,"ha":974,"o":"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},"f":{"x_min":0,"x_max":378,"ha":472,"o":"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{"x_min":1,"x_max":348.21875,"ha":454,"o":"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},"A":{"x_min":0.03125,"x_max":906.953125,"ha":1008,"o":"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"6":{"x_min":53,"x_max":739,"ha":792,"o":"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},"‘":{"x_min":1,"x_max":139.890625,"ha":236,"o":"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},"ϊ":{"x_min":-70,"x_max":283,"ha":361,"o":"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},"π":{"x_min":-0.21875,"x_max":773.21875,"ha":857,"o":"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},"ά":{"x_min":0,"x_max":765.5625,"ha":809,"o":"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},"O":{"x_min":0,"x_max":958,"ha":1057,"o":"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},"n":{"x_min":0,"x_max":615,"ha":724,"o":"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},"3":{"x_min":54,"x_max":737,"ha":792,"o":"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},"9":{"x_min":53,"x_max":739,"ha":792,"o":"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"l":{"x_min":41,"x_max":166,"ha":279,"o":"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{"x_min":40.09375,"x_max":728.796875,"ha":825,"o":"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},"κ":{"x_min":0,"x_max":632.328125,"ha":679,"o":"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},"4":{"x_min":48,"x_max":742.453125,"ha":792,"o":"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},"p":{"x_min":0,"x_max":685,"ha":786,"o":"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{"x_min":0,"x_max":777,"ha":835,"o":"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},"ψ":{"x_min":0,"x_max":808,"ha":907,"o":"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},"η":{"x_min":0.78125,"x_max":697,"ha":810,"o":"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},"cssFontWeight":"normal","ascender":1189,"underlinePosition":-100,"cssFontStyle":"normal","boundingBox":{"yMin":-334,"xMin":-111,"yMax":1189,"xMax":1672},"resolution":1000,"original_font_information":{"postscript_name":"Helvetiker-Regular","version_string":"Version 1.00 2004 initial release","vendor_url":"http://www.magenta.gr/","full_font_name":"Helvetiker","font_family_name":"Helvetiker","copyright":"Copyright (c) Μagenta ltd, 2004","description":"","trademark":"","designer":"","designer_url":"","unique_font_identifier":"Μagenta ltd:Helvetiker:22-10-104","license_url":"http://www.ellak.gr/fonts/MgOpen/license.html","license_description":"Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license (\"Fonts\") and associated documentation files (the \"Font Software\"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word \"MgOpen\", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r\n\r\nThis License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the \"MgOpen\" name.\r\n\r\nThe Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r\n\r\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.","manufacturer_name":"Μagenta ltd","font_sub_family_name":"Regular"},"descender":-334,"familyName":"Helvetiker","lineHeight":1522,"underlineThickness":50});var COMPILED=!0,goog=goog||{};goog.global=this;goog.DEBUG=!0;goog.LOCALE="en";goog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a];for(var b=a;(b=b.substring(0,b.lastIndexOf(".")))&&!goog.getObjectByName(b);)goog.implicitNamespaces_[b]=!0}goog.exportPath_(a)};goog.setTestOnly=function(a){if(COMPILED&&!goog.DEBUG)throw a=a||"",Error("Importing test-only code into non-debug environment"+a?": "+a:".");}; COMPILED||(goog.isProvided_=function(a){return!goog.implicitNamespaces_[a]&&!!goog.getObjectByName(a)},goog.implicitNamespaces_={});goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&goog.isDef(b)?c[d]=b:c=c[d]?c[d]:c[d]={}};goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e;e=c.shift();)if(goog.isDefAndNotNull(d[e]))d=d[e];else return null;return d}; goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};goog.addDependency=function(a,b,c){if(!COMPILED){var d;a=a.replace(/\\/g,"/");for(var e=goog.dependencies_,f=0;d=b[f];f++)e.nameToPath[d]=a,a in e.pathToNames||(e.pathToNames[a]={}),e.pathToNames[a][d]=!0;for(d=0;b=c[d];d++)a in e.requires||(e.requires[a]={}),e.requires[a][b]=!0}};goog.ENABLE_DEBUG_LOADER=!0; goog.require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LOADER){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=!0;goog.writeScripts_();return}}a="goog.require could not find: "+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}};goog.basePath="";goog.nullFunction=function(){};goog.identityFunction=function(a){return a};goog.abstractMethod=function(){throw Error("unimplemented abstract method");}; goog.addSingletonGetter=function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a)}}; !COMPILED&&goog.ENABLE_DEBUG_LOADER&&(goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return"undefined"!=typeof a&&"write"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName("script"),b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?"),d= -1==d?c.length:d;if("base.js"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}},goog.importScript_=function(a){var b=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[a]&&b(a)&&(goog.dependencies_.written[a]=!0)},goog.writeScriptTag_=function(a){return goog.inHtmlDocument_()?(goog.global.document.write('