<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/*! For license information please see 6.7de32f86.chunk.js.LICENSE.txt */
(this["webpackJsonppolyhedra-viewer"]=this["webpackJsonppolyhedra-viewer"]||[]).push([[6],{132:function(e,t,i){t.is=i(146),t.has=i(148),t.extend=i(215),t.each=i(183),t.bind=i(571),t.keys=i(572),t.values=i(573),t.filter=i(574),t.mixin=i(575),t.Iterator=i(216),t.LinkedMap=i(576),t.numberComparator=i(577),t.removeItemFrom=i(578)},134:function(e,t){var i={};i.SQRT2=Math.sqrt(2),i.SQRT3=Math.sqrt(3),i.LOG2=Math.log(2),i.PI=3.141592653589793,i.INV_PI=1/i.PI,i.HALF_PI=i.PI/2,i.THIRD_PI=i.PI/3,i.QUARTER_PI=i.PI/4,i.TWO_PI=2*i.PI,i.THREE_HALVES_PI=i.TWO_PI-i.HALF_PI,i.PI_SQUARED=i.PI*i.PI,i.EPS=1.1920928955078125e-7,i.DEG2RAD=i.PI/180,i.RAD2DEG=180/i.PI,i.SHIFT23=1&lt;&lt;23,i.INV_SHIFT23=1/i.SHIFT23,i.SIN_A=-4/(i.PI*i.PI),i.SIN_B=4/i.PI,i.SIN_P=9/40,i.abs=Math.abs,i.ceilPowerOf2=function(e){for(var t=1;t&lt;e;)t&lt;&lt;=1;return t},i.clip=function(e,t,i){return e&lt;t?t:e&gt;i?i:e},i.clipNormalized=function(e){return e&lt;0?0:e&gt;1?1:e},i.cos=Math.cos,i.degrees=function(e){return e*i.RAD2DEG},i.fastCos=function(e){return i.fastSin(e+(e&gt;i.HALF_PI?-i.THREE_HALVES_PI:i.HALF_PI))},i.fastSin=function(e){return e=i.SIN_B*e+i.SIN_A*e*Math.abs(e),i.SIN_P*(e*Math.abs(e)-e)+e},i.flipCoin=function(e){return Math.random()&lt;.5},i.floor=function(e){var t=~~e;return e&lt;0&amp;&amp;e!=t&amp;&amp;t--,t},i.floorPowerOf2=function(e){return~~Math.pow(2,parseInt(Math.log(e)/i.LOG2,10))},i.max=function(e,t,i){return void 0===i?Math.max(e,t):e&gt;t?e&gt;i?e:i:t&gt;i?t:i},i.min=function(e,t,i){return void 0===i?Math.min(e,t):e&lt;t?e&lt;i?e:i:t&lt;i?t:i},i.normalizedRandom=function(){return 2*Math.random()-1},i.radians=function(e){return e*i.DEG2RAD},i.random=function(e,t,i){return 1===arguments.length?Math.random()*arguments[0]:(2==arguments.length&amp;&amp;(i=t,t=e,e=Math.random),t||i?i?e()*(i-t)+t:(i=t,e()*i):Math.random())},i.reduceAngle=function(e){return e%=i.TWO_PI,Math.abs(e)&gt;i.PI&amp;&amp;(e-=i.TWO_PI),Math.abs(e)&gt;i.HALF_PI&amp;&amp;(e=i.PI-e),e},i.sign=function(e){return e&lt;0?-1:e&gt;0?1:0},i.sin=function(e){return e=i.reduceAngle(e),Math.abs(e)&lt;=i.QUARTER_PI?i.fastSin(e):i.fastCos(i.HALF_PI-e)},e.exports=i},136:function(e,t,i){e.exports=i(149).Vec3D},143:function(e,t,i){e.exports=i(149).Vec2D},146:function(e,t,i){var s=i(148),r=function(e){return function(t){return s.all(t,e)}};t.Array=Array.isArray||function(e){return"[object Array]"==e.toString()},t.Object=function(e){return"object"===typeof e},t.undef=function(e){return void 0===e},t.existy=function(e){return null!=e},t.String=function(e){return"string"===typeof e},t.Number=function(e){return"number"===typeof e},t.Function=function(e){return"function"===typeof e},t.AABB=r(["setExtent","getNormalForPoint"]),t.ColorGradient=r(["gradient","interpolator","maxDither","addColorAt","calcGradient"]),t.ColorList=r(["add","addAll","adjustBrightness","adjustSaturation"]),t.ColorRange=r(["add","addAlphaRange","addBrightnessRange","addHueRange"]),t.Circle=r(["getCircumference","getRadius","intersectsCircle"]),t.FloatRange=r(["min","max","adjustCurrentBy","getMedian"]),t.Hue=r(["getHue","isPrimary"]),t.Line2D=r(["closestPointTo","intersectLine","getLength"]),t.Matrix4x4=r(["identity","invert","setFrustrum"]),t.Rect=r(["x","y","width","height","getArea","getCentroid","getDimensions"]),t.Sphere=r(["x","y","z","radius","toMesh"]),t.ScaleMap=r(["mapFunction","setInputRange","setOutputRange","getMappedValueFor"]),t.TColor=r(["rgb","cmyk","hsv"]),t.ParticleBehavior=r(["applyBehavior","configure"]),t.VerletParticle2D=r(["x","y","weight"])},148:function(e,t){t.property=function(e,t){return hasOwnProperty.call(e,t)},t.all=function(e,t){if(void 0===e||"object"!=typeof e)return!1;var i=0,s=t.length;for(i=0;i&lt;s;i++)if(!(t[i]in e))return!1;return!0},t.typedArrays=function(){return"undefined"!==typeof Int32Array&amp;&amp;"undefined"!==typeof Float32Array&amp;&amp;"undefined"!==typeof Uint8Array},t.XY=function(e){return e&amp;&amp;"number"===typeof e.x&amp;&amp;"number"===typeof e.y},t.XYZ=function(e){return e&amp;&amp;"number"===typeof e.x&amp;&amp;"number"===typeof e.y&amp;&amp;"number"===typeof e.z},t.XYWidthHeight=function(e){return e&amp;&amp;"number"===typeof e.x&amp;&amp;"number"===typeof e.y&amp;&amp;"number"===typeof e.width&amp;&amp;"number"===typeof e.height}},149:function(e,t,i){var s,r,o=i(134),n=i(148),a=i(146),h=n.XY,d=a.Rect;(s=function(e,t){h(e)?(t=e.y,e=e.x):(e=e||0,t=t||0),this.x=e,this.y=t}).Axis={X:{getVector:function(){return s.X_AXIS},toString:function(){return"Vec2D.Axis.X"}},Y:{getVector:function(){return s.Y_AXIS},toString:function(){return"Vec2D.Axis.Y"}}};var l=function(){var e={x:0,y:0};return function(t,i){return t&amp;&amp;"number"===typeof t.x&amp;&amp;"number"===typeof t.y?t:(void 0!==t&amp;&amp;void 0===i?i=t:void 0===t?t=0:void 0===i&amp;&amp;(i=0),e.x=t,e.y=i,e)}}();(s.prototype={abs:function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},add:function(e,t){var i=new s(e,t);return i.x+=this.x,i.y+=this.y,i},addSelf:function(e,t){var i=l(e,t);return this.x+=i.x,this.y+=i.y,this},angleBetween:function(e,t){if(void 0===t)return Math.acos(this.dot(e));var i=t?this.getNormalized().dot(e.getNormalized()):this.dot(e);return Math.acos(o.clipNormalized(i))},clear:function(){return this.x=this.y=0,this},compareTo:function(e){return this.x==e.x&amp;&amp;this.y==e.y?0:this.magSquared()-e.magSquared()},constrain:function(e,t){return h(e)&amp;&amp;h(t)?(this.x=o.clip(this.x,e.x,t.x),this.y=o.clip(this.y,e.y,t.y)):d(e)&amp;&amp;(this.x=o.clip(this.x,e.x,e.x+e.width),this.y=o.clip(this.y,e.y,e.y+e.height)),this},copy:function(){return new s(this)},cross:function(e){return this.x*e.y-this.y*e.x},distanceTo:function(e){if(void 0!==e){var t=this.x-e.x,i=this.y-e.y;return Math.sqrt(t*t+i*i)}return NaN},distanceToSquared:function(e){if(void 0!==e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i}return NaN},dot:function(e){return this.x*e.x+this.y*e.y},equals:function(e){return!!h(e)&amp;&amp;(this.x==e.x&amp;&amp;this.y==e.y)},equalsWithTolerance:function(e,t){return!!h(e)&amp;&amp;(o.abs(this.x-e.x)&lt;t&amp;&amp;o.abs(this.y-e.y)&lt;t)},floor:function(){return this.x=o.floor(this.x),this.y=o.floor(this.y),this},frac:function(){return this.x-=o.floor(this.x),this.y-=o.floor(this.y),this},getAbs:function(){return new s(this).abs()},getComponent:function(e){return"number"==typeof e&amp;&amp;(e=0===e?s.Axis.X:s.Axis.Y),e==s.Axis.X?this.x:e==s.Axis.Y?this.y:0},getConstrained:function(e){return new s(this).constrain(e)},getFloored:function(){return new s(this).floor()},getFrac:function(){return new s(this).frac()},getInverted:function(){return new s(-this.x,-this.y)},getLimited:function(e){return this.magSquared()&gt;e*e?this.getNormalizedTo(e):new s(this)},getNormalized:function(){return new s(this).normalize()},getNormalizedTo:function(e){return new s(this).normalizeTo(e)},getPerpendicular:function(){return new s(this).perpendicular()},getReciprocal:function(){return new s(this).reciprocal()},getReflected:function(e){return new s(this).reflect(e)},getRotated:function(e){return new s(this).rotate(e)},getSignum:function(){return new s(this).signum()},heading:function(){return Math.atan2(this.y,this.x)},interpolateTo:function(e,t,i){return void 0===i?new s(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t):new s(i.interpolate(this.x,e.x,t),i.interpolate(this.y,e.y,t))},interpolateToSelf:function(e,t,i){return void 0===i?(this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t):(this.x=i.interpolate(this.x,e.x,t),this.y=i.interpolate(this.y,e.y,t)),this},invert:function(){return this.x*=-1,this.y*=-1,this},isInCircle:function(e,t){return this.sub(e).magSquared()&lt;=t*t},isInRectangle:function(e){return!(this.x&lt;e.x||this.x&gt;e.x+e.width)&amp;&amp;!(this.y&lt;e.y||this.y&gt;e.y+e.height)},isInTriangle:function(e,t,i){var s=this.sub(e).normalize(),r=this.sub(t).normalize(),n=this.sub(i).normalize(),a=Math.acos(s.dot(r));return a+=Math.acos(r.dot(n)),a+=Math.acos(n.dot(s)),Math.abs(a-o.TWO_PI)&lt;=.005},isMajorAxis:function(e){var t=Math.abs(this.x),i=Math.abs(this.y),s=1-e;return t&gt;s?i&lt;e:i&gt;s&amp;&amp;t&lt;e},isZeroVector:function(){return Math.abs(this.x)&lt;o.EPS&amp;&amp;Math.abs(this.y)&lt;o.EPS},jitter:function(e,t){var i=l(e,t);return this.x+=o.normalizedRandom()*i.x,this.y+=o.normalizedRandom()*i.y,this},limit:function(e){return this.magSquared()&gt;e*e?this.normalize().scaleSelf(e):this},magnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},magSquared:function(){return this.x*this.x+this.y*this.y},max:function(e){return new s(o.max(this.x,e.x),o.max(this.y,e.y))},maxSelf:function(e){return this.x=o.max(this.x,e.x),this.y=o.max(this.y,e.y),this},min:function(e){return new s(o.min(this.x,e.x),o.min(this.y,e.y))},minSelf:function(e){return this.x=o.min(this.x,e.x),this.y=o.min(this.y,e.y),this},normalize:function(){var e=this.x*this.x+this.y*this.y;return e&gt;0&amp;&amp;(e=1/Math.sqrt(e),this.x*=e,this.y*=e),this},normalizeTo:function(e){var t=Math.sqrt(this.x*this.x+this.y*this.y);return t&gt;0&amp;&amp;(t=e/t,this.x*=t,this.y*=t),this},perpendicular:function(){var e=this.x;return this.x=-this.y,this.y=e,this},positiveHeading:function(){var e=Math.sqrt(this.x*this.x+this.y*this.y);return this.y&gt;=0?Math.acos(this.x/e):Math.acos(-this.x/e)+o.PI},reciprocal:function(){return this.x=1/this.x,this.y=1/this.y,this},reflect:function(e){return this.set(e.scale(2*this.dot(e)).subSelf(this))},rotate:function(e){var t=Math.cos(e),i=Math.sin(e),s=t*this.x-i*this.y;return this.y=i*this.x+t*this.y,this.x=s,this},roundToAxis:function(){return Math.abs(this.x)&lt;.5?this.x=0:(this.x=this.x&lt;0?-1:1,this.y=0),Math.abs(this.y)&lt;.5?this.y=0:(this.y=this.y&lt;0?-1:1,this.x=0),this},scale:function(e,t){var i=l(e,t);return new s(this.x*i.x,this.y*i.y)},scaleSelf:function(e,t){var i=l(e,t);return this.x*=i.x,this.y*=i.y,this},set:function(e,t){var i=l(e,t);return this.x=i.x,this.y=i.y,this},setComponent:function(e,t){return"number"==typeof e&amp;&amp;(e=0===e?s.Axis.X:s.Axis.Y),e===s.Axis.X?this.x=t:e===s.Axis.Y&amp;&amp;(this.y=t),this},signum:function(){return this.x=this.x&lt;0?-1:0===this.x?0:1,this.y=this.y&lt;0?-1:0===this.y?0:1,this},sub:function(e,t){var i=l(e,t);return new s(this.x-i.x,this.y-i.y)},subSelf:function(e,t){var i=l(e,t);return this.x-=i.x,this.y-=i.y,this},tangentNormalOfEllipse:function(e,t){var i=this.sub(e),r=t.x*t.x,o=t.y*t.y;return new s(i.x/r,i.y/o).normalize()},toArray:function(){return[this.x,this.y]},toCartesian:function(){var e=this.x*Math.cos(this.y);return this.y=this.x*Math.sin(this.y),this.x=e,this},toPolar:function(){var e=Math.sqrt(this.x*this.x+this.y*this.y);return this.y=Math.atan2(this.y,this.x),this.x=e,this},toString:function(){return"{x:"+this.x+", y:"+this.y+"}"}}).bisect=function(e){var t=this.sub(e),i=this.add(e),s=t.dot(i);return new r(t.x,t.y,-s/2)},s.prototype.to3DXY=function(){return new r(this.x,this.y,0)},s.prototype.to3DXZ=function(){return new r(this.x,0,this.y)},s.prototype.to3DYZ=function(){return new r(0,this.x,this.y)},s.X_AXIS=new s(1,0),s.Y_AXIS=new s(0,1),s.ZERO=new s,s.MIN_VALUE=new s(Number.MIN_VALUE,Number.MIN_VALUE),s.MAX_VALUE=new s(Number.MAX_VALUE,Number.MAX_VALUE),s.fromTheta=function(e){return new s(Math.cos(e),Math.sin(e))},s.max=function(e,t){return new s(o.max(e.x,t.x),o.max(e.y,t.y))},s.min=function(e,t){return new s(o.min(e.x,t.x),o.min(e.y,t.y))},s.randomVector=function(e){return new s(2*Math.random()-1,2*Math.random()-1).normalize()},(r=function(e,t,i){n.XYZ(e)?(this.x=e.x,this.y=e.y,this.z=e.z):void 0===e?(this.x=0,this.y=0,this.z=0):(this.x=e,this.y=t,this.z=i)}).prototype={abs:function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},add:function(e,t,i){return n.XYZ(e)?new r(this.x+e.x,this.y+e.y,this.z+e.z):new r(this.x+e,this.y+t,this.z+i)},addSelf:function(e,t,i){return void 0!==e&amp;&amp;void 0!==t&amp;&amp;void 0!==i?(this.x+=e,this.y+=t,this.z+=i):(this.x+=e.x,this.y+=e.y,this.z+=e.z),this},angleBetween:function(e,t){var i;return i=t?this.getNormalized().dot(e.getNormalized()):this.dot(e),Math.acos(i)},clear:function(){return this.x=this.y=this.z=0,this},compareTo:function(e){return this.x==e.x&amp;&amp;this.y==e.y&amp;&amp;this.z==e.z?0:this.magSquared()-e.magSqaured()},constrain:function(e,t){var i;return a.AABB(e)?(t=e.getMax(),i=e.getMin()):i=e,this.x=o.clip(this.x,i.x,t.x),this.y=o.clip(this.y,i.y,t.y),this.z=o.clip(this.z,i.z,t.z),this},copy:function(){return new r(this)},cross:function(e){return new r(this.y*e.z-e.y*this.z,this.z*e.x-e.z*this.x,this.x*e.y-e.x*this.y)},crossInto:function(e,t){var i=e.x,s=e.y,r=e.z;return t.x=this.y*r-s*this.z,t.y=this.z*i-r*this.x,t.z=this.x*s-i*this.y,t},crossSelf:function(e){var t=this.y*e.z-e.y*this.z,i=this.z*e.x-e.z*this.x;return this.z=this.x*e.y-e.x*this.y,this.y=i,this.x=t,this},distanceTo:function(e){if(void 0!==e){var t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return Math.sqrt(t*t+i*i+s*s)}return NaN},distanceToSquared:function(e){if(void 0!==e){var t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}return NaN},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},equals:function(e){return!!n.XYZ(e)&amp;&amp;(this.x==e.x&amp;&amp;this.y==e.y&amp;&amp;this.z==e.z)},equalsWithTolerance:function(e,t){return Math.abs(this.x-e.x)&lt;t&amp;&amp;Math.abs(this.y-e.y)&lt;t&amp;&amp;Math.abs(this.z-e.z)&lt;t},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},frac:function(){return this.x-=Math.floor(this.x),this.y-=Math.floor(this.y),this.z-=Math.floor(this.z),this},getAbs:function(){return new r(this).abs()},getComponent:function(e){switch("number"==typeof e&amp;&amp;(e=e===r.Axis.X?0:e===r.Axis.Y?1:2),e){case 0:return this.x;case 1:return this.y;case 2:return this.z}},getConstrained:function(e){return new r(this).constrain(e)},getFloored:function(){return new r(this).floor()},getFrac:function(){return new r(this).frac()},getInverted:function(){return new r(-this.x,-this.y,-this.z)},getLimited:function(e){return this.magSquared()&gt;e*e?this.getNormalizedTo(e):new r(this)},getNormalized:function(){return new r(this).normalize()},getNormalizedTo:function(e){return new r(this).normalizeTo(e)},getReciprocal:function(){return this.copy().reciprocal()},getReflected:function(e){return this.copy().reflect(e)},getRotatedAroundAxis:function(e,t){return new r(this).rotateAroundAxis(e,t)},getRotatedX:function(e){return new r(this).rotateX(e)},getRotatedY:function(e){return new r(this).rotateY(e)},getRotatedZ:function(e){return new r(this).rotateZ(e)},getSignum:function(){return new r(this).signum()},headingXY:function(){return Math.atan2(this.y,this.x)},headingXZ:function(){return Math.atan2(this.z,this.x)},headingYZ:function(){return Math.atan2(this.y,this.z)},immutable:function(){return this},interpolateTo:function(e,t,i){return void 0===i?new r(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t,this.z+(e.z-this.z)*t):new r(i.interpolate(this.y,e.y,t),i.interpolate(this.y,e.y,t),i.interpolate(this.z,e.z,t))},interpolateToSelf:function(e,t,i){return void 0===i?(this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t):(this.x=i.interpolate(this.x,e.x,t),this.y=i.interpolate(this.y,e.y,t),this.z=i.interpolate(this.z,e.z,t)),this},invert:function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},isInAABB:function(e,t){if(t){var i=t.x;if(this.x&lt;e.x-i||this.x&gt;e.x+i)return!1;if(i=t.y,this.y&lt;e.y-i||this.y&gt;e.y+i)return!1;if(i=t.y,this.z&lt;e.z-i||this.y&gt;e.z+i)return!1}else{var s=e.getMin(),r=e.getMax();if(this.x&lt;s.x||this.x&gt;r.x)return!1;if(this.y&lt;s.y||this.y&gt;r.y)return!1;if(this.z&lt;s.z||this.z&gt;r.z)return!1}return!0},isMajorAxis:function(e){var t=o.abs(this.x),i=o.abs(this.y),s=o.abs(this.z),r=1-e;if(t&gt;r){if(i&lt;e)return s&lt;e}else if(i&gt;r){if(t&lt;e)return s&lt;e}else if(s&gt;r&amp;&amp;t&lt;e)return i&lt;e;return!1},isZeroVector:function(){return Math.abs(this.x)&lt;o.EPS&amp;&amp;Math.abs(this.y)&lt;o.EPS&amp;&amp;o.abs(this.z)&lt;o.EPS},jitter:function(e,t,i){return void 0!==t&amp;&amp;void 0!==i||(t=i=e),this.x+=o.normalizedRandom()*e,this.y+=o.normalizedRandom()*t,this.z+=o.normalizedRandom()*i,this},limit:function(e){return this.magSquared()&gt;e*e?this.normalize().scaleSelf(e):this},magnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},magSquared:function(){return this.x*this.x+this.y*this.y+this.z*this.z},maxSelf:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},minSelf:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},modSelf:function(e,t,i){return void 0!==t&amp;&amp;void 0!==i||(t=i=e),this.x%=e,this.y%=t,this.z%=i,this},normalize:function(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return e&gt;0&amp;&amp;(e=1/e,this.x*=e,this.y*=e,this.z*=e),this},normalizeTo:function(e){var t=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return t&gt;0&amp;&amp;(t=e/t,this.x*=t,this.y*=t,this.z*=t),this},reciprocal:function(){return this.x=1/this.x,this.y=1/this.y,this.z=1/this.z,this},reflect:function(e){return this.set(e.scale(2*this.dot(e)).subSelf(this))},rotateAroundAxis:function(e,t){var i=e.x,s=e.y,r=e.z,o=i*this.x,n=i*this.y,a=i*this.z,h=s*this.x,d=s*this.y,l=s*this.z,u=r*this.x,f=r*this.y,c=r*this.z,m=Math.sin(t),_=Math.cos(t),p=i*(o+d+c)+(this.x*(s*s+r*r)-i*(d+c))*_+(-f+l)*m,x=s*(o+d+c)+(this.y*(i*i+r*r)-s*(o+c))*_+(u-a)*m,g=r*(o+d+c)+(this.z*(i*i+s*s)-r*(o+d))*_+(-h+n)*m;return this.x=p,this.y=x,this.z=g,this},rotateX:function(e){var t=Math.cos(e),i=Math.sin(e),s=t*this.z-i*this.y;return this.y=i*this.z+t*this.y,this.z=s,this},rotateY:function(e){var t=Math.cos(e),i=Math.sin(e),s=t*this.x-i*this.z;return this.z=i*this.x+t*this.z,this.x=s,this},rotateZ:function(e){var t=Math.cos(e),i=Math.sin(e),s=t*this.x-i*this.y;return this.y=i*this.x+t*this.y,this.x=s,this},roundToAxis:function(){return Math.abs(this.x)&lt;.5?this.x=0:(this.x=this.x&lt;0?-1:1,this.y=this.z=0),Math.abs(this.y)&lt;.5?this.y=0:(this.y=this.y&lt;0?-1:1,this.x=this.z=0),Math.abs(this.z)&lt;.5?this.z=0:(this.z=this.z&lt;0?-1:1,this.x=this.y=0),this},scale:function(e,t,i){return n.XYZ(e)?new r(this.x*e.x,this.y*e.y,this.z*e.z):(void 0!==t&amp;&amp;void 0!==i||(t=i=e),new r(this.x*e,this.y*t,this.z*i))},scaleSelf:function(e,t,i){return n.XYZ(e)?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):(void 0!==t&amp;&amp;void 0!==i||(t=i=e),this.x*=e,this.y*=t,this.z*=i,this)},set:function(e,t,i){return n.XYZ(e)?(this.x=e.x,this.y=e.y,this.z=e.z,this):(void 0!==t&amp;&amp;void 0!==i||(t=i=e),this.x=e,this.y=t,this.z=i,this)},setXY:function(e){return this.x=e.x,this.y=e.y,this},shuffle:function(e){for(var t,i=0;i&lt;e;i++)switch(Math.floor(3*Math.random())){case 0:t=this.x,this.x=this.y,this.z=t;break;case 1:t=this.x,this.x=this.z,this.z=t;break;case 2:t=this.y,this.y=this.z,this.z=t}return this},signum:function(){return this.x=this.x&lt;0?-1:0===this.x?0:1,this.y=this.y&lt;0?-1:0===this.y?0:1,this.z=this.z&lt;0?-1:0===this.z?0:1,this},sub:function(e,t,i){return n.XYZ(e)?new r(this.x-e.x,this.y-e.y,this.z-e.z):(void 0!==t&amp;&amp;void 0!==i||(t=i=e),new r(this.x-e,this.y-t,this.z-i))},subSelf:function(e,t,i){return n.XYZ(e)?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):(void 0!==t&amp;&amp;void 0!==i||(t=i=e),this.x-=e,this.y-=t,this.z-=i,this)},to2DXY:function(){return new s(this.x,this.y)},to2DXZ:function(){return new s(this.x,this.z)},to2DYZ:function(){return new s(this.y,this.z)},toArray:function(){return[this.x,this.y,this.z]},toArray4:function(e){var t=this.toArray();return t[3]=e,t},toCartesian:function(){var e=this.x*Math.cos(this.z),t=e*Math.cos(this.y),i=this.x*Math.sin(this.z),s=e*Math.sin(this.y);return this.x=t,this.y=i,this.z=s,this},toSpherical:function(){var e=Math.abs(this.x)&lt;=o.EPS?o.EPS:this.x,t=this.z,i=Math.sqrt(e*e+this.y*this.y+t*t);return this.z=Math.asin(this.y/i),this.y=Math.atan(t/e)+(e&lt;0?Math.PI:0),this.x=i,this},toString:function(){return"[ x: "+this.x+", y: "+this.y+", z: "+this.z+"]"}},r.MIN_VALUE=new r(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),r.MAX_VALUE=new r(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r.fromXYTheta=function(e){return new r(Math.cos(e),Math.sin(e),0)},r.fromXZTheta=function(e){return new r(Math.cos(e),0,Math.sin(e))},r.fromYZTheta=function(e){return new r(0,Math.cos(e),Math.sin(e))},r.max=function(e,t){return new r(Math.max(e.x,t.x),Math.max(e.y,t.y),Math.max(e.z,t.z))},r.min=function(e,t){return new r(Math.min(e.x,t.x),Math.min(e.y,t.y),Math.min(e.z,t.z))},r.randomVector=function(){return new r(2*Math.random()-1,2*Math.random()-1,2*Math.random()-1).normalize()},r.ZERO=new r(0,0,0),r.X_AXIS=new r(1,0,0),r.Y_AXIS=new r(0,1,0),r.Z_AXIS=new r(0,0,1),r.Axis={X:{getVector:function(){return r.X_AXIS},toString:function(){return"Vec3D.Axis.X"}},Y:{getVector:function(){return r.Y_AXIS},toString:function(){return"Vec3D.Axis.Y"}},Z:{getVector:function(){return r.Z_AXIS},toString:function(){return"Vec3D.Axis.Z"}}},t.Vec2D=s,t.Vec3D=r},150:function(e,t,i){var s=i(134),r=i(166),o=function(e,t){this.a=e,this.b=t};o.prototype={constructor:o,closestLineTo:function(e){var t=e.a.sub(e.b);if(t.isZeroVector())return new o.LineIntersection(o.LineIntersection.Type.NON_INTERSECTING);var i=this.b.sub(this.a);if(i.isZeroVector())return new o.LineIntersection(o.LineIntersection.Type.NON_INTERSECTING);var r=this.a.sub(e.a),n=r.x*t.x+r.y*t.y+r.z*t.z,a=t.x*i.x+t.y*i.y+t.z*i.z,h=r.x*i.x+r.y*i.y+r.z*i.z,d=t.x*t.x+t.y*t.y+t.z*t.z,l=(i.x*i.x+i.y*i.y+i.z*i.z)*d-a*a;if(Math.abs(l)&lt;s.EPS)return new o.LineIntersection(o.LineIntersection.Type.NON_INTERSECTING);var u=(n*a-h*d)/l,f=(n+a*u)/d,c=this.a.add(i.scaleSelf(u)),m=e.a.add(t.scaleSelf(f));return new o.LineIntersection(o.LineIntersection.Type.INTERSECTING,new o(c,m),u,f)},closestPointTo:function(e){var t=this.b.sub(this.a),i=e.sub(this.a).dot(t)/t.magSquared();return i&lt;0?this.a.copy():i&gt;1?this.b.copy():this.a.add(t.scaleSelf(i))},copy:function(){return new o(this.a.copy(),this.b.copy())},equals:function(e){return this==e||typeof e==o&amp;&amp;((this.a.equals(e.a)||this.a.equals(l.b))&amp;&amp;(this.b.equals(l.b)||this.b.equals(l.a)))},getDirection:function(){return this.b.sub(this.a).normalize()},getLength:function(){return this.a.distanceTo(this.b)},getLengthSquared:function(){return this.a.distanceToSquared(this.b)},getMidPoint:function(){return this.a.add(this.b).scaleSelf(.5)},getNormal:function(){return this.b.cross(this.a)},hasEndPoint:function(e){return this.a.equals(e)||this.b.equals(e)},offsetAndGrowBy:function(e,t,i){var s=this.getMidPoint(),r=this.getDirection(),o=this.a.cross(r).normalize();return void 0!==i&amp;&amp;s.sub(i).dot(o)&lt;0&amp;&amp;o.invert(),o.normalizeTo(e),this.a.addSelf(o),this.b.addSelf(o),r.scaleSelf(t),this.a.subSelf(r),this.b.addSelf(r),this},set:function(e,t){return this.a=e,this.b=t,this},splitIntoSegments:function(e,t,i){return o.splitIntoSegments(this.a,this.b,t,e,i)},toRay3D:function(){return new r(this.a.copy(),this.getDirection())},toString:function(){return this.a.toString()+" -&gt; "+this.b.toString()}},o.splitIntoSegments=function(e,t,i,s,r){void 0===s&amp;&amp;(s=[]),r&amp;&amp;s.push(e.copy());var o=e.distanceTo(t);if(o&gt;i)for(var n=e.copy(),a=t.sub(e).limit(i);o&gt;i;)n.addSelf(a),s.push(n.copy()),o-=i;return s.push(t.copy()),s},(o.LineIntersection=function(e,t,i,s){this.type=e,void 0===i&amp;&amp;(i=0),void 0===s&amp;&amp;(s=0),this.line=t,this.coeff=[i,s]}).prototype={getCoefficient:function(){return this.coeff},getLength:function(){if(void 0!==this.line)return this.line.getLength()},getLine:function(){if(void 0!==this.line)return this.line.copy()},getType:function(){return this.type},isIntersectionInside:function(){return this.type==o.LineIntersection.Type.INTERSECTING&amp;&amp;this.coeff[0]&gt;=0&amp;&amp;this.coeff[0]&lt;=1&amp;&amp;this.coeff[1]&gt;=0&amp;&amp;this.coeff[1]&lt;=1},toString:function(){return"type: "+this.type+" line: "+this.line}},o.LineIntersection.Type={NON_INTERSECTING:0,INTERSECTING:1},e.exports=o},151:function(e,t,i){e.exports=i(156).TriangleMesh},152:function(e,t,i){i(189);var s=i(132),r=i(134),o=function(e,t){this.a=e,this.b=t};o.prototype={constructor:o,classifyPoint:function(e){var t=this.b.sub(this.a).perpendicular(),i=e.sub(this.a).dot(t);return r.sign(i)},closestPointTo:function(e){var t=this.b.sub(this.a),i=e.sub(this.a).dot(t)/t.magSquared();return i&lt;0?this.a.copy():i&gt;1?this.b.copy():this.a.add(t.scaleSelf(i))},copy:function(){return new o(this.a.copy(),this.b.copy())},distanceToPoint:function(e){return this.closestPointTo(e).distanceTo(e)},distanceToPointSquared:function(e){return this.closestPointTo(e).distanceToSquared(e)},equals:function(e){if(this==e)return!0;if(!s.is.Line2D(e))return!1;var t=e;return(this.a.equals(t.a)||this.a.equals(t.b))&amp;&amp;(this.b.equals(t.b)||this.b.equals(t.a))},getDirection:function(){return this.b.sub(this.a).normalize()},getHeading:function(){return this.b.sub(this.a).heading()},getLength:function(){return this.a.distanceTo(this.b)},getLengthSquared:function(){return this.a.distanceToSquared(this.b)},getMidPoint:function(){return this.a.add(this.b).scaleSelf(.5)},getNormal:function(){return this.b.sub(this.a).perpendicular()},getTheta:function(){return this.a.angleBetween(this.b,!0)},hasEndPoint:function(e){return this.a.equals(e)||this.b.equals(e)},intersectLine:function(e){var t,i=o.LineIntersection.Type,s=(e.b.y-e.a.y)*(this.b.x-this.a.x)-(e.b.x-e.a.x)*(this.b.y-this.a.y),r=(e.b.x-e.a.x)*(this.a.y-e.a.y)-(e.b.y-e.a.y)*(this.a.x-e.a.x),n=(this.b.x-this.a.x)*(this.a.y-e.a.y)-(this.b.y-this.a.y)*(this.a.x-e.a.x);if(0!==s){var a=r/s,h=n/s,d=this.a.interpolateTo(this.b,a);t=new o.LineIntersection(a&gt;=0&amp;&amp;a&lt;=1&amp;&amp;h&gt;=0&amp;&amp;h&lt;=1?i.INTERSECTING:i.NON_INTERSECTING,d,a,h)}else t=0===r&amp;&amp;0===n?0===this.distanceToPoint(e.a)?new o.LineIntersection(i.COINCIDENT,void 0):new o.LineIntersection(i.COINCIDENT_NO_INTERSECT,void 0):new o.LineIntersection(i.PARALLEL,void 0);return t},offsetAndGrowBy:function(e,t,i){var s=this.getMidPoint(),r=this.getDirection(),o=r.getPerpendicular();return void 0!==i&amp;&amp;s.sub(i).dot(o)&lt;0&amp;&amp;o.invert(),o.normalizeTo(e),this.a.addSelf(o),this.b.addSelf(o),r.scaleSelf(t),this.a.subSelf(r),this.b.addSelf(r),this},scale:function(e){var t=.5*(1-e),i=this.a.interpolateTo(this.b,t);return this.b.interpolateToSelf(this.a,t),this.a.set(i),this},set:function(e,t){return this.a=e,this.b=t,this},splitIntoSegments:function(e,t,i){return o.splitIntoSegments(this.a,this.b,t,e,i)},toRay2D:function(){return new(i(189))(this.a.copy(),this.b.sub(this.a).normalize())}},o.splitIntoSegments=function(e,t,i,s,r){void 0===s&amp;&amp;(s=[]),r&amp;&amp;s.push(e.copy());var o=e.distanceTo(t);if(o&gt;i)for(var n=e.copy(),a=t.sub(e).limit(i);o&gt;i;)n.addSelf(a),s.push(n.copy()),o-=i;return s.push(t.copy()),s},(o.LineIntersection=function(e,t,i,s){this.type=e,this.pos=t,this.coeff=[i,s]}).prototype={getPos:function(){return this.pos?this.pos.copy():void 0},getCoefficients:function(){return this.coeff},getType:function(){return this.type},toString:function(){return"type: "+this.type+" pos: "+this.pos}},o.LineIntersection.Type={COINCIDENT:0,COINCIDENT_NO_INTERSECT:4,PARALLEL:1,NON_INTERSECTING:2,INTERSECTING:3},e.exports=o},156:function(e,t,s){var r,o,n,a,h=function(e){return Math.floor(1e6*e)/1e6};function d(e){return"[ x: "+h(e.x)+", y: "+h(e.y)+", z: "+h(e.z)+"]"}function l(e){return e.a.id+"-&gt;"+e.b.id}!function(){var e=s(132),t=s(134),n=s(184),a=s(185),h=s(136),l=s(159),u=s(217),c=s(218),m=s(186);(r=function(e){return void 0===e&amp;&amp;(e="untitled"),this.init(e),this}).__vertexKeyGenerator=d,r.DEFAULT_NUM_VERTICES=1e3,r.DEFAULT_NUM_FACES=3e3,r.DEFAULT_STRIDE=4,r.prototype={addFace:function(e,t,i,s,r,o,n){6==arguments.length&amp;&amp;(n=o,o=r,r=s,s=void 0);var h=this.__checkVertex(e),d=this.__checkVertex(t),l=this.__checkVertex(i);if(h.id===d.id||h.id===l.id||d.id===l.id);else{if(null!=s){var u=h.sub(l).crossSelf(h.sub(d));if(s.dot(u)&lt;0){var f=h;h=d,d=f}}var c=new a(h,d,l,r,o,n);this.faces.push(c)}return this},addMesh:function(e){for(var t=e.getFaces().length,i=0;i&lt;t;i++){var s=e.getFaces()[i];this.addFace(s.a,s.b,s.c)}return this},center:function(e){this.computeCentroid();for(var t=null!=e?e.sub(this.centroid):this.centroid.getInverted(),i=this.vertices.length,s=0;s&lt;i;s++){this.vertices[s].addSelf(t)}return this.getBoundingBox()},__checkVertex:function(e){var t=this.vertexMap.get(e);return t||(t=this._createVertex(e,this.uniqueVertexID++),this.vertexMap.put(t,t)),t},clear:function(){return this.vertexMap=new e.LinkedMap(d),this.vertices=this.vertexMap.getArray(),this.faces=[],this.bounds=void 0,this},computeCentroid:function(){this.centroid.clear();for(var e=this.vertices.length,t=0;t&lt;e;t++)this.centroid.addSelf(this.vertices[t]);return this.centroid.scaleSelf(1/this.vertexMap.size()).copy()},computeFaceNormals:function(){for(var e=this.faces.length,t=0;t&lt;e;t++)this.faces[t].computeNormal()},computeVertexNormals:function(){var e=this.vertices.length,t=0;for(t=0;t&lt;e;t++)this.vertices[t].clearNormal();for(e=this.faces.length,t=0;t&lt;e;t++){var i=this.faces[t];i.a.addFaceNormal(i.normal),i.b.addFaceNormal(i.normal),i.c.addFaceNormal(i.normal)}for(e=this.vertices.length,t=0;t&lt;e;t++)this.vertices[t].computeNormal();return this},copy:function(){for(var e=new r(this.name+"-copy",this.vertexMap.size(),this.faces.length),t=this.faces.length,i=0;i&lt;t;i++){var s=this.faces[i];e.addFace(s.a,s.b,s.c,s.normal,s.uvA,s.uvB,s.uvC)}return e},_createVertex:function(e,t){return new m(e,t)},faceOutwards:function(){this.computeCentroid();for(var e=this.faces.length,t=0;t&lt;e;t++){var i=this.faces[t];i.getCentroid().sub(this.centroid).dot(i.normal)&lt;0&amp;&amp;i.flipVertexOrder()}return this},flipVertexOrder:function(){for(var e,t=this.faces.length,i=0;i&lt;t;i++){var s=this.faces[i],r=s.a;s.a=s.b,s.b=r,s.uvA&amp;&amp;(e=s.uvA,s.uvA=s.uvB,s.uvB=e),s.normal.invert()}return this},flipYAxis:function(){return this.transform((new n).scaleSelf(1,-1,1)),this.flipVertexOrder(),this},getBoundingBox:function(){for(var e=s(182),t=h.MAX_VALUE.copy(),i=h.MIN_VALUE.copy(),r=this.vertices.length,o=0;o&lt;r;o++){var n=this.vertices[o];t.minSelf(n),i.maxSelf(n)}return this.bounds=e.fromMinMax(t,i),this.bounds},getBoundingSphere:function(){var e=s(187),i=0;this.computeCentroid();for(var r=this.vertices.length,o=0;o&lt;r;o++){var n=this.vertices[o];i=t.max(i,n.distanceToSquared(this.centroid))}return new e(this.centroid,Math.sqrt(i))},getClosestVertexToPoint:function(e){for(var t,i=Number.MAX_VALUE,s=this.vertices.length,r=0;r&lt;s;r++){var o=this.vertices[r],n=o.distanceToSquared(e);n&lt;i&amp;&amp;(t=o,i=n)}return t},getFaceNormalsAsArray:function(e,i,s){if(0===arguments.length)e=void 0,i=0,s=r.DEFAULT_STRIDE;else if(1==arguments.length&amp;&amp;"object"==typeof arguments[0]){var o=arguments[0];e=o.normals,i=o.offset,s=o.stride}s=t.max(s,3),void 0===e&amp;&amp;(e=[]);for(var n=i,a=this.faces.length,h=0;h&lt;a;h++){var d=this.faces[h];e[n]=d.normal.x,e[n+1]=d.normal.y,e[n+2]=d.normal.z,e[n+=s]=d.normal.x,e[n+1]=d.normal.y,e[n+2]=d.normal.z,e[n+=s]=d.normal.x,e[n+1]=d.normal.y,e[n+2]=d.normal.z,n+=s}return e},getFaces:function(){return this.faces},getFacesAsArray:function(e){e=e||[];for(var t=0,i=this.faces.length,s=0;s&lt;i;s++){var r=this.faces[s];e[t++]=r.a.id,e[t++]=r.b.id,e[t++]=r.c.id}return e},getIntersectionData:function(){return this.intersector.getIntersectionData()},getMeshAsVertexArray:function(e,i,s){void 0===e&amp;&amp;(e=void 0),void 0===i&amp;&amp;(i=0),void 0===s&amp;&amp;(s=r.DEFAULT_STRIDE),s=t.max(s,3),void 0===e&amp;&amp;(e=[]);for(var o=0,n=this.faces.length,a=0;a&lt;n;++a){var h=this.faces[a];e[o]=h.a.x,e[o+1]=h.a.y,e[o+2]=h.a.z,e[o+=s]=h.b.x,e[o+1]=h.b.y,e[o+2]=h.b.z,e[o+=s]=h.c.x,e[o+1]=h.c.y,e[o+2]=h.c.z,o+=s}return e},getNumFaces:function(){return this.faces.length},getNumVertices:function(){return this.vertexMap.size()},getRotatedAroundAxis:function(e,t){return this.copy().rotateAroundAxis(e,t)},getRotatedX:function(e){return this.copy().rotateX(e)},getRotatedY:function(e){return this.copy().rotateY(e)},getRotatedZ:function(e){return this.copy().rotateZ(e)},getScaled:function(e){return this.copy().scale(e)},getTranslated:function(e){return this.copy().translate(e)},getUniqueVerticesAsArray:function(e){e=e||[];for(var t=0,i=this.vertices.length,s=0;s&lt;i;s++){var r=this.vertices[s];e[t++]=r.x,e[t++]=r.y,e[t++]=r.z}return e},getUniqueVertexNormalsAsArray:function(e){e=e||[];var t=0;for(i=0;i&lt;this.vertices.length;i++){var s=this.vertices[i];e[t++]=s.normal.x,e[t++]=s.normal.y,e[t++]=s.normal.z}return e},getUVsAsArray:function(e){e=e||[];var t=0;for(f=0;f&lt;this.faces.length;f++){var i=this.faces[f];e[t++]=i.uvA?i.uvA.x:0,e[t++]=i.uvA?i.uvA.y:0,e[t++]=i.uvB?i.uvB.x:0,e[t++]=i.uvB?i.uvB.y:0,e[t++]=i.uvC?i.uvC.x:0,e[t++]=i.uvC?i.uvC.y:0}return e},getVertexAtPoint:function(e){for(var t,i=0;i&lt;this.vertices.length;i++)this.vertices[i].equals(e)&amp;&amp;(t=i);return this.vertices[t]},getVertexIndex:function(e){for(var t=-1,i=this.vertices.length,s=0;s&lt;i;s++){this.vertices[s].equals(e)&amp;&amp;(t=s)}return t},getVertexForID:function(e){for(var t,i=this.vertices.length,s=0;s&lt;i;s++){var r=this.vertices[s];if(r.id==e){t=r;break}}return t},getVertexNormalsAsArray:function(e,i,s){void 0===i&amp;&amp;(i=0),void 0===s&amp;&amp;(s=r.DEFAULT_STRIDE),s=t.max(s,3),void 0===e&amp;&amp;(e=[]);for(var o=i,n=this.faces.length,a=0;a&lt;n;a++){var h=this.faces[a];e[o]=h.a.normal.x,e[o+1]=h.a.normal.y,e[o+2]=h.a.normal.z,e[o+=s]=h.b.normal.x,e[o+1]=h.b.normal.y,e[o+2]=h.b.normal.z,e[o+=s]=h.c.normal.x,e[o+1]=h.c.normal.y,e[o+2]=h.c.normal.z,o+=s}return e},getVertices:function(){return this.vertices},handleSaveAsSTL:function(e,t){throw new Error("TriangleMesh.handleSaveAsSTL() currently not implemented")},init:function(t){this.setName(t),this.matrix=new n,this.centroid=new h,this.vertexMap=new e.LinkedMap(d),this.vertices=this.vertexMap.getArray(),this.faces=[],this.uniqueVertexID=0,this.intersector=new u},intersectsRay:function(e){for(var t,i=this.intersector.getTriangle(),s=this.faces.length,r=0;r&lt;s;r++)if(t=this.faces[r],i.a=t.a,i.b=t.b,i.c=t.c,this.intersector.intersectsRay(e))return!0;return!1},perforateFace:function(e,t){var i=e.getCentroid(),s=1-t,r=e.a.interpolateTo(i,s),o=e.b.interpolateTo(i,s),n=e.c.interpolateTo(i,s);return this.removeFace(e),this.addFace(e.a,o,r),this.addFace(e.a,e.b,o),this.addFace(e.b,n,o),this.addFace(e.b,e.c,n),this.addFace(e.c,r,n),this.addFace(e.c,e.a,r),new l(r,o,n)},pointTowards:function(e,t){return t=t||h.Z_AXIS,this.transform(c.getAlignmentQuat(e,t).toMatrix4x4(this.matrix),!0)},removeFace:function(e){for(var t=-1,i=this.faces.length,s=0;s&lt;i;s++)if(this.faces[s]==e){t=s;break}t&gt;-1&amp;&amp;this.faces.splice(t,1)},rotateAroundAxis:function(e,t){return this.transform(this.matrix.identity().rotateAroundAxis(e,t))},rotateX:function(e){return this.transform(this.matrix.identity().rotateX(e))},rotateY:function(e){return this.transform(this.matrix.identity().rotateY(e))},rotateZ:function(e){return this.transform(this.matrix.identity().rotateZ(e))},saveAsOBJ:function(e,t){void 0===t&amp;&amp;(t=!0);var i=e.getCurrVertexOffset()+1,s=e.getCurrNormalOffset()+1;e.newObject(this.name);var r,o=0,n=0,a=this.vertices.length,h=this.faces.length;for(o=0;o&lt;a;o++)e.vertex(this.vertices[o]);if(t){for(o=0;o&lt;a;o++)e.normal(this.vertices[o].normal);for(n=0;n&lt;h;n++)r=this.faces[n],e.faceWithNormals(r.b.id+i,r.a.id+i,r.c.id+i,r.b.id+s,r.a.id+s,r.c.id+s)}else for(n=0;n&lt;h;n++)r=this.faces[n],e.face(r.b.id+i,r.a.id+i,r.c.id+i)},saveAsSTL:function(e,t,i){throw new Error("TriangleMesh.saveAsSTL() currently not implemented")},scale:function(e){return this.transform(this.matrix.identity().scaleSelf(e))},setName:function(e){return this.name=e,this},toString:function(){return"TriangleMesh: "+this.name+" vertices: "+this.getNumVertices()+" faces: "+this.getNumFaces()},toWEMesh:function(){return new o(this.name).addMesh(this)},transform:function(e,t){void 0===t&amp;&amp;(t=!0);for(var i=this.vertices.length,s=0;s&lt;i;s++){var r=this.vertices[s];r.set(e.applyTo(r))}return t&amp;&amp;this.computeFaceNormals(),this},translate:function(e,t,i){return 1==arguments.length&amp;&amp;(t=e.y,i=e.z,e=e.x),this.transform(this.matrix.identity().translateSelf(e,t,i))},updateVertex:function(e,t){var i=this.vertexMap.get(e);return void 0!==i&amp;&amp;(this.vertexMap.remove(i),i.set(t),this.vertexMap.put(t,i)),this}}}(),function(e){var t,i=s(132),r=s(150),n=s(136),a=s(186).WEVertex,h=s(185).WEFace,u=s(579),f=s(580);(o=function(t){t=t||"untitled",e.call(this,t)}).DEFAULT_NUM_FACES=e.DEFAULT_NUM_FACES,o.DEFAULT_NUM_VERTICES=e.DEFAULT_NUM_VERTICES,i.extend(o,e),(t=o.prototype).addFace=function(e,t,i,s,r,o,n){6===arguments.length&amp;&amp;(n=o,o=r,r=s,s=void 0);var a,d,l,u=this.__checkVertex(e),f=this.__checkVertex(t),c=this.__checkVertex(i);return u.id===f.id||u.id===c.id||f.id===c.id?console.log("Ignoring invalid face: "+e+","+t+","+i):(void 0!==s&amp;&amp;null!==s&amp;&amp;(a=u.sub(c).crossSelf(u.sub(f)),s.dot(a)&lt;0&amp;&amp;(d=u,u=f,f=d)),l=new h(u,f,c,r,o,n),this.faces.push(l),this.updateEdge(u,f,l),this.updateEdge(f,c,l),this.updateEdge(c,u,l)),this},t.center=function(t,i){e.prototype.center.call(this,t,i),this.rebuildIndex()},t.clear=function(){return e.prototype.clear.call(this),this.edgeMap=new i.LinkedMap(l),this.edges=this.edgeMap.getArray(),this},t.copy=function(){var e,t,i,s=new o(this.name+"-copy");for(t=this.faces.length,e=0;e&lt;t;e++)i=this.faces[e],s.addFace(i.a,i.b,i.c,i.normal,i.uvA,i.uvB,i.uvC);return s},t._createVertex=function(e,t){return new a(e,t)},t.getNumEdges=function(){return this.edgeMap.size()},t.init=function(t){e.prototype.init.call(this,t),this.edgeMap=new i.LinkedMap(l),this.edges=this.edgeMap.getArray(),this.__edgeCheck=new r(new n,new n),this.__uniqueEdgeID=0},t.rebuildIndex=function(){var e=new i.LinkedMap(d),t=new i.LinkedMap(l),s=0,r=this.vertexMap.getArray();for(s=0;s&lt;r.length;s++)e.put(r[s],r[s]);for(r=this.edgeMap.getArray(),s=0;s&lt;r.length;s++)t.put(r[s],r[s]);this.vertexMap=e,this.vertices=e.getArray(),this.edgeMap=t,this.edges=t.getArray()},t.removeEdge=function(e){e.remove();var t=e.a;0===t.edges.length&amp;&amp;this.vertexMap.remove(t),0===(t=e.b).edges.length&amp;&amp;this.vertexMap.remove(t);for(var i=0;i&lt;e.faces.length;i++)this.removeFace(e.faces[i]);var s=this.edgeMap.remove(this.__edgeCheck.set(e.a,e.b));if(s||this.edgeMap.remove(this.__edgeCheck.set(e.b,e.a)),s!==e)throw new Error("Can't remove edge")},t.removeFace=function(e){var t,i=this.faces.indexOf(e);for(i&gt;-1&amp;&amp;this.faces.splice(i,1),i=0,i=0;i&lt;e.edges.length;i++)(t=e.edges[i]).faces.splice(t.faces.indexOf(e),1),0===t.faces.length&amp;&amp;this.removeEdge(t)},t.removeUnusedVertices=function(){i.each(this.vertices,(function(e,t){var s=!1;i.each(this.faces,(function(t){t.a!=e&amp;&amp;t.b!=e&amp;&amp;t.c!=e||(s=!0)})),s||this.vertices.splice(t,1)}))},t.removeVertices=function(e){i.each(e,(function(e){i.each(e.edges,(function(e){i.each(e.faces,(function(e){this.removeFace(e)}))}))}))},t.splitEdge=function(e,t,i){var s,r;3===arguments.length?(s=this.edgeMap.get(this.__edgeCheck.set(e,t)))||this.edgeMap.get(this.__edgeCheck.set(t,e)):2==arguments.length&amp;&amp;(s=e,i=t),r=i.computeSplitPoints(s),this.splitFace(s.faces[0],s,r),s.faces.length&gt;1&amp;&amp;this.splitFace(s.faces[1],s,r),this.removeEdge(s)},t.splitFace=function(e,t,i){var s,r,o,n,a,h;for(r=0;r&lt;3;r++)if(!(o=e.edges[r]).equals(t)){s=o.a.equals(t.a)||o.a.equals(t.b)?o.b:o.a;break}for(a=i.length,r=0;r&lt;a;r++)h=i[r],0===r?this.addFace(s,t.a,h,e.normal):this.addFace(s,n,h,e.normal),r===a-1&amp;&amp;this.addFace(s,h,t.b,e.normal),n=h},t.subdivide=function(e,t){1===arguments.length&amp;&amp;(t=e,e=new f),this.subdivideEdges(this.edges.slice(0),e,t)},t.subdivideEdges=function(e,t,i){e.sort(t.getEdgeOrdering()),i*=i;var s=0,r=e.length;for(s=0;s&lt;r;s++){var o=e[s];this.edges.indexOf(o)&gt;-1&amp;&amp;o.getLengthSquared()&gt;=i&amp;&amp;this.splitEdge(o,t)}},t.subdivideFaceEdges=function(e,t,i){var s,r,o,n,a,h,d=[];for(a=this.faces.length,s=0;s&lt;a;s++)for(h=(o=this.faces[s]).edges.length,r=0;r&lt;h;r++)n=o.edges[r],d.indexOf(n)&lt;0&amp;&amp;d.push(n);this.subdividEdges(d,t,i)},t.toString=function(){return"WETriangleMesh: "+this.name+" vertices: "+this.getNumVertices()+" faces: "+this.getNumFaces()+" edges:"+this.getNumEdges()},t.transform=function(e,t){void 0!==t&amp;&amp;null!==t||(t=!0);for(var i=0,s=this.vertices.length;i&lt;s;i++)e.applyToSelf(this.vertices[i]);return this.rebuildIndex(),t&amp;&amp;this.computeFaceNormals(),this},t.updateEdge=function(e,t,i){this.__edgeCheck.set(e,t);var s=this.edgeMap.get(this.__edgeCheck);s||(this.__edgeCheck.set(t,e),s=this.edgeMap.get(this.__edgeCheck)),void 0!==s?s.addFace(i):(s=new u(e,t,i,this.__uniqueEdgeID++),this.edgeMap.put(s,s),e.addEdge(s),t.addEdge(s)),i.addEdge(s)}}(r),function(e){var t=s(132),i=s(134),r=s(583),o=s(166),a=s(217),h=s(159),d=s(167),l=s(149).Vec2D,u=s(149).Vec3D;(n=function(e,i,s){this.width=e,this._depth=i,t.has.XY(s)||(s=new l(s,s)),this.setScale(s),this.elevation=[];var r=0,o=e*i;for(r=0;r&lt;o;r++)this.elevation[r]=0;this.__elevationLength=this.width*this._depth,this.vertices=[];var n=new u(parseInt(this.width/2,10),0,parseInt(this._depth/2,10)),a=this.getScale().to3DXZ();r=0;for(var h=0;h&lt;this._depth;h++)for(var d=0;d&lt;this.width;d++)this.vertices[r++]=new u(d,0,h).subSelf(n).scaleSelf(a)}).prototype={getDepth:function(){return this._depth},getElevation:function(){return this.elevation},getHeightAtCell:function(e,t){return this.elevation[this._getIndex(e,t)]},getHeightAtPoint:function(e,t){var i=e/this._scale.x+.5*this.width,s=t/this._scale.y+.5*this._depth,o=0,n=~~e,a=~~s;if(i&gt;=0&amp;i&lt;this.width&amp;&amp;s&gt;=0&amp;&amp;s&lt;this._depth){var h=~~Math.min(i+1,this.width-1),d=~~Math.min(s+1,this._depth-1),l=this.getHeightAtCell(n,a),u=this.getHeightAtCell(h,a),f=this.getHeightAtCell(n,d),c=this.getHeightAtCell(h,d);o=r.bilinear(i,s,n,a,h,d,l,u,f,c)}return o},_getIndex:function(e,t){var i=t*this.width+e;if(i&lt;0||i&gt;this.__elevationLength)throw new Error("the given terrain cell is invalid: "+e+";"+t);return i},getScale:function(){return this._scale},getVertexAtCell:function(e,t){return this.vertices[this._getIndex(e,t)]},getWidth:function(){return this.width},intersectAtPoint:function(e,t){var i=e/this._scale.x+.5*this.width,s=t/this._scale.y+.5*this._depth,r=new d;if(i&gt;=0&amp;&amp;i&lt;this.width&amp;&amp;s&gt;=0&amp;&amp;s&lt;this._depth){var n=~~Math.min(i+1,this.width-1),l=~~Math.min(s+1,this._depth-1),f=~~i,c=~~s,m=this.getVertexAtCell(f,c),_=this.getVertexAtCell(n,c),p=this.getVertexAtCell(n,l),x=this.getVertexAtCell(f,l),g=new o(new u(e,1e4,t),new u(0,-1,0)),v=new a(new h(m,_,x));v.intersectsRay(g)||(v.setTriangle(new h(_,p,x)),v.intersectsRay(g)),r=v.getIntersectionData()}return r},setElevation:function(e){if(this.__elevationLength!=e.length)throw new Error("the given elevation array size does not match terrain");for(var t=0,i=e.length;t&lt;i;t++)this.vertices[t].y=this.elevation[t]=e[t];return this},setHeightAtCell:function(e,t,i){var s=this._getIndex(e,t);return this.elevation[s]=i,this.vertices[s].y=i,this},setScale:function(e){t.has.XY(e)||(e=new l(e,e)),this._scale=e},toMesh:function(){var t={mesh:void 0,minX:0,minZ:0,maxX:this.width,maxZ:this._depth},s=this.vertices,r=this.width,o=this._depth;if(1==arguments.length&amp;&amp;"object"==typeof arguments[0]){var n=arguments[0];t.mesh=n.mesh||new e("terrain"),t.minX=n.minX||t.minX,t.minZ=n.minZ||t.minZ,t.maxX=n.maxX||t.maxX,t.maxZ=n.maxZ||t.maxZ}else arguments.length&gt;=5&amp;&amp;(t.mesh=arguments[0],t.minX=arguments[1],t.minZ=arguments[2],t.maxX=arguments[3],t.maxZ=arguments[4]);t.mesh=t.mesh||new e("terrain"),t.minX=i.clip(t.minX,0,r-1),t.maxX=i.clip(t.maxX,0,r),t.minZ=i.clip(t.minZ,0,o-1),t.maxZ=i.clip(t.maxZ,0,o),t.minX++,t.minZ++;for(var a=t.minZ,h=t.minX*r;a&lt;t.maxZ;a++,h+=r)for(var d=t.minX;d&lt;t.maxX;d++)t.mesh.addFace(s[h-r+d-1],s[h-r+d],s[h+d-1]),t.mesh.addFace(s[h-r+d],s[h+d],s[h+d-1]);return t.mesh}}}(r),function(e){var t=s(136),i=s(143);(a=function(e){this.func=e}).prototype={createMesh:function(){var s={mesh:void 0,resolution:0,size:1,isClosed:!0};if(1==arguments.length)if("object"==typeof arguments[0]){var r=arguments[0];s.mesh=r.mesh,s.resolution=r.res||r.resoultion||0,void 0!==r.size&amp;&amp;(s.size=r.size),void 0!==r.isClosed&amp;&amp;(s.isClosed=r.isClosed)}else s.resolution=arguments[0];else arguments.length&gt;2&amp;&amp;(s.mesh=arguments[0],s.resolution=arguments[1],s.size=arguments[2],4==arguments.length&amp;&amp;(s.isClosed=arguments[3]));var o=s.mesh;void 0!==o&amp;&amp;null!==o||(o=new e);for(var n=new t,a=new t,h=new t,d=new t,l=new t,u=new t,f=this.func.getPhiResolutionLimit(s.resolution),c=this.func.getPhiRange(),m=this.func.getThetaResolutionLimit(s.resolution),_=this.func.getThetaRange(),p=1/f,x=1/m,g=1/s.resolution,v=new i,y=new i,b=new i,T=new i,S=0;S&lt;f;S++)for(var w=S*c*g,M=(S+1)*c*g,E=0;E&lt;=m;E++){var F=E*_*g,C=this.func;n=C.computeVertexFor(n,M,F).scaleSelf(s.size),b.set(E*x,1-(S+1)*p),a=C.computeVertexFor(a,w,F).scaleSelf(s.size),T.set(E*x,1-S*p),a.equalsWithTolerance(n,1e-4)&amp;&amp;a.set(n),E&gt;0?(E==m&amp;&amp;s.isClosed&amp;&amp;(n.set(l),a.set(u)),o.addFace(h,d,n,v.copy(),y.copy(),b.copy()),o.addFace(d,a,n,y.copy(),T.copy(),b.copy())):(l.set(n),u.set(a)),h.set(n),d.set(a),v.set(b),y.set(T)}return o},getFunction:function(){return this.func},setFunction:function(e){this.func=e}}}(r),t.TriangleMesh=r,t.WETriangleMesh=o,t.Terrain=n,t.SurfaceMeshBuilder=a},157:function(e,t,i){var s=i(134),r=i(143),o=i(152),n=(i(160),i(169),i(151)),a=i(148),h=i(146),d=function(){var e,t;if(this.vertices=[],arguments.length&gt;1)for(e=0,t=arguments.length;e&lt;t;e++)this.add(arguments[e].copy());else if(1==arguments.length){var i=arguments[0];if(h.Array(i))for(e=0,t=i.length;e&lt;t;e++)this.add(i[e].copy())}};d.prototype={constructor:d,add:function(e){if(h.Array(e))for(var t=0,i=e.length;t&lt;i;t++)this.vertices.indexOf(e[t])&lt;0&amp;&amp;this.vertices.push(e[t]);else this.vertices.indexOf(e)&lt;0&amp;&amp;this.vertices.push(e)},center:function(e){for(var t=this.getCentroid(),i=void 0!==e?e.sub(t):t.invert(),s=0,r=this.vertices.length;s&lt;r;s++)this.vertices[s].addSelf(i);return this},containsPoint:function(e){var t=this.vertices.length,i=0,s=t-1,r=!1,o=e.x,n=e.y;for(i=0;i&lt;t;i++){var a=this.vertices[i],h=this.vertices[s];(a.y&lt;n&amp;&amp;h.y&gt;=n||h.y&lt;n&amp;&amp;a.y&gt;=n)&amp;&amp;a.x+(n-a.y)/(h.y-a.y)*(h.x-a.x)&lt;o&amp;&amp;(r=!r),s=i}return r},containsPolygon:function(e){for(var t=0,i=e.vertices.length;t&lt;i;t++)if(!this.containsPoint(e.vertices[t]))return!1;return!0},copy:function(){return new d(this.vertices)},flipVertexOrder:function(){return this.vertices.reverse(),this},get:function(e){return e&lt;0&amp;&amp;(e+=this.vertices.length),this.vertices[e]},getApothem:function(){return this.vertices[0].interpolateTo(this.vertices[1],.5).distanceTo(this.getCentroid())},getArea:function(){for(var e=0,t=this.vertices.length,i=0;i&lt;t;i++){var s=this.vertices[i],r=this.vertices[(i+1)%t];e+=s.x*r.y,e-=s.y*r.x}return e*=.5},getBoundingCircle:function(){return i(160).newBoundingCircle(this.vertices)},getBounds:function(){return i(169).getBoundingRect(this.vertices)},getCentroid:function(){for(var e=new r,t=this.vertices.length,i=0;i&lt;t;i++){var s=this.vertices[i],o=this.vertices[(i+1)%t],n=s.x*o.y-o.x*s.y;e.x+=(s.x+o.x)*n,e.y+=(s.y+o.y)*n}return e.scale(1/(6*this.getArea()))},getCircumference:function(){for(var e=0,t=0,i=this.vertices.length;t&lt;i;t++)e+=this.vertices[t].distanceTo(this.vertices[(t+1)%i]);return e},getClosestPointTo:function(e){for(var t,i,s,r=Number.MAX_VALUE,o=this.getEdges(),n=0,a=o.length;n&lt;a;n++)(s=(i=o[n].closestPointTo(e)).distanceToSquared(e))&lt;r&amp;&amp;(t=i,r=s);return t},getClosestVertexTo:function(e){for(var t,i,s=Number.MAX_VALUE,r=0,o=this.vertices.length;r&lt;o;r++)(i=this.vertices[r].distanceToSquared(e))&lt;s&amp;&amp;(t=this.vertices[r],s=i);return t},getEdges:function(){for(var e=this.vertices.length,t=[],i=0;i&lt;e;i++)t[i]=new o(this.vertices[i],this.vertices[(i+1)%e]);return t},getNumPoints:function(){return this.getNumVertices()},getNumVertices:function(){return this.vertices.length},getRandomPoint:function(){for(var e,t=this.getEdges(),i=t.length,r=t[s.random(i)];void 0===e||e.equals(r);)e=t[s.random(i)];return r.a.interpolateTo(r.b,Math.random()).interpolateToSelf(e.a.interpolateTo(e.b,Math.random()),Math.random())},increaseVertexCount:function(e){for(var t,i,s=this.vertices.length,r=0,o=0,n=0;s&lt;e;){for(r=0,o=0,n=0;n&lt;s;n++)(t=this.vertices[n].distanceToSquared(this.vertices[(n+1)%s]))&gt;o&amp;&amp;(r=n,o=t);i=this.vertices[r].add(this.vertices[(r+1)%s]).scaleSelf(.5),this.vertices.splice(r+1,0,i),s++}return this},intersectsPolygon:function(e){if(this.containsPolygon(e))return!0;for(var t=this.getEdges(),i=e.getEdges(),s=0,r=t.length;s&lt;r;s++)for(var n=0,a=i.length,h=t[s];n&lt;a;n++)if(h.intersectLine(i[n]).getType()==o.LineIntersection.Type.INTERSECTING)return!0;return!1},isClockwise:function(){return this.getArea()&gt;0},isConvex:function(){for(var e,t,i,s,r,o=!1,n=this.vertices.length,a=0;a&lt;n;a++)if(e=0===a?n-1:a-1,t=a===n-1?0:a+1,i=this.vertices[a].sub(this.vertices[e]),s=this.vertices[t].sub(this.vertices[a]),r=i.cross(s)&gt;0,0===a)o=!0;else if(o!=r)return!1;return!0},_offsetCorner:function(e,t,i,n,a,h,d,l){var u,f,c,m,_,p,x,g,v=i,y=n,b=i,T=n;if(u=i-e,f=n-t,c=Math.sqrt(u*u+f*f),m=a-i,_=h-n,p=Math.sqrt(m*m+_*_),!(c&lt;s.EPS||p&lt;s.EPS))if(e+=x=f*(c=d/c),v+=x,t+=g=-u*c,y+=g,a+=x=_*(p=d/p),h+=g=-m*p,T+=g,v!==(b+=x)||y!==T){var S=new o(new r(e,t),new r(v,y)),w=new o(new r(b,T),new r(a,h)),M=S.intersectLine(w).getPos();null===M&amp;&amp;void 0===M||l.set(M)}else l.set(v,y)},offsetShape:function(e){var t=this.vertices,i=t.length-1;if(i&gt;1){for(var s,r,o=t[0].x,n=t[0].y,a=t[i].x,h=t[i].y,d=o,l=n,u=0;u&lt;i;u++)s=a,r=h,a=d,h=l,d=t[u+1].x,l=t[u+1].y,this._offsetCorner(s,r,a,h,d,l,e,t[u]);this._offsetCorner(a,h,d,l,o,n,e,t[i])}return this},reduceVertices:function(e){e*=e;var t,i=this.vertices,s=[],r=i[0],o=i.length-1;s.push(r);for(var n=0;n&lt;o;n++)t=i[n],r.distanceToSquared(t)&gt;=e&amp;&amp;(s.push(t),r=t);return i[0].distanceToSquared(i[o])&gt;=e&amp;&amp;s.push(i[o]),this.vertices=s,this},removeDuplicates:function(e){for(var t,i,s=e?"equalsWithTolerance":"equals",r=0,o=this.vertices.length;r&lt;o;r++)(t=this.vertices[r])[s](i,e)?(this.vertices.splice(r,1),r--,o--):i=t;return(o=this.vertices.length)&gt;0&amp;&amp;this.vertices[o-1][s](this.vertices[0],e)&amp;&amp;this.vertices.splice(o-1,1),this},rotate:function(e){for(var t=0,i=this.vertices.length;t&lt;i;t++)this.vertices[t].rotate(e);return this},scale:function(e,t){if(1==arguments.length){var i=arguments[0];a.XY(i)?(e=i.x,t=i.y):(e=i,t=i)}else{if(2!=arguments.length)throw"Invalid argument(s) passed.";e=arguments[0],t=arguments[1]}for(var s=0,r=this.vertices.length;s&lt;r;s++)this.vertices[s].scaleSelf(e,t);return this},scaleSize:function(e,t){var i;if(1===arguments.length){var s=arguments[0];a.XY(s)?(e=s.x,t=s.y):(e=s,t=s)}else{if(2!==arguments.length)throw new Error("Invalid argument(s) passed.");e=arguments[0],t=arguments[1]}i=this.getCentroid();for(var r=0,o=this.vertices.length;r&lt;o;r++){var n=this.vertices[r];n.subSelf(i).scaleSelf(e,t).addSelf(i)}return this},smooth:function(e,t){for(var i=this.getCentroid(),s=this.vertices.length,r=[],o=0,n=s-1,a=1;o&lt;s;o++){var h=this.vertices[o],d=this.vertices[n].sub(h).addSelf(this.vertices[a].sub(h)).addSelf(h.sub(i).scaleSelf(t));r.push(h.add(d.scaleSelf(e))),++n==s&amp;&amp;(n=0),++a==s&amp;&amp;(a=0)}return this.vertices=r,this},toMesh:function(e,t,i){e=e||new n;var s=this.vertices.length,o=(t=t||this.getCentroid()).to3DXY();o.z=i;for(var a,h,d,l,u=this.getBounds(),f=new r(1/u.width,1/u.height),c=t.sub(u.getTopLeft()).scaleSelf(f),m=1;m&lt;=s;m++)a=this.vertices[m%s],h=this.vertices[m-1],d=a.sub(u.getTopLeft()).scaleSelf(f),l=h.sub(u.getTopLeft()).scaleSelf(f),e.addFace(o,a.to3DXY(),h.to3DXY(),c,d,l);return e},toPolygon2D:function(){return this},toString:function(){for(var e="",t=0;t&lt;this.vertices.length;t++)e+=this.vertices[t],t&lt;this.vertices.length-1&amp;&amp;(e+=", ");return e},translate:function(){var e,t;if(1==arguments.length&amp;&amp;a.XY(arguments[0]))e=arguments[0].x,t=arguments[0].y;else{if(2!=arguments.length)throw"Invalid argument(s) passed.";e=arguments[0],t=arguments[1]}for(var i=0,s=this.vertices.length;i&lt;s;i++)this.vertices[i].addSelf(e,t);return this}},d.fromBaseEdge=function(e,t,i){for(var r,o=-(s.PI-s.PI*(i-2)/i),n=t.sub(e),a=t,h=new d(e,t),l=0;l&lt;i-1;l++)r=a.add(n.getRotated(o*l)),h.add(r),a=r;return h},d.fromEdgeLength=function(e,t){return new(i(160))(d.getRadiusForEdgeLength(e,t)).toPolygon2D(t)},d.getRadiusForEdgeLength=function(e,t){return e/(2*s.sin(s.PI/t))},e.exports=d},159:function(e,t,i){var s=i(134),r=i(136),o=i(150),n=i(182),h=function(e,t,i){this.a=e,this.b=t,this.c=i};h.createEquilateralFrom=function(e,t){var i=e.interpolateTo(t,.5),r=t.sub(e),o=e.cross(r.normalize());return i.addSelf(o.normalizeTo(r.magnitude()*s.SQRT3/2)),new h(e,t,i)},h.isClockwiseInXY=function(e,t,i){return(t.x-e.x)*(i.y-e.y)-(i.x-e.x)*(t.y-e.y)&lt;0},h.isClockwiseInXZ=function(e,t,i){return(t.x-e.x)*(i.z-e.z)-(i.x-e.x)*(t.z-e.z)&lt;0},h.isClockwiseInYZ=function(e,t,i){return(t.y-e.y)*(i.z-e.z)-(i.y-e.y)*(t.z-e.z)&lt;0},h.prototype={closestPointOnSurface:function(e){var t=this.b.sub(this.a),i=this.c.sub(this.a),s=this.c.sub(this.b),r=e.sub(this.a),o=e.sub(this.b),n=e.sub(this.c),h=a.sub(this.p),d=b.sub(this.p),l=c.sub(this.p),u=r.dot(t),f=r.dot(i);if(u&lt;=0&amp;&amp;f&lt;=0)return this.a;var m=o.dot(this.a.sub(this.b)),_=n.dot(this.a.sub(this.c)),p=o.dot(s),x=n.dot(this.b.sub(this.c));if(m&lt;=0&amp;&amp;p&lt;=0)return this.b;if(_&lt;=0&amp;&amp;x&lt;=0)return this.c;var g=t.cross(i),v=g.dot(h.crossSelf(d));if(v&lt;=0&amp;&amp;u&gt;=0&amp;&amp;m&gt;=0)return this.a.add(t.scaleSelf(u/(u+m)));var y=g.dot(d.crossSelf(l));if(y&lt;=0&amp;&amp;p&gt;=0&amp;&amp;x&gt;=0)return this.b.add(s.scaleSelf(p/(p+x)));var T=g.dot(l.crossSelf(h));if(T&lt;=0&amp;&amp;f&gt;=0&amp;&amp;_&gt;=0)return this.a.add(i.scaleSelf(f/(f+_)));var S=y/(y+T+v),w=T/(y+T+v),M=1-S-w;return this.a.scale(S).addSelf(this.b.scale(w)).addSelf(this.c.scale(M))},computeCentroid:function(){return this.centroid=this.a.add(this.b).addSelf(this.c).scaleSelf(1/3),this.centroid},computeNormal:function(){return this.normal=this.a.sub(this.c).crossSelf(this.a.sub(this.b)).normalize(),this.normal},containsPoint:function(e){if(e.equals(this.a)||e.equals(this.b)||e.equals(this.c))return!0;var t=e.sub(this.a).normalize(),i=e.sub(this.b).normalize(),r=e.sub(this.c).normalize(),o=Math.acos(t.dot(i));return o+=Math.acos(i.dot(r)),o+=Math.acos(r.dot(t)),s.abs(o-s.TWO_PI)&lt;=.005},flipVertexOrder:function(){this.a;return this.a=this.c,this.c=this.t,this},fromBarycentric:function(e){return new r(this.a.x*e.x+this.b.x*e.y+this.c.x*e.z,this.a.y*e.x+this.b.y*e.y+this.c.y*e.z,this.a.z*e.x+this.b.z*e.y+this.c.z*e.z)},getBoundingBox:function(){var e=r.min(r.min(this.a,this.b),this.c),t=r.max(r.max(this.a,this.b),this.c);return n.fromMinMax(e,t)},getClosestPointTo:function(e){var t=new o(this.a,this.b),i=t.closestPointTo(e),s=t.set(this.b,this.c).closestPointTo(e),r=t.set(this.c,this.a).closestPointTo(e),n=e.sub(i).magSquared(),a=e.sub(s).magSquared(),h=n,d=i;return a&lt;h&amp;&amp;(h=a,d=s),e.sub(r).magSquared()&lt;h&amp;&amp;(d=r),d},isClockwiseInXY:function(){return h.isClockwiseInXY(this.a,this.b,this.c)},isClockwiseInXZ:function(){return h.isClockwiseInXY(this.a,this.b,this.c)},isClockwiseInYZ:function(){return h.isClockwiseInXY(this.a,this.b,this.c)},set:function(e,t,i){this.a=e,this.b=t,this.c=i},toBarycentric:function(e){var t=b.sub(this.a).cross(this.c.sub(this.a)),i=t.getNormalized(),s=i.dot(t),o=i.dot(this.b.sub(e).cross(this.c.sub(e)))/s,n=i.dot(this.c.sub(e).cross(this.a.sub(e)))/s;return new r(o,n,1-o-n)},toString:function(){return"Triangle: "+this.a+","+this.b+","+this.c}},e.exports=h},160:function(e,t,i){e.exports=i(219).Circle},161:function(e,t,i){"use strict";var s=i(223);t.a=function(e){var t=Object(s.a)(e),i=t%1;return t===t?i?t-i:t:0}},165:function(e,t,i){t.AABB=i(182),t.mesh=i(584),t.BernsteinPolynomial=i(188),t.Circle=i(160),t.CircleIntersector=i(596),t.Cone=i(220),t.ConvexPolygonClipper=i(597),t.Ellipse=i(219),t.IsectData2D=i(598),t.IsectData3D=i(167),t.Line2D=i(152),t.Line3D=i(150),t.LineStrip3D=i(599),t.Matrix4x4=i(184),t.Plane=i(600),t.Polygon2D=i(157),t.Quaternion=i(218),t.Ray2D=i(189),t.Ray3D=i(166),t.Ray3DIntersector=i(601),t.Rect=i(169),t.Sphere=i(187),t.Spline2D=i(602),t.Spline3D=i(603),t.SutherlandHodgemanClipper=i(604),t.Triangle2D=i(605),t.Triangle3D=i(159),t.Vec2D=i(143),t.Vec3D=i(136),t.XAxisCylinder=i(606),t.YAxisCylinder=i(607),t.ZAxisCylinder=i(608)},166:function(e,t,i){var s=i(132).extend,r=i(136),o=(i(150),function(e,t,i,s){var o,n;4==arguments.length?(o=new r(e,t,i),n=s):2==arguments.length?(o=e,n=t):(o=new r,n=r.Y_AXIS.copy()),r.apply(this,[o]),this.dir=n});s(o,r),o.prototype.getDirection=function(){return this.dir.copy()},o.prototype.getDistanceToPoint=function(e){var t=e.sub(this);return t.distanceTo(this.dir.scale(t.dot(this.dir)))},o.prototype.getPointAtDistance=function(e){return this.add(this.dir.scale(e))},o.prototype.setDirection=function(e){return this.dir.set(e).normalize(),this},o.prototype.toLine3DWithPointAtDistance=function(e){return new(i(150))(this,this.getPointAtDistance(e))},o.prototype.toString=function(){return"origin: "+this.parent.toString.call(this)+" dir: "+this.dir},e.exports=o},167:function(e,t,i){var s=i(136),r=function(e){void 0!==e?(this.isIntersection=e.isIntersection,this.dist=e.dist,this.pos=e.pos.copy(),this.dir=e.dir.copy(),this.normal=e.normal.copy()):this.clear()};r.prototype={clear:function(){this.isIntersection=!1,this.dist=0,this.pos=new s,this.dir=new s,this.normal=new s},toString:function(){var e="isec: "+this.isIntersection;return this.isIntersection&amp;&amp;(e+=" at:"+this.pos+" dist:"+this.dist+" normal:"+this.normal),e}},e.exports=r},168:function(e,t){var i=function(e){this.mesh=e,this.selection=[]};i.prototype={addSelection:function(e){return this.checkMeshIdentity(e.getMesh()),this.selection=this.selection.concat(e.getSelection()),this},checkMeshIdentity:function(e){if(e!=this.mesh)throw new Error("The given selector is not using the same mesh instance")},clearSelection:function(){return this.selection=[],this},getMesh:function(){return this.mesh},getSelection:function(){return this.selection},invertSelection:function(){for(var e=[],t=this.mesh.getVertices(),i=t.length,s=0;s&lt;i;s++){var r=t[s];this.selection.indexOf(r)&lt;0&amp;&amp;e.push(r)}return this.selection=e,this},selectSimilar:function(e){for(var t=e.length,i=0;i&lt;t;i++){var s=e[i];this.selection.push(this.mesh.getClosestVertexToPoint(s))}return this},selectVertices:function(){return this},setMesh:function(e){this.mesh=e,this.clearSelection()},size:function(){return this.selection.length},subtractSelection:function(e){this.checkMeshIdentity(e.getMesh());var t,i=e.getSelection(),s=i.length;for(t=0;t&lt;s;t++)this.selection.splice(this.selection.indexOf(i[t]),1);return this}},e.exports=i},169:function(e,t,i){var s=i(132),r=i(134),o=i(143),n=i(152),a=function(e,t,i,r){if(2===arguments.length){if(!s.has.XY(e))throw new Error("Rect received incorrect parameters");this.x=e.x,this.y=e.y,this.width=t.x-this.x,this.height=t.y-this.y}else if(4==arguments.length)this.x=e,this.y=t,this.width=i,this.height=r;else if(1===arguments.length){var o=arguments[0];s.has.XYWidthHeight(o)&amp;&amp;(this.x=o.x,this.y=o.y,this.width=o.width,this.height=o.height)}else if(arguments.length&gt;0)throw new Error("Rect received incorrect parameters")};a.fromCenterExtent=function(e,t){return new a(e.sub(t),e.add(t))},a.getBoundingRect=function(e){for(var t=e[0],i=new a(t.x,t.y,0,0),s=1,r=e.length;s&lt;r;s++)i.growToContainPoint(e[s]);return i},a.prototype={containsPoint:function(e){var t=e.x,i=e.y;return!(t&lt;this.x||t&gt;=this.x+this.width)&amp;&amp;!(i&lt;this.y||i&gt;=this.y+this.height)},copy:function(){return new a(this.x,this.y,this.width,this.height)},getArea:function(){return this.width*this.height},getAspect:function(){return this.width/this.height},getBottom:function(){return this.y+this.height},getBottomRight:function(){return new o(this.x+this.width,this.y+this.height)},getCentroid:function(){return new o(this.x+.5*this.width,this.y+.5*this.height)},getDimensions:function(){return new o(this.width,this.height)},getEdge:function(e){var t;switch(e){case 0:t=new n(new o(this.x,this.y),new o(this.x+this.width,this.y));break;case 1:t=new n(new o(this.x+this.width,this.y),new o(this.x+this.width,this.y+this.height));break;case 2:t=new n(new o(this.x,this.y+this.height),new o(this.x+this.width,this.y+this.height));break;case 3:t=new n(new o(this.x,this.y),new o(this.x,this.y+this.height));break;default:throw new Error("edge ID needs to be 0...3")}return t},getLeft:function(){return this.x},getRight:function(){return this.x+this.width},getTop:function(){return this.y},getTopLeft:function(){return new o(this.x,this.y)},growToContainPoint:function(e){return this.containsPoint(e)||(e.x&lt;this.x?(this.width=this.getRight()-e.x,this.x=e.x):e.x&gt;this.getRight()&amp;&amp;(this.width=e.x-this.x),e.y&lt;this.y?(this.height=this.getBottom()-e.y,this.y=e.y):e.y&gt;this.getBottom()&amp;&amp;(this.height=e.y-this.y)),this},intersectsRay:function(e,t,i){var s=e.getDirection().reciprocal(),r=s.x&lt;0,o=s.y&lt;0,n=this.getTopLeft(),a=this.getBottomRight(),h=r?a:n,d=(h.x-e.x)*s.x,l=((h=r?n:a).x-e.x)*s.x,u=((h=o?a:n).y-e.y)*s.y,f=((h=o?n:a).y-e.y)*s.y;if(!(d&gt;f||u&gt;l))return u&gt;d&amp;&amp;(d=u),f&lt;l&amp;&amp;(l=f),d&lt;i&amp;&amp;l&gt;t?e.getPointAtDistance(d):void 0},intersectsRect:function(e){return!(this.x&gt;e.x+e.width||this.x+this.width&lt;e.x||this.y&gt;e.y+e.height||this.y+this.height&lt;e.y)},scale:function(e){var t=this.getCentroid();return this.width*=e,this.height*=e,this.x=t.x-.5*this.width,this.y=t.y-.5*this.height,this},set:function(e,t,i,s){if(1===arguments.length)this.y=e.y,this.width=e.width,this.height=e.height,this.x=e.x;else{if(4!==arguments.length)throw new Error("Rect set() received wrong parameters");this.x=e,this.y=t,this.width=i,this.height=s}},setDimensions:function(e){return 2==arguments.length&amp;&amp;(e={x:arguments[0],y:arguments[1]}),this.width=e.x,this.height=e.y,this},setPosition:function(e){return this.x=e.x,this.y=e.y,this},toPolygon2D:function(){var e=new(i(157));return e.add(new o(this.x,this.y)),e.add(new o(this.x+this.width,this.y)),e.add(new o(this.x+this.width,this.y+this.height)),e.add(new o(this.x,this.y+this.height)),e},toString:function(){return"rect: {x: "+this.x+", y: "+this.y+", width: "+this.width+", height: "+this.height+"}"},union:function(e){var t=r.max(this.x+this.width,e.x+e.width);return this.x=r.min(this.x,e.x),this.width=t-this.x,t=r.max(this.y+this.height,e.y+e.height),this.y=r.min(this.y,e.y),this.height=t-this.y,this}},e.exports=a},182:function(e,t,i){var s=i(132),r=i(136),o=i(143),n=i(134),a=function(e,t){void 0===e?(r.call(this),this.setExtent(new r)):"number"==typeof e?(r.call(this,new r),this.setExtent(e)):s.has.XYZ(e)&amp;&amp;(r.call(this,e),void 0===t&amp;&amp;s.is.AABB(e)?this.setExtent(e.getExtent()):"number"==typeof t?this.setExtent(new r(t,t,t)):this.setExtent(t))};s.extend(a,r),a.fromMinMax=function(e,t){var i=r.min(e,t),s=r.max(e,t);return new a(i.interpolateTo(s,.5),s.sub(i).scaleSelf(.5))},a.prototype.containsPoint=function(e){return e.isInAABB(this)},a.prototype.copy=function(){return new a(this)},a.prototype.getExtent=function(){return this.extent.copy()},a.prototype.getMax=function(){return this.max.copy()},a.prototype.getMin=function(){return this.min.copy()},a.prototype.getNormalForPoint=function(e){e=e.sub(this);var t=this.extent.sub(e.getAbs()),i=e.getSignum(),s=r.X_AXIS.scale(i.x),o=t.x;return t.y&lt;o&amp;&amp;(o=t.y,s=r.Y_AXIS.scale(i.y)),t.z&lt;o&amp;&amp;(s=r.Z_AXIS.scale(i.z)),s},a.prototype.includePoint=function(e){return this.min.minSelf(e),this.max.maxSelf(e),this.set(this.min.interpolateTo(this.max,.5)),this.extent.set(this.max.sub(this.min).scaleSelf(.5)),this},a.prototype.intersectsBox=function(e){var t=e.sub(this);return Math.abs(t.x)&lt;=this.extent.x+e.extent.x&amp;&amp;Math.abs(t.y)&lt;=this.extent.y+e.extent.y&amp;&amp;Math.abs(t.z)&lt;=this.extent.z+e.extent.z},a.prototype.intersectsRay=function(e,t,i){var s=e.getDirection().reciprocal(),r=s.x&lt;0,o=s.y&lt;0,n=s.z&lt;0,a=r?this.max:this.min,h=(a.x-e.x)*s.x,d=((a=r?this.min:this.max).x-e.x)*s.x,l=((a=o?this.max:this.min).y-e.y)*s.y,u=((a=o?this.min:this.max).y-e.y)*s.y;if(h&gt;u||l&gt;d)return null;l&gt;h&amp;&amp;(h=l),u&lt;d&amp;&amp;(d=u);var f=((a=n?this.max:this.min).z-e.z)*s.z,c=((a=n?this.min:this.max).z-e.z)*s.z;return h&gt;c||f&gt;d?null:(f&gt;h&amp;&amp;(h=f),c&lt;d&amp;&amp;(d=c),h&lt;i&amp;&amp;d&gt;t?e.getPointAtDistance(h):void 0)},a.prototype.intersectsSphere=function(e,t){1==arguments.length&amp;&amp;(t=e.radius);var i,s=0;return e.x&lt;this.min.x?s=(i=e.x-this.min.x)*i:e.x&gt;this.max.x&amp;&amp;(s+=(i=e.x-this.max.x)*i),e.y&lt;this.min.y?s+=(i=e.y-this.min.y)*i:e.y&gt;this.max.y&amp;&amp;(s+=(i=e.y-this.max.y)*i),e.z&lt;this.min.z?s+=(i=e.z-this.min.z)*i:e.z&gt;this.max.z&amp;&amp;(s+=(i=e.z-this.max.z)*i),s&lt;=t*t},a.prototype.intersectsTriangle=function(e){var t,i,s,r,o,a,h,d;if(t=e.a.sub(this),i=e.b.sub(this),s=e.c.sub(this),o=i.sub(t),a=s.sub(i),h=t.sub(s),d=o.getAbs(),this.testAxis(o.z,-o.y,d.z,d.y,t.y,t.z,s.y,s.z,this.extent.y,this.extent.z))return!1;if(this.testAxis(-o.z,o.x,d.z,d.x,t.x,t.z,s.x,s.z,this.extent.x,this.extent.z))return!1;if(this.testAxis(o.y,-o.x,d.y,d.x,i.x,i.y,s.x,s.y,this.extent.x,this.extent.y))return!1;if(d=a.getAbs(),this.testAxis(a.z,-a.y,d.z,d.y,t.y,t.z,s.y,s.z,this.extent.y,this.extent.z))return!1;if(this.testAxis(-a.z,a.x,d.z,d.x,t.x,t.z,s.x,s.z,this.extent.x,this.extent.z))return!1;if(this.testAxis(a.y,-a.x,d.y,d.x,t.x,t.y,i.x,i.y,this.extent.x,this.extent.y))return!1;if(d=h.getAbs(),this.testAxis(h.z,-h.y,d.z,d.y,t.y,t.z,i.y,i.z,this.extent.y,this.extent.z))return!1;if(this.testAxis(-h.z,h.x,d.z,d.x,t.x,t.z,i.x,i.z,this.extent.x,this.extent.z))return!1;if(this.testAxis(h.y,-h.x,d.y,d.x,i.x,i.y,s.x,s.y,this.extent.x,this.extent.y))return!1;if(n.min(t.x,i.x,s.x)&gt;this.extent.x||n.max(t.x,i.x,s.x)&lt;-this.extent.x)return!1;if(n.min(t.y,i.y,s.y)&gt;this.extent.y||n.max(t.y,i.y,s.y)&lt;-this.extent.y)return!1;if(n.min(t.z,i.z,s.z)&gt;this.extent.z||n.max(t.z,i.z,s.z)&lt;-this.extent.z)return!1;var l=-(r=o.cross(a)).dot(t);return!!this.planeBoxOverlap(r,l,this.extent)},a.prototype.planeBoxOverlap=function(e,t,i){var s=new r,o=new r;return e.x&gt;0?(s.x=-i.x,o.x=i.x):(s.x=i.x,o.x=-i.x),e.y&gt;0?(s.y=-i.y,o.y=i.y):(s.y=i.y,o.y=-i.y),e.z&gt;0?(s.z=-i.z,o.z=i.z):(s.z=i.z,o.z=-i.z),!(e.dot(s)+t&gt;0)&amp;&amp;e.dot(o)+t&gt;=0},a.prototype.set=function(e,t,i){return s.is.AABB(e)?(this.extent.set(e.extent),r.set.apply(this,[e])):(s.has.XYZ(e)&amp;&amp;(t=e.y,i=e.z,e=e.a),this.x=e,this.y=t,this.z=i,this.updateBounds(),this)},a.prototype.setExtent=function(e){return this.extent=e.copy(),this.updateBounds()},a.prototype.testAxis=function(e,t,i,s,r,o,n,a,h,d){var l,u,f=e*r+t*o,c=e*n+t*a;f&lt;c?(l=f,u=c):(l=c,u=f);var m=i*h+s*d;return l&gt;m||u&lt;-m},a.prototype.toMesh=function(e){void 0===e&amp;&amp;(e=new(0,i(156).TriangleMesh)("aabb",8,12));var t=this.min,s=this.max,n=new r(t.x,t.y,s.z),a=new r(s.x,t.y,s.z),h=new r(s.x,t.y,t.z),d=new r(t.x,s.y,t.z),l=new r(t.x,s.y,s.z),u=new r(s.x,s.y,t.z),f=new o(0,0),c=new o(1,0),m=new o(1,1),_=new o(0,1);return e.addFace(t,n,l,_,m,c),e.addFace(t,l,d,_,c,f),e.addFace(n,a,s,_,m,c),e.addFace(n,s,l,_,c,f),e.addFace(a,h,u,_,m,c),e.addFace(a,u,s,_,c,f),e.addFace(h,t,d,_,m,c),e.addFace(h,d,u,_,c,f),e.addFace(d,l,u,f,_,c),e.addFace(l,s,u,_,m,c),e.addFace(t,h,n,_,m,f),e.addFace(n,h,a,f,m,c),e},a.prototype.toString=function(){return"&lt;aabb&gt; pos: "+r.prototype.toString.call(this)+" ext: "+this.extent.toString()},a.prototype.updateBounds=function(){return void 0!==this.extent&amp;&amp;(this.min=this.sub(this.extent),this.max=this.add(this.extent)),this},e.exports=a},183:function(e,t){var i={};e.exports=function(e,t,s){if(null!=e)if(Array.prototype.forEach&amp;&amp;e.forEach===Array.prototype.forEach)e.forEach(t,s);else if(e.length===+e.length){for(var r=0,o=e.length;r&lt;o;r++)if(r in e&amp;&amp;t.call(s,e[r],r,e)===i)return}else for(var n in e)if(hasOwnProperty.call(e,n)&amp;&amp;t.call(s,e[n],n,e)===i)return}},184:function(e,t,i){var s=i(134),r=i(132),o=i(136),n=function(e,t,i,s,o,n,a,h,d,l,u,f,c,m,_,p){this.temp=[],this.matrix=[];var x=this;if(0===arguments.length)this.matrix[0]=[1,0,0,0],this.matrix[1]=[0,1,0,0],this.matrix[2]=[0,0,1,0],this.matrix[3]=[0,0,0,1];else if("number"==typeof e){var g=[e,t,i,s],v=[o,n,a,h],y=[d,l,u,f],b=[c,m,_,p];this.matrix=[g,v,y,b]}else if(r.is.Array(e)){var T=e;if(9!=T.length&amp;&amp;16!=T.length)throw new Error("Matrix4x4: Array length must == 9 or 16");16==T.length?(this.matrix=[],this.matrix[0]=T.slice(0,4),this.matrix[1]=T.slice(4,8),this.matrix[2]=T.slice(8,12),this.matrix[3]=T.slice(12)):(this.matrix[0]=T.slice(0,3),this.matrix[0][3]=NaN,this.matrix[1]=T.slice(3,6),this.matrix[1][3]=NaN,this.matrix[2]=T.slice(6,9),this.matrix[2][3]=NaN,this.matrix[3]=[NaN,NaN,NaN,NaN])}else if(r.is.Matrix4x4(e)){var S,w,M=e,E=0,F=0;if(16==M.matrix.length)for(E=0;E&lt;4;E++)this.matrix[E]=[M.matrix[E][0],M.matrix[E][1],M.matrix[E][2],M.matrix[E][3]];else if(4==M.matrix.length)for(S=M.matrix.length,E=0;E&lt;S;E++)for(w=M.matrix[E].length,x.matrix[E]=[],F=0;F&lt;w;F++)x.matrix[E][F]=M.matrix[E][F]}else console.error("Matrix4x4: incorrect parameters used to construct new instance")};n.prototype={add:function(e){return new n(this).addSelf(e)},addSelf:function(e){for(var t=0;t&lt;4;t++){var i=this.matrix[t],s=e.matrix[t];i[0]+=s[0],i[1]+=s[1],i[2]+=s[2],i[3]+=s[3]}return this},applyTo:function(e){return this.applyToSelf(new o(e))},applyToSelf:function(e){for(var t=0;t&lt;4;t++){var i=this.matrix[t];this.temp[t]=e.x*i[0]+e.y*i[1]+e.z*i[2]+i[3]}return e.set(this.temp[0],this.temp[1],this.temp[2]).scaleSelf(1/this.temp[3]),e},copy:function(){return new n(this)},getInverted:function(){return new n(this).invert()},getRotatedAroundAxis:function(e,t){return new n(this).rotateAroundAxis(e,t)},getRotatedX:function(e){return new n(this).rotateX(e)},getRotatedY:function(e){return new n(this).rotateY(e)},getRotatedZ:function(e){return new n(this).rotateZ(e)},getTransposed:function(){return new n(this).transpose()},identity:function(){var e=this.matrix[0];return e[1]=e[2]=e[3]=0,(e=this.matrix[1])[0]=e[2]=e[3]=0,(e=this.matrix[2])[0]=e[1]=e[3]=0,(e=this.matrix[3])[0]=e[1]=e[2]=0,this.matrix[0][0]=1,this.matrix[1][1]=1,this.matrix[2][2]=1,this.matrix[3][3]=1,this},invert:function(){var e=[],t=[],i=[],s=this.toArray(),r=0;for(r=0;r&lt;4;r++){var o=r&lt;&lt;2;t[r]=s[o],t[r+4]=s[o+1],t[r+8]=s[o+2],t[r+12]=s[o+3]}e[0]=t[10]*t[15],e[1]=t[11]*t[14],e[2]=t[9]*t[15],e[3]=t[11]*t[13],e[4]=t[9]*t[14],e[5]=t[10]*t[13],e[6]=t[8]*t[15],e[7]=t[11]*t[12],e[8]=t[8]*t[14],e[9]=t[10]*t[12],e[10]=t[8]*t[13],e[11]=t[9]*t[12];var n=t[0],a=t[1],h=t[2],d=t[3],l=t[4],u=t[5],f=t[6],c=t[7];i[0]=e[0]*u+e[3]*f+e[4]*c,i[0]-=e[1]*u+e[2]*f+e[5]*c,i[1]=e[1]*l+e[6]*f+e[9]*c,i[1]-=e[0]*l+e[7]*f+e[8]*c,i[2]=e[2]*l+e[7]*u+e[10]*c,i[2]-=e[3]*l+e[6]*u+e[11]*c,i[3]=e[5]*l+e[8]*u+e[11]*f,i[3]-=e[4]*l+e[9]*u+e[10]*f,i[4]=e[1]*a+e[2]*h+e[5]*d,i[4]-=e[0]*a+e[3]*h+e[4]*d,i[5]=e[0]*n+e[7]*h+e[8]*d,i[5]-=e[1]*n+e[6]*h+e[9]*d,i[6]=e[3]*n+e[6]*a+e[11]*d,i[6]-=e[2]*n+e[7]*a+e[10]*d,i[7]=e[4]*n+e[9]*a+e[10]*h,i[7]-=e[5]*n+e[8]*a+e[11]*h,e[0]=h*c,e[1]=d*f,e[2]=a*c,e[3]=d*u,e[4]=a*f,e[5]=h*u,e[6]=n*c,e[7]=d*l,e[8]=n*f,e[9]=h*l,e[10]=n*u,e[11]=a*l,n=t[8],a=t[9],h=t[10],d=t[11],l=t[12],u=t[13],f=t[14],c=t[15],i[8]=e[0]*u+e[3]*f+e[4]*c,i[8]-=e[1]*u+e[2]*f+e[5]*c,i[9]=e[1]*l+e[6]*f+e[9]*c,i[9]-=e[0]*l+e[7]*f+e[8]*c,i[10]=e[2]*l+e[7]*u+e[10]*c,i[10]-=e[3]*l+e[6]*u+e[11]*c,i[11]=e[5]*l+e[8]*u+e[11]*f,i[11]-=e[4]*l+e[9]*u+e[10]*f,i[12]=e[2]*h+e[5]*d+e[1]*a,i[12]-=e[4]*d+e[0]*a+e[3]*h,i[13]=e[8]*d+e[0]*n+e[7]*h,i[13]-=e[6]*h+e[9]*d+e[1]*n,i[14]=e[6]*a+e[11]*d+e[3]*n,i[14]-=e[10]*d+e[2]*n+e[7]*a,i[15]=e[10]*h+e[4]*n+e[9]*a,i[15]-=e[8]*a+e[11]*h+e[5]*n;var m=1/(t[0]*i[0]+t[1]*i[1]+t[2]*i[2]+t[3]*i[3]);for(r=0,k=0;r&lt;4;r++)for(var _=this.matrix[r],p=0;p&lt;4;p++)_[p]=i[k++]*m;return this},multiply:function(e){return"number"==typeof e?new n(this).multiply(e):new n(this).multiplySelf(e)},multiplySelf:function(e){var t,i=0;if("number"==typeof e){for(i=0;i&lt;4;i++)(t=this.matrix[i])[0]*=e,t[1]*=e,t[2]*=e,t[3]*=e;return this}var s=e.matrix[0],r=e.matrix[1],o=e.matrix[2],n=e.matrix[3];for(i=0;i&lt;4;i++){t=this.matrix[i];for(var a=0;a&lt;4;a++)this.temp[a]=t[0]*s[a]+t[1]*r[a]+t[2]*o[a]+t[3]*n[a];t[0]=this.temp[0],t[1]=this.temp[1],t[2]=this.temp[2],t[3]=this.temp[3]}return this},rotateAroundAxis:function(e,t){var i,s,r,o,n,h,d,l;return i=e.x,s=e.y,r=e.z,o=Math.sin(t),d=(h=1-(n=Math.cos(t)))*i,l=h*s,a.set(d*i+n,d*s+o*r,d*r-o*s,0,d*s-o*r,l*s+n,l*r+o*i,0,d*r+o*s,l*r-o*i,h*r*r+n,0,0,0,0,1),this.multiplySelf(a)},rotateX:function(e){return a.identity(),a.matrix[1][1]=a.matrix[2][2]=Math.cos(e),a.matrix[2][1]=Math.sin(e),a.matrix[1][2]=-a.matrix[2][1],this.multiplySelf(a)},rotateY:function(e){return a.identity(),a.matrix[0][0]=a.matrix[2][2]=Math.cos(e),a.matrix[0][2]=Math.sin(e),a.matrix[2][0]=-a.matrix[0][2],this.multiplySelf(a)},rotateZ:function(e){return a.identity(),a.matrix[0][0]=a.matrix[1][1]=Math.cos(e),a.matrix[1][0]=Math.sin(e),a.matrix[0][1]=-a.matrix[1][0],this.multiplySelf(a)},scale:function(e,t,i){return new n(this).scaleSelf(e,t,i)},scaleSelf:function(e,t,i){return r.has.XYZ(e)?(t=e.y,i=e.z,e=e.x):void 0!==t&amp;&amp;void 0!==i||(t=e,i=e),a.identity(),a.matrix[0][0]=e,a.matrix[1][1]=t,a.matrix[2][2]=i,this.multiplySelf(a)},set:function(e,t,i,s,r,o,n,a,h,d,l,u,f,c,m,_){var p;if("number"==typeof e)(p=this.matrix[0])[0]=e,p[1]=t,p[2]=i,p[3]=s,(p=this.matrix[1])[0]=r,p[1]=o,p[2]=n,p[3]=a,(p=this.matrix[2])[0]=h,p[1]=d,p[2]=l,p[3]=u,(p=this.matrix[3])[0]=f,p[1]=c,p[2]=m,p[3]=_;else for(var x=0;x&lt;4;x++){var g=(p=this.matrix[x]).matrix[x];p[0]=g[0],p[1]=g[1],p[2]=g[2],p[3]=g[3]}return this},setFrustrum:function(e,t,i,s,r,o){var n=t-e,a=i-s,h=o-r;return this.set(2*r/n,0,(e+t)/n,0,0,2*r/a,(i+s)/a,0,0,0,-(r+o)/h,-2*r*o/h,0,0,-1,0)},setOrtho:function(e,t,i,s,r,o){var n=[2/(t-e),0,0,(e+t)/(t-e),0,2/(i-s),0,(i+s)/(i-s),0,0,-2/(o-r),(o+r)/(o-r),0,0,0,1];return this.set.apply(this,n)},setPerspective:function(e,t,i,r){var o=i*Math.tan(.5*s.radians(e)),n=t*o;return this.setFrustrum(-n,n,o,-o,i,r)},setPosition:function(e,t,i){return this.matrix[0][3]=e,this.matrix[1][3]=t,this.matrix[2][3]=i,this},setScale:function(e,t,i){return this.matrix[0][0]=e,this.matrix[1][1]=t,this.matrix[2][2]=i,this},sub:function(e){return new n(this).subSelf(e)},subSelf:function(e){for(var t=0;t&lt;4;t++){var i=this.matrix[t],s=e.matrix[t];i[0]-=s[0],i[1]-=s[1],i[2]-=s[2],i[3]-=s[3]}return this},toArray:function(e){void 0===e&amp;&amp;(e=[]);for(var t=0,i=0;t&lt;4;t++)for(var s=this.matrix[t],r=0;r&lt;4;r++)e[i++]=s[r];return e},toFloatArray:function(e){return new Float32Array(this.toArray(e))},toString:function(){return"| "+this.matrix[0][0]+" "+this.matrix[0][1]+" "+this.matrix[0][2]+" "+this.matrix[0][3]+" |\n| "+this.matrix[1][0]+" "+this.matrix[1][1]+" "+this.matrix[1][2]+" "+this.matrix[1][3]+" |\n| "+this.matrix[2][0]+" "+this.matrix[2][1]+" "+this.matrix[2][2]+" "+this.matrix[2][3]+" |\n| "+this.matrix[3][0]+" "+this.matrix[3][1]+" "+this.matrix[3][2]+" "+this.matrix[3][3]+" |"},toTransposedFloatArray:function(e){void 0===e&amp;&amp;(e=[]);for(var t=0,i=0;t&lt;4;t++)for(var s=0;s&lt;4;s++)e[i++]=this.matrix[s][t];return e},translate:function(e,t,i){return new n(this).translateSelf(e,t,i)},translateSelf:function(e,t,i){return r.has.XYZ(e)&amp;&amp;(t=e.y,i=e.z,e=e.x),a.identity(),a.setPosition(e,t,i),this.multiplySelf(a)},transpose:function(){return this.set(this.matrix[0][0],this.matrix[1][0],this.matrix[2][0],this.matrix[3][0],this.matrix[0][1],this.matrix[1][1],this.matrix[2][1],this.matrix[3][1],this.matrix[0][2],this.matrix[1][2],this.matrix[2][2],this.matrix[3][2],this.matrix[0][3],this.matrix[1][3],this.matrix[2][3],this.matrix[3][3])}};var a=new n;e.exports=n},185:function(e,t,i){var s,r;!function(){var e=i(159);(s=function(e,t,i,s,r,o){this.a=e,this.b=t,this.c=i;var n=this.a.sub(this.c),a=this.a.sub(this.b),h=n.crossSelf(a);this.normal=h.normalize(),this.a.addFaceNormal(this.normal),this.b.addFaceNormal(this.normal),this.c.addFaceNormal(this.normal),void 0!==s&amp;&amp;(this.uvA=s,this.uvB=r,this.uvC=o)}).prototype={computeNormal:function(){this.normal=this.a.sub(this.c).crossSelf(this.a.sub(this.b)).normalize()},flipVertexOrder:function(){var e=this.a;this.a=this.b,this.b=e,this.normal.invert()},getCentroid:function(){return this.a.add(this.b).addSelf(this.c).scale(1/3)},getClass:function(){return"Face"},getVertices:function(e){return void 0!==e?(e[0]=this.a,e[1]=this.b,e[2]=this.c):e=[this.a,this.b,this.c],e},toString:function(){return this.getClass()+" "+this.a+", "+this.b+", "+this.c},toTriangle:function(){return new e(this.a.copy(),this.b.copy(),this.c.copy())}}}(),function(){var e,t=i(132);r=function(e,t,i,r,o,n){s.call(this,e,t,i,r,o,n),this.edges=[]},t.extend(r,s),(e=r.prototype).addEdge=function(e){this.edges.push(e)},e.getEdges=function(){return this.edges},e.getVertices=function(e){return void 0!==e?(e[0]=this.a,e[1]=this.b,e[2]=this.c):e=[this.a,this.b,this.c],e}}(),s.WEFace=r,e.exports=s},186:function(e,t,i){var s,r;!function(){var e,t=i(132).extend,r=i(136);t(s=function(e,t){r.call(this,e),this.id=t,this.normal=new r},r),(e=s.prototype).addFaceNormal=function(e){this.normal.addSelf(e)},e.clearNormal=function(){this.normal.clear()},e.computeNormal=function(){this.normal.normalize()},e.toString=function(){return this.id+": p: "+this.parent.toString.call(this)+" n:"+this.normal.toString()}}(),function(){var e;(0,i(132).extend)(r=function(e,t){s.call(this,e,t),this.edges=[]},s),(e=r.prototype).addEdge=function(e){this.edges.push(e)},e.getNeighborInDirection=function(e,t){for(var i,s,r=1-t,o=this.getNeighbors(),n=0,a=o.length;n&lt;a;n++)(s=o[n].sub(this).normalize().dot(e))&gt;r&amp;&amp;(i=o[n],r=s);return i},e.getNeighbors=function(){for(var e=[],t=0,i=this.edges.length;t&lt;i;t++)e.push(this.edges[t].getOtherEndFor(this));return e},e.removeEdge=function(e){this.edges.splice(this.edges.indexOf(e),1)},e.toString=function(){return this.id+" {"+this.x+","+this.y+","+this.z+"}"}}(),s.WEVertex=r,e.exports=s},187:function(e,t,i){var s,r;!function(){var e=i(132),t=i(156),o=i(136);s=function(t,i){void 0===t?(o.apply(this,[new o]),this.radius=1):e.has.XYZ(t)?(o.apply(this,[t]),e.is.Sphere(t)?this.radius=t.radius:this.radius=i):(o.apply(this,[new o]),this.radius=t)},e.extend(s,o),s.prototype.containsPoint=function(e){return this.sub(e).magSquared()&lt;=this.radius*this.radius},s.prototype.intersectRay=function(e){var t,i,s,r,o=e.sub(this),n=o.magSquared(),a=-o.dot(e.getDirection()),h=this.radius*this.radius-(n-a*a);return h&gt;=0&amp;&amp;(s=a-(h=Math.sqrt(h)),(i=a+h)&lt;0&amp;&amp;s&lt;0||(i&gt;0&amp;&amp;s&gt;0?i&gt;s&amp;&amp;(r=i,i=s,s=r):s&gt;0&amp;&amp;(r=i,i=s,s=r)),t=[i,s]),t},s.prototype.intersectSphereTriangle=function(e,t){return t.set(e.closestPointOnSurface(this)),t.sub(this).magSquared()&lt;=this.radius*this.radius},s.prototype.tangentPlaneNormalAt=function(e){return this.sub(e).normalize()},s.prototype.toMesh=function(){var e={mesh:void 0,resolution:0};1===arguments.length?"object"==typeof arguments[0]?(e.mesh=arguments[0].mesh,e.resolution=arguments[0].res||arguments[0].resolution):e.resolution=arguments[0]:(e.mesh=arguments[0],e.resolution=arguments[1]);var i=new t.SurfaceMeshBuilder(new r(this));return i.createMesh(e.mesh,e.resolution,1)}}(),function(e){var t=i(134),s=i(136),o=i(132);(r=function(i){void 0===i&amp;&amp;(this.sphere=new e(new s,1)),o.is.Sphere(i)?this.sphere=i:this.sphere=new e(new s,i),this.phiRange=t.PI,this.thetaRange=t.TWO_PI}).prototype={computeVertexFor:function(e,i,s){i-=t.HALF_PI;var r=t.cos(i),o=t.cos(s),n=t.sin(i),a=t.sin(s),h=t.sign(r)*t.abs(r);return e.x=h*t.sign(o)*t.abs(o),e.y=t.sign(n)*t.abs(n),e.z=h*t.sign(a)*t.abs(a),e.scaleSelf(this.sphere.radius).addSelf(this.sphere)},getPhiRange:function(){return this.phiRange},getPhiResolutionLimit:function(e){return e},getThetaRange:function(){return this.thetaRange},getThetaResolutionLimit:function(e){return e},setMaxPhi:function(e){this.phiRange=t.min(e/2,t.PI)},setMaxTheta:function(e){this.thetaRange=t.min(e,t.TWO_PI)}}}(s),s.SphereFunction=r,e.exports=s},188:function(e,t){e.exports=function(e){this.resolution=e;for(var t=[],i=[],s=[],r=[],o=0,n=1/(e-1),a=0;a&lt;e;a++){var h=1-o,d=h*h,l=o*o;t[a]=h*d,i[a]=3*o*d,s[a]=3*l*h,r[a]=o*l,o+=n}this.b0=t,this.b1=i,this.b2=s,this.b3=r}},189:function(e,t,i){var s=i(132).extend,r=i(143),o=(i(152),function(e,t,i){3==arguments.length?(r.apply(this,[e,t]),this.dir=i.getNormalized()):2==arguments.length?(r.apply(this,[e]),this.dir=t.getNormalized()):0===arguments.length&amp;&amp;(r.apply(this),this.dir=r.Y_AXIS.copy())});s(o,r),o.prototype.getDirection=function(){return this.dir.copy()},o.prototype.getDistanceToPoint=function(e){var t=e.sub(this);return t.distanceTo(this.dir.scale(t.dot(this.dir)))},o.prototype.getPointAtDistance=function(e){return this.add(this.dir.scale(e))},o.prototype.setDirection=function(e){return this.dir.set(e).normalize(),this},o.prototype.toLine2DWithPointAtDistance=function(e){return new(i(152))(this,this.getPointAtDistance(e))},o.prototype.toString=function(){return"origin: "+r.prototype.toString.apply(this)+" dir: "+this.dir},e.exports=o},190:function(e,t,i){var s=i(220),r=function(e,t,i){this.pos=void 0===e?void 0:e.copy(),this.setRadius(t),this.setLength(i)};r.prototype={containsPoint:function(e){throw Error("AxisAlignedCylinder.containsPoint(): not implmented")},getLength:function(){return this.length},getMajorAxis:function(){throw Error("AxisAlignedCylinder.getMajorAxis(): not implemented")},getPosition:function(){return this.pos.copy()},getRadius:function(){return this.radius},setLength:function(e){this.length=e},setPosition:function(e){this.pos.set(e)},setRadius:function(e){this.radius=e,this.radiusSquared=e*e},toMesh:function(e,t,i){var r={mesh:void 0,steps:12,thetaOffset:0};if(1==arguments.length&amp;&amp;"object"==typeof arguments[0])for(var o in arguments[0])r[o]=arguments[0][o];else 2==arguments.length&amp;&amp;(r.steps=arguments[0],r.thetaOffset=arguments[1]);var n=new s(this.pos,this.getMajorAxis().getVector(),this.radius,this.radius,this.length);return n.toMesh(r.mesh,r.steps,r.thetaOffset,!0,!0)}},e.exports=r},192:function(e,t,i){"use strict";var s=i(84),r=i(102),o=Object(r.a)(s.a);t.a=o},215:function(e,t){e.exports=function(e,t){if("function"!==typeof e)throw Error("childClass was not function, possible circular: ",e);if("function"!==typeof t)throw Error("superClass was not function, possible circular: ",t);e.prototype=Object.create(t.prototype),e.constructor=e,e.prototype.parent=t.prototype}},216:function(e,t,i){var s=i(146),r=function(e){this.__it=e.slice(0)};r.prototype={hasNext:function(){return this.__it.length&gt;0},next:function(){return this.__it.shift()}};var o=function(e){for(var t in this.__obj={},this.__keys=[],e)this.__obj[t]=e[t],this.__keys.push(t);this.__it=new r(this.__keys)};o.prototype={hasNext:function(){return this.__it.hasNext()},next:function(){var e=this.__it.next();return this.__obj[e]}};e.exports=function(e){return s.array(e)?new r(e):new o(e)}},217:function(e,t,i){var s=i(134),r=i(159),o=(i(136),i(167)),n=function(e){this.triangle=e||new r,this.isectData=new o};n.prototype={getIntersectionData:function(){return this.isectData},getTriangle:function(){return this.triangle},intersectsRay:function(e){this.isectData.isIntersection=!1;var t=this.triangle.computeNormal();if(t.dot(e.dir)&lt;0){var i=e.sub(this.triangle.a),r=-(t.x*i.x+t.y*i.y+t.z*i.z)/(t.x*e.dir.x+t.y*e.dir.y+t.z*e.dir.z);if(r&gt;=s.EPS){var o=e.getPointAtDistance(r);this.triangle.containsPoint(o)&amp;&amp;(this.isectData.isIntersection=!0,this.isectData.pos=o,this.isectData.normal=t,this.isectData.dist=r,this.isectData.dir=this.isectData.pos.sub(e).normalize())}}return this.isectData.isIntersection},setTriangle:function(e){return this.triangle=e,this}},e.exports=n},218:function(e,t,i){var s=i(134),r=i(184),o=function(e,t,i,s){4==arguments.length?(this.w=e,this.x=t,this.y=i,this.z=s):2==arguments.length?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=e):1==arguments.length&amp;&amp;(this.w=q.w,this.x=q.x,this.y=q.y,this.z=q.z)};o.prototype={add:function(e){return new o(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)},addSelf:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},copy:function(){return new o(this.w,this.x,this.y,this.z)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},getConjugate:function(){var e=new o;return e.x=-this.x,e.y=-this.y,e.z=-this.z,e.w=w,e},identity:function(){return this.w=1,this.x=0,this.y=0,this.z=0,this},interpolateTo:function(e,t,i){return 3==arguments.length?this.copy().interpolateTo(e,i.interpolate(0,1,t)):this.copy().interpolateToSelf(e,t)},interpolateToSelf:function(e,t,i){3==arguments.length&amp;&amp;(t=i.interpolate(0,1,t));var r,o,n=s.clip(this.dot(e),-1,1);if(1-n&gt;=s.EPS){var a=Math.acos(n),h=1/Math.sin(a);r=Math.sin(a*(1-t))*h,o=Math.sin(a*t)*h}else r=1-t,o=t;return n&lt;0?(this.w=r*this.w-o*e.w,this.x=r*this.x-o*e.x,this.y=r*this.y-o*e.y,this.z=r*this.z-o*e.z):(this.w=r*w+o*e.w,this.x=r*x+o*e.x,this.y=r*y+o*e.y,this.z=r*z+o*e.z),this},magnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},multiply:function(e){var t=new o;return t.w=this.w*e.w-x*e.x-y*e.y-z*e.z,t.x=this.w*e.x+x*e.w+y*e.z-z*e.y,t.y=this.w*e.y+y*e.w+z*e.x-x*e.z,t.z=this.w*e.z+z*e.w+x*e.y-y*e.x,t},normalize:function(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return e&gt;s.EPS&amp;&amp;(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),this},scale:function(e){return new o(this.x*e,this.y*e,this.z*e,this.w*e)},scaleSelf:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},set:function(e,t,i,s){return 4==arguments.length?(this.w=e,this.x=t,this.y=i,this.z=s):2==arguments.length?(this.w=e,this.x=v.x,this.y=v.y,this.z=v.z):(this.w=q.w,this.x=q.x,this.y=q.y,this.z=q.z),this},sub:function(e){return new o(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)},subSelf:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},toArray:function(){return[this.w,this.x,this.y,this.z]},toAxisAngle:function(){var e=[],t=Math.sqrt(1-this.w*this.w);return t=t&lt;s.EPS?1:1/t,e[0]=2*Math.acos(this.w),e[1]=this.x*t,e[2]=this.y*t,e[3]=this.z*t,e},toMatrix4x4:function(e){void 0===e&amp;&amp;(e=new r);var t=this.x+this.x,i=this.y+this.y,s=this.z+this.z,o=this.x*t,n=this.x*i,a=this.x*s,h=this.y*i,d=this.y*s,l=this.z*s,u=this.w*t,f=this.w*i,c=this.w*s;return e.set(1-(h+l),n-c,a+f,0,n+c,1-(o+l),d-u,0,a-f,d+u,1-(o+h),0,0,0,0,1)},toString:function(){return"{axis: ["+this.x+","+this.y+","+this.z+"], w: "+this.w+"}"}},o.DOT_THRESHOLD=.9995,o.createFromAxisAngle=function(e,t){t*=.5;var i=s.sin(t),r=s.cos(t);return new o(r,e.getNormalizedTo(i))},o.createFromEuler=function(e,t,i){e*=.5,t*=.5,i*=.5;var r=s.sin(e),n=s.cos(e),a=s.sin(t),h=s.cos(t),d=s.sin(i),l=s.cos(i),u=n*h,f=r*a,c=new o;return c.x=d*u-l*f,c.y=l*r*h+d*n*a,c.z=l*n*a-d*r*h,c.w=l*u+d*f,c},o.createFromMatrix=function(e){var t=0,i=[],s=e.matrix[0][0]+e.matrix[1][1]+e.matrix[2][2];if(s&gt;0)t=Math.sqrt(s+1),i[3]=.5*t,t=.5/t,i[0]=e.matrix[1][2]-e.matrix[2][1]*t,i[1]=e.matrix[2][0]-e.matrix[0][2]*t,i[2]=e.matrix[0][1]-e.matrix[1][0]*t;else{var r,n,a=[1,2,0],h=0;e.matrix[1][1]&gt;e.matrix[0][0]&amp;&amp;(h=1),e.matrix[2][2]&gt;e.matrix[h][h]&amp;&amp;(h=2),n=a[r=a[h]],t=Math.sqrt(e.matrix[h][h]-(e.matrix[r][r]+e.matrix[n][n])+1),i[h]=.5*t,t=.5/t,i[3]=(e.matrix[r][n]-e.matrix[n][r])*t,i[r]=(e.matrix[h][r]+e.matrix[r][h])*t,i[n]=(e.matrix[h][n]+e.matrix[n][h])*t}return new o(i[3],i[0],i[1],i[2])},o.getAlignmentQuat=function(e,t){var i=e.getNormalized(),s=t.cross(i),r=s.magnitude()+1e-4,o=Math.atan2(r,t.dot(i));return this.createFromAxisAngle(s,o)},e.exports=o},219:function(e,t,i){var s,r,o=i(215),n=i(148),a=i(146),h=i(134),d=i(143);o(s=function(e,t,i,s){this.radius=new d,0===arguments.length?(d.apply(this,[0,0]),this.setRadii(1,1)):n.XY(e)?(d.apply(this,[e.x,e.y]),n.XY(t)?this.setRadii(t.x,t.y):this.setRadii(t,i)):void 0===s?void 0===i?(d.call(this,0,0),this.setRadii(e,t)):(d.call(this,e,t),this.setRadii(i,i)):(d.call(this,e,t),this.setRadii(i,s))},d),s.prototype.containsPoint=function(e){if(h.abs(e.x-this.x)&gt;this.radius.x||h.abs(e.y-this.y)&gt;this.radius.y)return!1;var t=this.getFoci();return e.distanceTo(t[0])+e.distanceTo(t[1])&lt;2*h.max(this.radius.x,this.radius.y)},s.prototype.getArea=function(){return h.PI*this.radius.x*this.radius.y},s.prototype.getCircumference=function(){return Math.sqrt(.5*this.radius.magSquared())*h.TWO_PI},s.prototype.getFoci=function(){return this.radius.x&gt;this.radius.y?[this.sub(this.focus,0),this.add(this.focus,0)]:[this.sub(0,this.focus),this.add(0,this.focus)]},s.prototype.getRadii=function(){return this.radius.copy()},s.prototype.setRadii=function(e,t){return n.XY(e)&amp;&amp;(t=e.y,e=e.x),this.radius.set(e,t),this.radius.x&gt;this.radius.y?this.focus=Math.sqrt(this.radius.x*this.radius.x-this.radius.y*this.radius.y):this.focus=Math.sqrt(this.radius.y*this.radius.y-this.radius.x*this.radius.x),this},s.prototype.toPolygon2D=function(e){for(var t=new(i(157)),s=h.TWO_PI/e,r=0;r&lt;e;r++){var o=d.fromTheta(r*s).scaleSelf(this.radius).addSelf(this);t.add(o)}return t},t=e.exports=s,o(r=function(e,t,i){1==arguments.length?a.Circle(e)?s.apply(this,[e,e.radius.x]):s.apply(this,[0,0,e]):2==arguments.length?s.apply(this,[e,t]):s.apply(this,[e,t,i,i])},s),r.from2Points=function(e,t){var i=e.interpolateTo(t,.5),s=i.distanceTo(e);return new r(i,s)},r.from3Points=function(e,t,i){var s,o,n,a=t.sub(e),l=i.sub(t);if(h.abs(a.x)&lt;=1e-7&amp;&amp;h.abs(l.y)&lt;=1e-7)n=(o=new d(t.x+i.x,e.y+t.y).scaleSelf(.5)).distanceTo(e),s=new r(o,n);else{var u=a.y/a.x,f=l.y/l.x;if(h.abs(u-f)&gt;1e-7&amp;&amp;0!==u){var c=(u*f*(e.y-i.y)+f*(e.x+t.x)-u*(t.x+i.x))/(2*(f-u)),m=-(c-(e.x+t.x)/2)/u+(e.y+t.y)/2;n=(o=new d(c,m)).distanceTo(e),s=new r(o,n)}}return s},r.newBoundingCircle=function(e){for(var t=new d,i=0,s=0,o=e.length;s&lt;o;s++)t.addSelf(e[s]);for(t.scaleSelf(1/e.length),s=0;s&lt;o;s++){var n=t.distanceToSquared(e[s]);n&gt;i&amp;&amp;(i=n)}return new r(t,Math.sqrt(i))},r.prototype.containsPoint=function(e){return this.distanceToSquared(e)&lt;=this.radius.x*this.radius.x},r.prototype.getCircumference=function(){return h.TWO_PI*this.radius.x},r.prototype.getRadius=function(){return this.radius.x},r.prototype.getTangentPoints=function(e){var t=this.interpolateTo(e,.5);return this.intersectsCircle(new r(t,t.distanceTo(e)))},r.prototype.intersectsCircle=function(e){var t,i=e.sub(this),s=i.magnitude(),r=this.radius.x,o=e.radius.x;if(s&lt;=r+o&amp;&amp;s&gt;=Math.abs(r-o)){var n=(r*r-o*o+s*s)/(2*s);s=1/s;var a=this.add(i.scale(n*s)),h=Math.sqrt(r*r-n*n);i.perpendicular().scaleSelf(h*s),t=[a.add(i),a.sub(i)]}return t},r.prototype.setRadius=function(e){return this.setRadii(e,e),this},t.Circle=r},220:function(e,t,i){var s=i(132).extend,r=i(136),o=i(151);function n(e){throw Error("Missing parameter: "+e)}var a=function(e,t,i,s,o){var a=this;function h(e,t,i,s,o){r.apply(a,[e]),a.dir=t.getNormalized(),a.radiusNorth=i,a.radiusSouth=s,a.length=o}"object"===typeof e&amp;&amp;1===arguments.length?h(e.pos||e.position||new r,e.dir||e.direction||n("direction"),e.rNorth||e.radiusNorth||n("radiusNorth"),e.rSouth||e.radiusSouth||n("radiusSouth"),e.len||e.length||n("length")):h(e,t,i,s,o)};s(a,r),a.prototype.toMesh=function(e){var t={mesh:void 0,steps:NaN,thetaOffset:0,topClosed:!0,bottomClosed:!0};if(1==arguments.length)if("object"==typeof arguments[0]){var i=arguments[0];t.mesh=i.mesh,t.steps=i.steps||i.resolution||i.res,t.thetaOffset=i.thetaOffset||t.thetaOffset,t.topClosed=i.topClosed||t.topClosed,t.bottomClosed=i.bottomClosed||t.bottomClosed}else t.steps=arguments[0];else 2==arguments.length?(t.steps=arguments[0],t.thetaOffset=arguments[1]):5==arguments.length&amp;&amp;(t.mesh=arguments[0],t.steps=arguments[1],t.thetaOffset=arguments[2],t.topClosed=arguments[3],t.bottomClosed=arguments[4]);var s=this.add(.01,.01,.01),r=s.cross(this.dir.getNormalized()).normalize(),n=this.dir.scale(.5*this.length),a=this.sub(n),h=this.add(n),d=[],l=[],u=2*Math.PI/t.steps,f=0,c=1;for(f=0;f&lt;t.steps;f++){var m=f*u+t.thetaOffset,_=r.getRotatedAroundAxis(this.dir,m);d[f]=_.scale(this.radiusSouth).addSelf(a),l[f]=_.scale(this.radiusNorth).addSelf(h)}var p=2*t.steps+2,x=2*t.steps+(t.topClosed?t.steps:0)+(t.bottomClosed?t.steps:0),g=t.mesh||new o("cone",p,x);for(f=0;f&lt;t.steps;f++,c++)c==t.steps&amp;&amp;(c=0),g.addFace(d[f],l[f],d[c],void 0,void 0,void 0,void 0),g.addFace(d[c],l[f],l[c],void 0,void 0,void 0,void 0),t.bottomClosed&amp;&amp;g.addFace(a,d[f],d[c],void 0,void 0,void 0,void 0),t.topClosed&amp;&amp;g.addFace(l[f],h,l[c],void 0,void 0,void 0,void 0);return g},e.exports=a},221:function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var s=i(95),r=i(92),o=i(46),n=i(96);function a(e){return Object(s.a)(e)||Object(r.a)(e)||Object(o.a)(e)||Object(n.a)()}},222:function(e,t,i){"use strict";var s=i(28);t.a=function(e,t){if(e!==t){var i=void 0!==e,r=null===e,o=e===e,n=Object(s.a)(e),a=void 0!==t,h=null===t,d=t===t,l=Object(s.a)(t);if(!h&amp;&amp;!l&amp;&amp;!n&amp;&amp;e&gt;t||n&amp;&amp;a&amp;&amp;d&amp;&amp;!h&amp;&amp;!l||r&amp;&amp;a&amp;&amp;d||!i&amp;&amp;d||!o)return 1;if(!r&amp;&amp;!n&amp;&amp;!l&amp;&amp;e&lt;t||l&amp;&amp;i&amp;&amp;o&amp;&amp;!r&amp;&amp;!n||h&amp;&amp;i&amp;&amp;o||!a&amp;&amp;o||!d)return-1}return 0}},223:function(e,t,i){"use strict";var s=i(224);t.a=function(e){return e?(e=Object(s.a)(e))===1/0||e===-1/0?17976931348623157e292*(e&lt;0?-1:1):e===e?e:0:0===e?e:0}},224:function(e,t,i){"use strict";var s=i(4),r=i(28),o=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,h=/^0o[0-7]+$/i,d=parseInt;t.a=function(e){if("number"==typeof e)return e;if(Object(r.a)(e))return NaN;if(Object(s.a)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Object(s.a)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var i=a.test(e);return i||h.test(e)?d(e.slice(2),i?2:8):n.test(e)?NaN:+e}},225:function(e,t,i){"use strict";var s=i(28);t.a=function(e,t,i){for(var r=-1,o=e.length;++r&lt;o;){var n=e[r],a=t(n);if(null!=a&amp;&amp;(void 0===h?a===a&amp;&amp;!Object(s.a)(a):i(a,h)))var h=a,d=n}return d}},226:function(e,t,i){"use strict";var s=i(79),r=i(234),o=i(233);t.a=function(e,t){return Object(o.a)(Object(r.a)(e,t,s.a),e+"")}},227:function(e,t,i){"use strict";var s=i(32),r=i(27),o=i(29),n=i(4);t.a=function(e,t,i){if(!Object(n.a)(i))return!1;var a=typeof t;return!!("number"==a?Object(r.a)(i)&amp;&amp;Object(o.a)(t,i.length):"string"==a&amp;&amp;t in i)&amp;&amp;Object(s.a)(i[t],e)}},228:function(e,t,i){"use strict";var s=i(192),r=i(27);t.a=function(e,t){var i=-1,o=Object(r.a)(e)?Array(e.length):[];return Object(s.a)(e,(function(e,s,r){o[++i]=t(e,s,r)})),o}},570:function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));var s=i(207),r=i(208);function o(e,t,i){return(o=Object(r.a)()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return i&amp;&amp;Object(s.a)(o,i.prototype),o}).apply(null,arguments)}},571:function(e,t){var i={};e.exports=function(e,t){var s,r,o=Function.prototype,n=Array.prototype.slice;return e.bind===o.bind&amp;&amp;o.bind?o.bind.apply(e,n.call(arguments,1)):(s=n.call(arguments,2),r=function(){if(!(this instanceof r))return e.apply(t,s.concat(n.call(arguments)));i.prototype=e.prototype;var o=new i;i.prototype=null;var a=e.apply(o,s.concat(n.call(arguments)));return Object(a)===a?a:o})}},572:function(e,t){e.exports=Object.keys||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var i=[];for(var s in e)t.has(e,s)&amp;&amp;i.push(s);return i}},573:function(e,t,i){var s=i(148);e.exports=function(e){var t=[];for(var i in e)s.property(e,i)&amp;&amp;t.push(e[i]);return t}},574:function(e,t){e.exports=function(e,i,s){var r=[];return null==e?r:Array.prototype.filter&amp;&amp;e.filter===Array.prototype.filter?e.filter(i,s):(t.each(e,(function(e,t,o){i.call(s,e,t,o)&amp;&amp;(r[r.length]=e)})),r)}},575:function(e,t,i){var s=i(183);e.exports=function(e,t){return s(t,(function(t,i){e[i]=t})),e}},576:function(e,t,i){var s=i(183),r=function(e){this.__list=[],this.__map={},"function"===typeof e&amp;&amp;(this.generateKey=e)};r.prototype={each:function(e){s(this.__map,e)},get:function(e){var t=this.__map[e];return void 0===t&amp;&amp;(e=this.generateKey(e),t=this.__map[e]),t},generateKey:function(e){return e.toString()},getArray:function(){return this.__list},has:function(e){var t=this;return!!function(e){return void 0!==t.__map[e]}(e)||(!!this.__map[id]||this.__map[this.generateKey(e)])},put:function(e,t){e=this.generateKey(e),this.__map[e]=t,this.__list.push(t)},remove:function(e){e=this.get(e);var t=this.generateKey(e);return delete this.__map[t],this.__list.splice(this.__list.indexOf(e),1)[0]},size:function(){return this.__list.length},values:function(){return this.__list.slice(0)}},e.exports=r},577:function(e,t){e.exports=function(e,t){return e==t?0:e&lt;t?-1:e&gt;t?1:void 0}},578:function(e,t){e.exports=function(e,t){var i=t.indexOf(e);if(i&gt;-1)return t.splice(i,1)}},579:function(e,t,i){var s,r,o=i(132),n=i(150);s=function(e,t,i,s){n.call(this,e,t),this.id=s,this.faces=[],this.addFace(i)},o.extend(s,n),(r=s.prototype).addFace=function(e){return this.faces.push(e),this},r.getFaces=function(){return this.faces},r.getOtherEndFor=function(e){return this.a===e?this.b:this.b===e?this.a:void 0},r.remove=function(){for(var e=this,t=function(t){t.splice(t.indexOf(e),1)},i=0,s=this.faces.length;i&lt;s;i++)t(this.faces[i].edges);t(this.a.edges),t(this.b.edges)},r.toString=function(){return"id: "+this.id+" "+n.prototype.toString.call(this)+" f: "+this.faces.length},e.exports=s},580:function(e,t,i){var s=i(132),r=i(581),o=function(){r.call(this)};s.extend(o,r),o.prototype.computeSplitPoints=function(e){var t=[];return t.push(e.getMidPoint()),t},e.exports=o},581:function(e,t,i){var s,r,o=i(582);(s=function(){this._order=s.DEFAULT_ORDERING}).DEFAULT_ORDERING=new o,(r=s.prototype).getEdgeOrdering=function(){return this._order.compare},r.setEdgeOrdering=function(e){this._order=e},e.exports=s},582:function(e,t){var i=function(){};i.prototype.compare=function(e,t){return-parseInt(e.getLengthSquared()-t.getLengthSquared(),10)},e.exports=i},583:function(e,t,i){var s=i(132),r={bilinear:function(e,t,i,r,o,n,a,h,d,l){var u,f,c,m,_,p,x,g,v,y;s.has.XY(e)?(u=e.x,f=e.y,c=t.x,m=t.y,_=i.x,p=i.y,x=r,g=o,v=n,y=a):(u=e,f=t,c=i,m=r,_=o,p=n,x=a,g=h,v=d,y=l);var b=1/((_-c)*(p-m)),T=(u-c)*b,S=(_-u)*b,w=f-m,M=p-f;return x*S*M+g*T*M+v*S*w+y*T*w}};e.exports=r},584:function(e,t,i){t.TriangleMesh=i(151),t.BezierPatch=i(585),t.BoxSelector=i(586),t.DefaultSelector=i(587),t.Face=i(185),t.OBJWriter=i(588),t.PlaneSelector=i(589),t.SphereFunction=i(590),t.SphericalHarmonics=i(591),t.SurfaceMeshBuilder=i(592),t.SuperEllipsoid=i(593),t.Terrain=i(594),t.TriangleMesh=i(151),t.Vertex=i(186),t.VertexSelector=i(168),t.WETriangleMesh=i(595)},585:function(e,t,i){var s=i(136),r=i(151),o=i(146),n=function(e){if(o.Array(e))this.points=e;else{this.points=[];for(var t=0;t&lt;4;t++){this.points[t]=this.points[t]||[];for(var i=0;i&lt;4;i++)this.points[t][i]=new s}}};n.prototype={computePointAt:function(e,t){return n.computePointAt(e,t,this.points)},set:function(e,t,i){return this.points[t][e].set(i),this},toMesh:function(e,t){var i,s;void 0===t?(i=new r,s=e):(i=e,s=t);for(var o=new Array(s+1),n=new Array(s+1),a=1/s,h=0;h&lt;=s;h++){for(var d=0;d&lt;=s;d++){var l=this.computePointAt(d*a,h*a,this.points);d&gt;0&amp;&amp;h&gt;0&amp;&amp;(i.addFace(l,o[d-1],n[d-1]),i.addFace(l,n[d-1],n[d])),o[d]=l}var u=n;n=o,o=u}return i}},n.computePointAt=function(e,t,i){var r=1-e,o=r*r*3*e,n=r*r*r,a=e*e,h=1-t,d=h*h*h,l=t*t*t,u=r*a*3,f=e*a,c=h*(t*t*3),m=h*h*3*t,_=i[0],p=i[1],x=i[2],g=i[3],v=n*(_[0].x*d+_[1].x*m+_[2].x*c+_[3].x*l)+o*(p[0].x*d+p[1].x*m+p[2].x*c+p[3].x*l)+u*(x[0].x*d+x[1].x*m+x[2].x*c+x[3].x*l)+f*(g[0].x*d+g[1].x*m+g[2].x*c+g[3].x*l),y=n*(_[0].y*d+_[1].y*m+_[2].y*c+_[3].y*l)+o*(p[0].y*d+p[1].y*m+p[2].y*c+p[3].y*l)+u*(x[0].y*d+x[1].y*m+x[2].y*c+x[3].y*l)+f*(g[0].y*d+g[1].y*m+g[2].y*c+g[3].y*l),b=n*(_[0].z*d+_[1].z*m+_[2].z*c+_[3].z*l)+o*(p[0].z*d+p[1].z*m+p[2].z*c+p[3].z*l)+u*(x[0].z*d+x[1].z*m+x[2].z*c+x[3].z*l)+f*(g[0].z*d+g[1].z*m+g[2].z*c+g[3].z*l);return new s(v,y,b)},e.exports=n},586:function(e,t,i){var s=i(132).extend,r=i(168),o=function(e,t){r.apply(this,[e]),this.box=t};s(o,r),o.prototype.selectVertices=function(){this.clearSelection();for(var e=this.mesh.getVertices(),t=e.length,i=0;i&lt;t;i++){var s=e[i];this.box.containsPoint(s)&amp;&amp;this.selection.add(s)}return this},e.exports=o},587:function(e,t,i){var s=i(132).extend,r=i(168),o=function(e){r.call(this,e)};s(o,r),o.prototype.selectVertices=function(){return this.clearSelection(),this.selection=this.selection.concat(this.mesh.getVertices()),this},e.exports=o},588:function(e,t,i){var s=i(132),r=function(){this.buffer=[]};r.prototype.append=function(e){return this.buffer.push(e),this},r.prototype.toString=function(){return this.buffer.join("")};var o=function(){this.VERSION="0.3",this.__stringBuffer=new r,this.objStream=void 0,this.__filename="objwriter.obj",this._numVerticesWritten=0,this._numNormalsWritten=0};o.prototype={beginSave:function(e){"string"==typeof e||s.hasProperties(e,e.writable)&amp;&amp;(this.objStream=e),this._handleBeginSave()},endSave:function(){if(void 0!==this.objStream)try{this.objStream.destroy()}catch(e){}},face:function(e,t,i){this.__stringBuffer.append("f "+e+" "+t+" "+i+"\n")},faceList:function(){this.__stringBuffer.append("s off \n")},faceWithNormals:function(e,t,i,s,r,o){this.__stringBuffer.append("f "+e+"//"+s+" "+t+"//"+r+" "+i+"//"+o+"\n")},getCurrNormalOffset:function(){return this._numNormalsWritten},getCurrVertexOffset:function(){return this._numVerticesWritten},getOutput:function(){return this.__stringBuffer.toString()},_handleBeginSave:function(){this.numVerticesWritten=0,this.numNormalsWrittern=0,this.__stringBuffer.append("# generated by OBJExport (js) v"+this.VERSION+"\n")},newObject:function(e){this.__stringBuffer.append("o "+e+"\n")},normal:function(e){this.__stringBuffer.append("vn "+e.x+" "+e.y+" "+e.z+"\n"),this._numNormalsWritten++},vertex:function(e){this.__stringBuffer.append("v "+e.x+" "+e.y+" "+e.z+"\n"),this._numVerticesWritten++}},e.exports=o},589:function(e,t,i){var s=i(132).extend,r=i(168),o=function(e,t,i,s){r.apply(this,[e]),this.plane=t,this.classifier=i,this.tolerances=void 0===s?1e-4:s};s(o,r),o.prototype.selectVertices=function(){this.clearSelection();for(var e=this.mesh.getVertices(),t=e.length,i=0;i&lt;t;i++){var s=e[i];this.plane.classifyPoint(s,this.tolerance)==this.classifier&amp;&amp;this.selection.add(s)}return this},e.exports=o},590:function(e,t,i){e.exports=i(187).SphereFunction},591:function(e,t,i){var s=i(134),r=function(e){this.m=e};r.prototype={computeVertexFor:function(e,t,i){var r=0;r+=Math.pow(s.sin(this.m[0]*i),this.m[1]),r+=Math.pow(s.cos(this.m[2]*i),this.m[3]),r+=Math.pow(s.sin(this.m[4]*t),this.m[5]),r+=Math.pow(s.cos(this.m[6]*t),this.m[7]);var o=s.sin(i);return e.x=r*o*s.cos(t),e.y=r*s.cos(i),e.z=r*o*s.sin(t),e},getPhiRange:function(){return s.TWO_PI},getPhiResolutionLimit:function(e){return e},getThetaRange:function(){return s.PI},getThetaResolutionLimit:function(e){return e}},e.exports=r},592:function(e,t,i){e.exports=i(156).SurfaceMeshBuilder},593:function(e,t,i){var s=i(134),r=(i(151),function(e,t){this.p1=e,this.p2=t});r.prototype={computeVertexFor:function(e,t,i){t-=s.HALF_PI;var r=s.cos(t),o=s.cos(i),n=s.sin(t),a=s.sin(i),h=s.sign(r)*Math.pow(s.abs(r),this.p1);return e.x=h*s.sign(o)*Math.pow(Math.abs(o),this.p2),e.y=s.sign(n)*Math.pow(Math.abs(n),this.p1),e.z=h*s.sign(a)*Math.pow(s.abs(a),this.p2),e},getPhiRange:function(){return s.TWO_PI},getPhiResolutionLimit:function(e){return e/2},getThetaRange:function(){return s.TWO_PI},getThetaResolutionLimit:function(e){return e}},e.exports=r},594:function(e,t,i){e.exports=i(156).Terrain},595:function(e,t,i){e.exports=i(156).WETriangleMesh},596:function(e,t){var i=function(e){this.circle=e,this.isec=void 0};i.prototype={getIntersectionData:function(){return this.isec},intersectsRay:function(e){this.isec.clear();var t=circle.sub(e),i=t.magSquared(),s=t.dot(e.getDirection()),r=circle.getRadius(),o=r*r-(i-s*s);return o&gt;=0&amp;&amp;(this.isec.isIntersection=!0,this.isec.dist=s-Math.sqrt(o),this.isec.pos=e.getPointAtDistance(isec.dist),this.isec.normal=this.isec.pos.sub(this.circle).normalize()),this.isec.isIntersection}},e.exports=i},597:function(e,t,i){var s=i(152),r=i(157),o=function(e){this.setBounds(e)};o.prototype={constructor:o,clipPolygon:function(e){var t,i,s,o,n,a,h=e.vertices.slice(0),d=this.bounds.getEdges(),l=0,u=0;for(h.push(h[0]),l=0;l&lt;d.length;l++){for(t=[],o=(i=d[l]).classifyPoint(this.boundsCentroid),u=0;u&lt;h.length-1;u++)n=h[u],a=h[u+1],i.classifyPoint(n)!==o?i.classifyPoint(a)===o&amp;&amp;(t.push(this._getClippedPosOnEdge(i,n,a)),t.push(a.copy())):i.classifyPoint(a)===o?t.push(a.copy()):t.push(this._getClippedPosOnEdge(i,n,a));t.length&gt;0&amp;&amp;t[0]!==t[t.length-1]&amp;&amp;t.push(t[0]),s=h,h=t,t=s}return new r(h).removeDuplicates(.001)},getBounds:function(){return this.bounds},_getClippedPosOnEdge:function(e,t,i){return e.intersectLine(new s(t,i)).getPos()},_isKnownVertex:function(e,t){for(var i=0,s=e.length;i&lt;s;i++)if(e[i].equalsWitTolerance(t,.001))return!0;return!1},setBounds:function(e){this.bounds=e,this.boundsCentroid=this.bounds.getCentroid()}},e.exports=o},598:function(e,t,i){var s=i(143),r=function(e){void 0!==e?(this.isIntersection=e.isIntersection,this.dist=e.dist,this.pos=e.pos.copy(),this.dir=e.dir.copy(),this.normal=e.normal.copy()):this.clear()};r.prototype={clear:function(){this.isIntersection=!1,this.dist=0,this.pos=new s,this.dir=new s,this.normal=new s},toString:function(){var e="isec: "+this.isIntersection;return this.isIntersection&amp;&amp;(e+=" at:"+this.pos+" dist:"+this.dist+" normal:"+this.normal),e}},e.exports=r},599:function(e,t,i){var s=i(149).Vec3D,r=i(150),o=i(148).XYZ,n=i(216),a=function(e){this.vertices=e||[]};a.prototype={constructor:a,add:function(e,t,i){return o(e)?this.vertices.push(new s(e)):this.vertices.push(new s(e,t,i)),this},get:function(e){return e&lt;0&amp;&amp;(e+=this.vertices.length),this.vertices[e]},getDecimatedVertices:function(e,t){!1!==t&amp;&amp;(t=!0);var i=[];if(this.vertices.length&lt;3){if(2!==this.vertices.length)return;new r(this.vertices[0],this.vertices[1]).splitIntoSegments(i,e,!0),t||i.pop()}var s,o,n,a,h,d,l=this.getEstimatedArcLength(),u=e/l,f=0;for(o=0;o&lt;1;o+=u){for(s=o*l;s&gt;=this.arcLenIndex[f];)f++;n=this.get(f-1),a=this.get(f),h=(s-this.arcLenIndex[f-1])/(this.arcLenIndex[f]-this.arcLenIndex[f-1]),d=n.interpolateTo(a,h),i.push(d)}return t&amp;&amp;i.push(this.get(-1).copy()),i},getEstimatedArcLength:function(){void 0!==this.arcLenIndex&amp;&amp;this.arcLenIndex.length===this.vertices.length||(this.arcLenIndex=[0]);for(var e,t,i=0,s=1,r=this.vertices.length;s&lt;r;s++)e=this.vertices[s-1],t=this.vertices[s],i+=e.distanceTo(t),this.arcLenIndex[s]=i;return i},getSegments:function(){for(var e=1,t=this.vertices.length,i=[];e&lt;t;e++)i.push(new r(this.get(e-1),this.get(e)));return i},getVertices:function(){return vertices},iterator:function(){return new n(this.vertices)},setVertices:function(e){this.vertices=e}},e.exports=a},600:function(e,t,i){var s=i(132).extend,r=i(134),o=i(166),n=i(149),a=n.Vec3D,h=(n.Vec2D,i(151)),d=function(e,t){var i,s;0===arguments.length?(i=new a,s=a.Y_AXIS.copy()):1==arguments.length?(i=arguments[0].computeCentroid(),s=arguments[0].computeNormal()):(i=arguments[0],s=arguments[1].getNormalized()),a.apply(this,[i]),this.normal=s};s(d,a),d.Classifier={FRONT:"front",BACK:"back",ON_PLANE:"on plane"},d.XY=new d(new a,a.Z_AXIS),d.XZ=new d(new a,a.Y_AXIS),d.YZ=new d(new a,a.X_AXIS),d.prototype.classifyPoint=function(e,t){var i=this.sub(e).normalize().dot(this.normal);return i&lt;-t?d.Classifier.FRONT:i&gt;t?d.Classifier.BACK:d.Classifier.ON_PLANE},d.prototype.containsPoint=function(e){return this.classifyPoint(e,r.EPS)==d.Classifier.ON_PLANE},d.prototype.getDistanceToPoint=function(e){var t=this.normal.dot(e.sub(this)),i=this.normal.magSquared();return e.add(this.normal.scale(t/i)).distanceTo(e)},d.prototype.getIntersectionWithRay=function(e){var t,i=this.normal.dot(e.getDirection());return i&gt;r.EPS?(t=this.normal.dot(this.sub(e))/i,e.getPointAtDistance(t)):void 0},d.prototype.getProjectedPoint=function(e){var t;return t=this.normal.dot(this.sub(e))&lt;0?this.normal.getInverted():this.normal,new o(e,t).getPointAtDistance(this.getDistanceToPoint(e))},d.prototype.intersectRayDistance=function(e){var t=this.normal.dot(this),i=this.normal.dot(e)+t,s=this.normal.dot(e.dir);return r.abs(s)&lt;r.EPS?-1:-i/s},d.prototype.toMesh=function(e,t){1===arguments.length&amp;&amp;"number"==typeof arguments[0]&amp;&amp;(t=e,e=null),e=e||new h("plane",4,2);var i=this.equalsWithTolerance(a.ZERO,.01)?this.add(.01,.01,.01):this;t*=.5;var s=i.cross(this.normal).normalizeTo(t),r=s.cross(this.normal).normalizeTo(t),o=this.add(s).addSelf(r),n=this.add(s).subSelf(r),d=this.sub(s).subSelf(r),l=this.sub(s).addSelf(r);return e.addFace(o,l,n,void 0,void 0,void 0,void 0),e.addFace(n,l,d,void 0,void 0,void 0,void 0),e},e.exports=d},601:function(e,t,i){var s,r=i(167),o=i(134);(s=function(e){this.ray=e,this.isec=new r}).prototype={getIntersectionData:function(){return this.isec},intersectsRay:function(e){var t,i=this.ray.dir.cross(e.dir),s=this.ray.sub(e),r=o.abs(i.x),n=o.abs(i.y),a=o.abs(i.z);return t=a&gt;r&amp;&amp;a&gt;n?(s.x*e.dir.y-s.y*e.dir.x)/i.z:r&gt;n?(s.y*e.dir.z-s.z*e.dir.y)/i.x:(s.z*e.dir.x-s.x*e.dir.z)/i.y,this.isec.isIntersection=t&lt;=o.EPS&amp;&amp;!isFinite(t),this.isec.pos=this.ray.getPointAtDistance(-t),this.isec.isIntersection}},e.exports=s},602:function(e,t,i){var s=i(143),r=i(146),o=i(188),n=function e(t,i,o){1===arguments.length&amp;&amp;!r.Array(t)&amp;&amp;r.Object(t)&amp;&amp;(i=i||t.bernsteinPoly,o=o||t.tightness,t=t.points);var n,a=0;if(this.pointList=[],"number"!==typeof o&amp;&amp;(o=e.DEFAULT_TIGHTNESS),this.setTightness(o),this.bernstein=i,void 0!==t)for(a=0,n=t.length;a&lt;n;a++)this.add(t[a].copy());for(this.coeffA=[],this.delta=[],this.bi=[],a=0;a&lt;this.numP;a++)this.coeffA[a]=new s,this.delta[a]=new s,this.bi[a]=0;this.bi=[]};n.prototype={add:function(e){return this.pointList.push(e.copy()),this.numP=this.pointList.length,this},computeVertices:function(e){this.updateCoefficients(),e&lt;1&amp;&amp;(e=1),e++,void 0!==this.bernstein&amp;&amp;this.bernstein.resolution==e||(this.bernstein=new o(e));var t=this.bernstein;this.findCPoints();var i=new s,r=new s;e--;var n=(this.numP-1)*e+1;"undefined"!=typeof this.vertices&amp;&amp;this.vertices.length==n||(this.vertices=Array.apply(null,Array(n)).map((function(){return new s})));for(var a=0,h=0;h&lt;this.numP-1;h++){var d=this.points[h],l=this.points[h+1];i.x=this.delta[h].x+d.x,i.y=this.delta[h].y+d.y,r.x=l.x-this.delta[h+1].x,r.y=l.y-this.delta[h+1].y;for(var u=0;u&lt;e;u++){var f=d.x*t.b0[u]+i.x*t.b1[u]+r.x*t.b2[u]+l.x*t.b3[u],c=d.y*t.b0[u]+i.y*t.b1[u]+r.y*t.b2[u]+l.y*t.b3[u];this.vertices[a].x=f,this.vertices[a].y=c,a++}}return this.vertices[a].x=this.vertices[a-1].x,this.vertices[a].y=this.vertices[a-1].y,this.vertices},findCPoints:function(){var e,t,i,s;for(this.bi[1]=-.25,t=this.pointList[0],i=this.pointList[2],s=this.delta[0],this.coeffA[1].x=(i.x-t.x-s.x)*this.tightness,this.coeffA[1].y=(i.y-t.y-s.y)*this.tightness,e=2;e&lt;this.numP-1;e++)this.bi[e]=-1/(this.invTightness+this.bi[e-1]),this.coeffA[e].x=-(this.points[e+1].x-this.points[e-1].x-this.coeffA[e-1].x)*this.bi[e],this.coeffA[e].y=-(this.points[e+1].y-this.points[e-1].y-this.coeffA[e-1].y)*this.bi[e];for(e=this.numP-2;e&gt;0;e--)this.delta[e].x=this.coeffA[e].x+this.delta[e+1].x*this.bi[e],this.delta[e].y=this.coeffA[e].y+this.delta[e+1].y*this.bi[e]},getDecimatedVertices:function(e,t){void 0===t&amp;&amp;(t=!0),(void 0===this.vertices||this.vertices.length&lt;2)&amp;&amp;this.computeVertices(n.DEFAULT_RES);for(var i=this.getEstimatedArcLength(),s=[],r=e/i,o=0,a=0;a&lt;1;a+=r){for(var h=a*i;h&gt;=this.arcLenIndex[o];)o++;var d=this.vertices[o-1],l=this.vertices[o],u=(h-this.arcLenIndex[o-1])/(this.arcLenIndex[o]-this.arcLenIndex[o-1]),f=d.interpolateTo(l,u);s.push(f)}return t&amp;&amp;s.push(this.vertices[this.vertices.length-1]),s},getEstimatedArcLength:function(){var e,t=0;void 0===this.arcLenIndex||void 0!==this.arcLenIndex&amp;&amp;this.arcLenIndex.length!=this.vertices.length?(this.arcLenIndex=[0],e=this.vertices.length):e=this.arcLenIndex.length;for(var i=1;i&lt;e;i++){var s=this.vertices[i-1],r=this.vertices[i];t+=s.distanceTo(r),this.arcLenIndex[i]=t}return t},getNumPoints:function(){return this.numP},getPointList:function(){return this.pointList},getTightness:function(){return this.tightness},setPointList:function(e){return this.pointList=e.slice(0),this},setTightness:function(e){return this.tightness=e,this.invTightness=1/this.tightness,this},updateCoefficients:function(){if(this.numP=this.pointList.length,void 0===this.points||void 0!==this.points&amp;&amp;this.points.length!=this.numP){this.coeffA=[],this.delta=[],this.bi=[];for(var e=0;e&lt;this.numP;e++)this.coeffA[e]=new s,this.delta[e]=new s;this.setTightness(this.tightness)}this.points=this.pointList.slice(0)}},n.DEFAULT_TIGHTNESS=.25,n.DEFAULT_RES=16,e.exports=n},603:function(e,t,i){var s=i(136),r=i(146),o=i(188),n=function e(t,i,o){1===arguments.length&amp;&amp;!r.Array(t)&amp;&amp;r.Object(t)&amp;&amp;(i=i||t.bernsteinPoly,o=o||t.tightness,t=t.points);var n,a=0;if(this.pointList=[],"number"!==typeof o&amp;&amp;(o=e.DEFAULT_TIGHTNESS),this.setTightness(o),this.bernstein=i,void 0!==t)for(a=0,n=t.length;a&lt;n;a++)this.add(t[a].copy());for(this.coeffA=[],this.delta=[],this.bi=[],a=0;a&lt;this.numP;a++)this.coeffA[a]=new s,this.delta[a]=new s,this.bi[a]=0;this.bi=[]};n.prototype={add:function(e){return this.pointList.push(e.copy()),this.numP=this.pointList.length,this},computeVertices:function(e){this.updateCoefficients(),e&lt;1&amp;&amp;(e=1),e++,void 0!==this.bernstein&amp;&amp;this.bernstein.resolution==e||(this.bernstein=new o(e));var t=this.bernstein;this.vertices=[],this.findCPoints();var i=new s,r=new s;e--;for(var n=0;n&lt;this.numP-1;n++){var a=this.points[n],h=this.points[n+1];i.set(this.delta[n]).addSelf(a),r.set(h).subSelf(this.delta[n+1]);for(var d=0;d&lt;e;d++){var l=a.x*t.b0[d]+i.x*t.b1[d]+r.x*t.b2[d]+h.x*t.b3[d],u=a.y*t.b0[d]+i.y*t.b1[d]+r.y*t.b2[d]+h.y*t.b3[d],f=a.z*t.b0[d]+i.z*t.b1[d]+r.z*t.b2[d]+h.z*t.b3[d];this.vertices.push(new s(l,u,f))}}return this.vertices.push(this.points[this.points.length-1].copy()),this.vertices},findCPoints:function(){var e,t,i,s;for(this.bi[1]=-.25,t=this.pointList[0],i=this.pointList[2],s=this.delta[0],this.coeffA[1].set((i.x-t.x-s.x)*this.tightness,(i.y-t.y-s.y)*this.tightness,(i.z-t.z-s.z)*this.tightness),e=2;e&lt;this.numP-1;e++)this.bi[e]=-1/(this.invTightness+this.bi[e-1]),this.coeffA[e].set(-(this.points[e+1].x-this.points[e-1].x-this.coeffA[e-1].x)*this.bi[e],-(this.points[e+1].y-this.points[e-1].y-this.coeffA[e-1].y)*this.bi[e],-(this.points[e+1].z-this.points[e-1].z-this.coeffA[e-1].z)*this.bi[e]);for(e=this.numP-2;e&gt;0;e--)this.delta[e].set(this.coeffA[e].x+this.delta[e+1].x*this.bi[e],this.coeffA[e].y+this.delta[e+1].y*this.bi[e],this.coeffA[e].z+this.delta[e+1].z*this.bi[e])},getDecimatedVertices:function(e,t){void 0===t&amp;&amp;(t=!0),(void 0===this.vertices||this.vertices.length&lt;2)&amp;&amp;this.computeVertices(n.DEFAULT_RES);for(var i=this.getEstimatedArcLength(),s=[],r=e/i,o=0,a=0;a&lt;1;a+=r){for(var h=a*i;h&gt;=this.arcLenIndex[o];)o++;var d=this.vertices[o-1],l=this.vertices[o],u=(h-this.arcLenIndex[o-1])/(this.arcLenIndex[o]-this.arcLenIndex[o-1]),f=d.interpolateTo(l,u);s.push(f)}return t&amp;&amp;s.push(this.vertices[this.vertices.length-1]),s},getEstimatedArcLength:function(){var e,t=0;void 0===this.arcLenIndex||void 0!==this.arcLenIndex&amp;&amp;this.arcLenIndex.length!=this.vertices.length?(this.arcLenIndex=[0],e=this.vertices.length):e=this.arcLenIndex.length;for(var i=1;i&lt;e;i++){var s=this.vertices[i-1],r=this.vertices[i];t+=s.distanceTo(r),this.arcLenIndex[i]=t}return t},getNumPoints:function(){return this.numP},getPointList:function(){return this.pointList},getTightness:function(){return this.tightness},setPointList:function(e){return this.pointList=e.slice(0),this},setTightness:function(e){return this.tightness=e,this.invTightness=1/this.tightness,this},updateCoefficients:function(){if(this.numP=this.pointList.length,void 0===this.points||void 0!==this.points&amp;&amp;this.points.length!=this.numP){this.coeffA=[],this.delta=[],this.bi=[];for(var e=0;e&lt;this.numP;e++)this.coeffA[e]=new s,this.delta[e]=new s;this.setTightness(this.tightness)}this.points=this.pointList.slice(0)}},n.DEFAULT_TIGHTNESS=.25,n.DEFAULT_RES=16,e.exports=n},604:function(e,t,i){var s=i(157),r=i(149).Vec2D,o={0:function(e,t,i){var s=t.x+(e.y-t.y)*(i.x-t.x)/(i.y-t.y);return new r(s,e.y)},1:function(e,t,i){var s=e.x+e.width,o=t.y+(s-t.x)*(i.y-t.y)/(i.x-t.x);return new r(s,o)},2:function(e,t,i){var s=e.y+e.height,o=t.x+(s-t.y)*(i.x-t.x)/(i.y-t.y);return new r(o,s)},3:function(e,t,i){var s=t.y+(e.x-t.x)*(i.y-t.y)/(i.x-t.x);return new r(e.x,s)}},n=function(e,t,i,s){return o[t](e,i,s)},a={0:function(e,t){return t.y&gt;=e.y},1:function(e,t){return t.x&lt;e.x+e.width},2:function(e,t){return t.y&lt;e.y+e.height},3:function(e,t){return t.x&gt;=e.x}},h=function(e,t,i){return a[i](e,t)},d=function(e){this.bounds=e};d.prototype={constructor:d,clipPolygon:function(e){var t,i,r,o=e.vertices.slice(0),a=0,d=0,l=o.length-1;for(o.push(o[0]);a&lt;4;a++){for(d=0,l=o.length-1,t=[];d&lt;l;d++)i=o[d],r=o[d+1],h(this.bounds,i,a)?h(this.bounds,r,a)?t.push(r.copy()):t.push(n(this.bounds,a,i,r)):h(this.bounds,r,a)&amp;&amp;(t.push(n(this.bounds,a,i,r)),t.push(r.copy()));t.length&gt;0&amp;&amp;t[0]!==t[t.length-1]&amp;&amp;t.push(t[0]),o=t}return new s(o).removeDuplicates(.001)},getBounds:function(){return this.bounds},isKnownVertex:function(e,t){for(var i=0,s=e.length;i&lt;s;i++)if(e[i].equalsWithTolerance(t,1e-4))return!0;return!1},setBounds:function(e){this.bounds=e}},e.exports=d},605:function(e,t,i){var s=i(143),r=i(152),o=i(169),n=i(160),a=i(157),h=i(134),d=function(e,t,i){3===arguments.length&amp;&amp;(this.a=e.copy(),this.b=t.copy(),this.c=i.copy())};d.createEquilateralFrom=function(e,t){var i=e.interpolateTo(t,.5),s=e.sub(t),r=s.getPerpendicular();return i.addSelf(r.normalizeTo(s.magnitude()*h.SQRT3/2)),new d(e,t,i)},d.isClockwise=function(e,t,i){return(t.x-e.x)*(i.y-e.y)-(i.x-e.x)*(t.y-e.y)&lt;0},d.prototype={adjustTriangleSizeBy:function(e,t,i){1==arguments.length&amp;&amp;(t=e,i=e),this.computeCentroid();var s=new r(this.a.copy(),this.b.copy()).offsetAndGrowBy(e,1e5,this.centroid),o=new r(this.b.copy(),this.c.copy()).offsetAndGrowBy(t,1e5,this.centroid),n=new r(this.c.copy(),this.a.copy()).offsetAndGrowBy(i,1e5,this.centroid);return this.a=s.intersectLine(n).getPos(),this.b=s.intersectLine(o).getPos(),this.c=o.intersectLine(n).getPos(),this.computeCentroid(),this},computeCentroid:function(){return this.centroid=this.a.add(this.b).addSelf(this.c).scaleSelf(1/3),this.centroid},containsPoint:function(e){var t=e.sub(this.a).normalize(),i=e.sub(this.b).normalize(),s=e.sub(this.c).normalize(),r=Math.acos(t.dot(i));return r+=Math.acos(i.dot(s)),r+=Math.acos(s.dot(t)),h.abs(r-h.TWO_PI)&lt;=.01},copy:function(){return new d(this.a.copy(),this.b.copy(),this.c.copy())},flipVertexOrder:function(){var e=this.a;return this.a=this.c,this.c=e,this},getArea:function(){return.5*this.b.sub(this.a).cross(this.c.sub(this.a))},getBounds:function(){return new o(s.min(s.min(this.a,this.b),this.c),s.max(s.max(this.a,this.b),this.c))},getCircumCircle:function(){var e=this.a.bisect(this.b).cross(this.b.bisect(this.c)),t=new s(e.x/e.z,e.y/e.z),i=this.a.distanceTo(this.b),r=this.b.distanceTo(this.c),o=this.c.distanceTo(this.a),a=i*r*o/Math.sqrt((i+r+o)*(-i+r+o)*(i-r+o)*(i+r-o));return new n(t,a)},getCircumference:function(){return this.a.distanceTo(this.b)+this.b.distanceTo(this.c)+this.c.distanceTo(this.a)},getClosestPointTo:function(e){var t=new r(this.a,this.b),i=t.closestPointTo(e),s=t.set(this.b,this.c).closestPointTo(e),o=t.set(this.c,this.a).closestPointTo(e),n=e.sub(i).magSquared(),a=e.sub(s).magSquared(),h=n,d=i;return a&lt;h&amp;&amp;(h=a,d=s),e.sub(o).magSquared()&lt;h&amp;&amp;(d=o),d},intersectsTriangle:function(e){if(this.containsPoint(e.a)||this.containsPoint(e.b)||this.containsPoint(e.c))return!0;if(e.containsPoint(this.a)||e.containsPoint(this.b)||e.containsPoint(this.c))return!0;for(var t=[new r(this.a,this.b),new r(this.b,this.c),new r(this.c,this.a)],i=[new r(e.a,e.b),new r(e.b,e.c),new r(e.c,e.a)],s=0,o=t.length;s&lt;o;s++)for(var n=t[s],a=0,h=i.length;a&lt;h;a++){var d=i[a],l=n.intersectLine(d).getType();if(l!=r.LineIntersection.Type.NON_INTERSECTING&amp;&amp;l!=r.LineIntersection.Type.PARALLEL)return!0}return!1},isClockwise:function(){return d.isClockwise(this.a,this.b,this.c)},set:function(e,t,i){this.a=e,this.b=t,this.c=i},toPolygon2D:function(){var e=new a;return e.add(this.a.copy()),e.add(this.b.copy()),e.add(this.c.copy()),e},toString:function(){return"Triangle2D: "+this.a+","+this.b+","+this.c}},e.exports=d},606:function(e,t,i){var s=i(132).extend,r=i(134),o=i(136),n=i(190),a=function(e,t,i){n.apply(this,[e,t,i])};s(a,n),a.prototype.containsPoint=function(e){if(r.abs(e.x-this.pos.x)&lt;.5*this.length){var t=e.y-this.pos.y,i=e.z-this.pos.z;if(Math.abs(i*i+t*t)&lt;this.radiusSquared)return!0}return!1},a.prototype.getMajorAxis=function(){return o.Axis.X},e.exports=a},607:function(e,t,i){var s=i(132).extend,r=i(134),o=i(136),n=i(190),a=function(e,t,i){n.apply(this,[e,t,i])};s(a,n),a.prototype.containsPoint=function(e){if(r.abs(e.y-this.pos.y)&lt;.5*this.length){var t=e.x-this.pos.x,i=e.z-this.pos.z;if(Math.abs(i*i+t*t)&lt;this.radiusSquared)return!0}return!1},a.prototype.getMajorAxis=function(){return o.Axis.Y},e.exports=a},608:function(e,t,i){var s=i(132).extend,r=i(134),o=i(136),n=i(190),a=function(e,t,i){n.apply(this,[e,t,i])};s(a,n),a.prototype.containsPoint=function(e){if(r.abs(e.z-this.pos.z)&lt;.5*this.length){var t=e.x-this.pos.x,i=e.y-this.pos.y;if(Math.abs(t*t+i*i)&lt;this.radiusSquared)return!0}return!1},a.prototype.getMajorAxis=function(){return o.Axis.Z},e.exports=a},609:function(module,exports,__webpack_require__){Array.forEach||(Array.forEach=function(e,t,i){for(var s=e.length,r=0;r&lt;s;r++)r in e&amp;&amp;t.call(i,e[r],r,e)}),Array.map||(Array.map=function(e,t,i){for(var s=e.length,r=[],o=0;o&lt;s;o++)o in e&amp;&amp;(r[o]=t.call(i,e[o],o,e));return r}),Array.filter||(Array.filter=function(e,t,i){for(var s=e.length,r=[],o=0;o&lt;s;o++)if(o in e){var n=e[o];t.call(i,n,o,e)&amp;&amp;r.push(n)}return r});var x3dom={canvases:[],x3dNS:"http://www.web3d.org/specifications/x3d-namespace",x3dextNS:"http://philip.html5.org/x3d/ext",xsltNS:"http://www.w3.org/1999/XSL/x3dom.Transform",xhtmlNS:"http://www.w3.org/1999/xhtml"};function defineClass(e,t,i){if(e){var s=function(){};s.prototype=e.prototype,t.prototype=new s,t.prototype.constructor=t,t.superClass=e}if(i)for(var r in i)t.prototype[r]=i[r];return t}function array_to_object(e){for(var t={},i=0;i&lt;e.length;i++)t[e[i]]="";return t}function uploadDDSLevels(e,t,i,s){function r(e){return e.charCodeAt(0)+(e.charCodeAt(1)&lt;&lt;8)+(e.charCodeAt(2)&lt;&lt;16)+(e.charCodeAt(3)&lt;&lt;24)}var o,n,a,h,d,l,u,f,c,m,_,p=r("DXT1"),x=r("DXT5"),g=new Int32Array(i,0,31);if(542327876!=g[0])return console.error("Invalid magic number in DDS header"),0;if(4&amp;!g[20])return console.error("Unsupported format, must contain a FourCC code"),0;switch(o=g[21]){case p:n=8,a=t.COMPRESSED_RGBA_S3TC_DXT1_EXT;break;case x:n=16,a=t.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return console.error("Unsupported FourCC code:",(_=o,String.fromCharCode(255&amp;_,_&gt;&gt;8&amp;255,_&gt;&gt;16&amp;255,_&gt;&gt;24&amp;255))),null}for(c=1,131072&amp;g[2]&amp;&amp;!1!==s&amp;&amp;(c=Math.max(1,g[7])),h=g[4],d=g[3],u=g[1]+4,m=0;m&lt;c;++m)l=Math.max(4,h)/4*Math.max(4,d)/4*n,f=new Uint8Array(i,u,l),e.compressedTexImage2D(e.TEXTURE_2D,m,a,h,d,0,f),u+=l,h*=.5,d*=.5;return c}function startDashVideo(e,t){var i,s,r,o=function(){var e={};window.location.href.replace(/[?&amp;]+([^=&amp;]+)=([^&amp;]*)/gi,(function(t,i,s){e[i]=s}));return e},n=e;o&amp;&amp;o.hasOwnProperty("url")&amp;&amp;(n=o.url),i=document.querySelector(t),s=new Dash.di.DashContext,(r=new MediaPlayer(s)).startup(),r.attachView(i),r.setAutoPlay(!1),r.attachSource(n)}x3dom.nodeTypes={},x3dom.nodeTypesLC={},x3dom.components={},x3dom.geoCache=[],x3dom.caps={PLATFORM:navigator.platform,AGENT:navigator.userAgent,RENDERMODE:"HARDWARE"},x3dom.registerNodeType=function(e,t,i){void 0===x3dom.components[t]&amp;&amp;(x3dom.components[t]={}),i._typeName=e,i._compName=t,x3dom.components[t][e]=i,x3dom.nodeTypes[e]=i,x3dom.nodeTypesLC[e.toLowerCase()]=i},x3dom.isX3DElement=function(e){var t=e.nodeType===Node.ELEMENT_NODE&amp;&amp;e.localName?e.localName.toLowerCase():null;return t&amp;&amp;(x3dom.nodeTypes[e.localName]||x3dom.nodeTypesLC[t]||"x3d"==t||"websg"==t||"route"==t)},x3dom.extend=function(e){function t(){}return t.prototype=e.prototype||e,new t},x3dom.getStyle=function(e,t){var i="",s=document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(e,null):null;return s?i=s.getPropertyValue(t):e.currentStyle&amp;&amp;(t=t.replace(/\-(\w)/g,(function(e,t){return t.toUpperCase()})),i=e.currentStyle[t]),i},x3dom.isa=function(e,t){return e instanceof t},x3dom.getGlobal=function(){return function(){return this}.call(null)},x3dom.loadJS=function(src,path_prefix,blocking){if(blocking=!1!==blocking||blocking,blocking){var url=path_prefix?path_prefix.trim()+src:src,req=new XMLHttpRequest;req&amp;&amp;(req.open("GET",url,!1),req.send(null),eval(req.responseText))}else{var head=document.getElementsByTagName("HEAD").item(0),script=document.createElement("script"),loadpath=path_prefix?path_prefix.trim()+src:src;head?(x3dom.debug.logError("Trying to load external JS file: "+loadpath),script.type="text/javascript",script.src=loadpath,head.appendChild(script)):alert("No document object found. Can't load components!")}},window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,16)},x3dom.toggleFullScreen=function(){if(document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen)document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&amp;&amp;document.webkitCancelFullScreen();else{var e=document.documentElement;e.requestFullScreen?e.requestFullScreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullScreen&amp;&amp;e.webkitRequestFullScreen()}},x3dom.debug={INFO:"INFO",WARNING:"WARNING",ERROR:"ERROR",EXCEPTION:"EXCEPTION",isActive:!1,isFirebugAvailable:!1,isSetup:!1,isAppend:!1,numLinesLogged:0,maxLinesToLog:1e4,logContainer:null,setup:function(){if(!x3dom.debug.isSetup){try{void 0!==window.console.firebug&amp;&amp;(x3dom.debug.isFirebugAvailable=!0)}catch(e){x3dom.debug.isFirebugAvailable=!1}x3dom.debug.setupLogContainer(),x3dom.debug.isSetup=!0}},activate:function(e){x3dom.debug.isActive=!0,x3dom.debug.logContainer.style.display=e?"block":"none",x3dom.debug.isAppend||("Microsoft Internet Explorer"==navigator.appName?(x3dom.debug.logContainer.style.marginLeft="8px",document.documentElement.appendChild(x3dom.debug.logContainer)):document.body.appendChild(x3dom.debug.logContainer),x3dom.debug.isAppend=!0)},setupLogContainer:function(){x3dom.debug.logContainer=document.createElement("div"),x3dom.debug.logContainer.id="x3dom_logdiv",x3dom.debug.logContainer.setAttribute("class","x3dom-logContainer"),x3dom.debug.logContainer.style.clear="both"},doLog:function(e,t){if(x3dom.debug.isActive&amp;&amp;(x3dom.debug.numLinesLogged===x3dom.debug.maxLinesToLog&amp;&amp;(e="Maximum number of log lines (="+x3dom.debug.maxLinesToLog+") reached. Deactivating logging..."),!(x3dom.debug.numLinesLogged&gt;x3dom.debug.maxLinesToLog))){var i=document.createElement("p");switch(i.style.margin=0,t){case x3dom.debug.INFO:i.style.color="#00ff00";break;case x3dom.debug.WARNING:i.style.color="#cd853f";break;case x3dom.debug.ERROR:i.style.color="#ff4500";break;case x3dom.debug.EXCEPTION:i.style.color="#ffff00";break;default:i.style.color="#00ff00"}try{i.innerHTML=t+": "+e,x3dom.debug.logContainer.insertBefore(i,x3dom.debug.logContainer.firstChild)}catch(s){void 0!==window.console.firebug&amp;&amp;window.console.warn(e)}if(x3dom.debug.isFirebugAvailable)switch(t){case x3dom.debug.INFO:window.console.info(e);break;case x3dom.debug.WARNING:window.console.warn(e);break;case x3dom.debug.ERROR:window.console.error(e);break;case x3dom.debug.EXCEPTION:window.console.debug(e)}x3dom.debug.numLinesLogged++}},logInfo:function(e){x3dom.debug.doLog(e,x3dom.debug.INFO)},logWarning:function(e){x3dom.debug.doLog(e,x3dom.debug.WARNING)},logError:function(e){x3dom.debug.doLog(e,x3dom.debug.ERROR)},logException:function(e){x3dom.debug.doLog(e,x3dom.debug.EXCEPTION)},assert:function(e,t){e||x3dom.debug.doLog("Assertion failed in "+x3dom.debug.assert.caller.name+": "+t,x3dom.debug.ERROR)},typeOf:function(e){var t=typeof e;return"object"!==t||e?t:"null"},exists:function(e,t,i){return i=i||"function",(e?this.typeOf(e[t]):"null")===i},dumpFields:function(e){var t="";for(var i in e)t+=i+", ";return t+="\n",x3dom.debug.logInfo(t),t}},x3dom.debug.setup(),x3dom.arc={},x3dom.arc.instance=null,x3dom.arc.Limits=function(e,t,i){this._min=e,this._max=t,this.getValue=function(e){return e=this._min+(this._max-this._min)*e,this._max&gt;=e?this._min&lt;=e?e:this._min:this._max}},x3dom.arc.ARF=function(e,t,i,s,r,o,n,a){this._name=e,this._stateValue=[.5,.5],this._limits=new x3dom.arc.Limits(t,i),this._factorGetterFunc=r,this._factorSetterFunc=o,this._setterFunc=a,this._getterFunc=n,this._dirFac=s,this.getFactor=function(){return this._factorGetterFunc()},this.update=function(e,t){var i=this._stateValue[e]+t*this._dirFac;this._stateValue[e]=0&lt;=i?1&gt;=i?i:1:0,this._setterFunc(this._limits.getValue(this._stateValue[e]))},this.reset=function(){this._stateValue[0]=.5,this._stateValue[1]=.5}},x3dom.arc.AdaptiveRenderControl=defineClass(null,(function(e){x3dom.arc.instance=this,this._scene=e,this._targetFrameRate=[],this._targetFrameRate[0]=this._scene._vf.minFrameRate,this._targetFrameRate[1]=this._scene._vf.maxFrameRate,this._currentState=0;var t=this._scene.getEnvironment();this._arfs=[],this._arfs.push(new x3dom.arc.ARF("smallFeatureCulling",0,10,-1,(function(){return t._vf.smallFeatureFactor}),(function(e){t._vf.smallFeatureFactor=e}),(function(){return t._vf.smallFeatureThreshold}),(function(e){t._vf.smallFeatureThreshold=e}))),this._arfs.push(new x3dom.arc.ARF("lowPriorityCulling",0,100,1,(function(){return t._vf.lowPriorityFactor}),(function(e){t._vf.lowPriorityFactor=e}),(function(){return 100*t._vf.lowPriorityThreshold}),(function(e){t._vf.lowPriorityThreshold=e/100}))),this._arfs.push(new x3dom.arc.ARF("tessellationDetailCulling",1,12,-1,(function(){return t._vf.tessellationErrorFactor}),(function(e){t._vf.tessellationErrorFactor=e}),(function(){return t.tessellationErrorThreshold}),(function(e){t.tessellationErrorThreshold=e}))),this._stepWidth=.1}),{update:function(e,t){this._currentState=e;var i=t-this._targetFrameRate[e];this._stepWidth=Math.abs(i)&gt;10?.1:.01;var s,r=0,o=[],n=this._arfs.length;for(s=0;s&lt;n;++s)o[s]=this._arfs[s].getFactor(),o[s]&gt;0&amp;&amp;(r+=o[s]);var a=i&lt;0?-1:1;for(s=0;s&lt;n;++s)o[s]&gt;0&amp;&amp;(o[s]/=r,this._arfs[s].update(e,this._stepWidth*o[s]*a))},reset:function(){for(var e=0,t=this._arfs.length;e&lt;t;++e)this._arfs[e].reset()}}),x3dom.Request=function(e,t,i){this.url=e,this.priority=i,this.xhr=new XMLHttpRequest,this.onloadCallbacks=[t];var s=this;this.xhr.onload=function(){if(x3dom.DownloadManager.debugOutput&amp;&amp;x3dom.debug.logInfo("Download manager received data for URL '"+s.url+"'."),--x3dom.DownloadManager.activeDownloads,!1===x3dom.DownloadManager.stallToKeepOrder||!1===x3dom.DownloadManager.resultGetsStalled(s.priority)){var e;for(e=0;e&lt;s.onloadCallbacks.length;++e)s.onloadCallbacks[e](s.xhr.response);x3dom.DownloadManager.removeDownload(s),x3dom.DownloadManager.updateStalledResults()}else x3dom.DownloadManager.debugOutput&amp;&amp;x3dom.debug.logInfo("Download manager stalled downloaded result for URL '"+s.url+"'.");x3dom.DownloadManager.tryNextDownload()}},x3dom.Request.prototype.send=function(){this.xhr.open("GET",encodeURI(this.url),!0),this.xhr.responseType="arraybuffer",this.xhr.send(null),x3dom.DownloadManager.debugOutput&amp;&amp;x3dom.debug.logInfo("Download manager posted XHR for URL '"+this.url+"'.")},x3dom.DownloadManager={requests:[],maxDownloads:6,activeDownloads:0,debugOutput:!1,stallToKeepOrder:!1,toggleDebugOutput:function(e){this.debugOutput=e},toggleStrictReturnOrder:function(e){this.stallToKeepOrder=!1},removeDownload:function(e){var t,i,s=!1;for(t=0;t&lt;this.requests.length&amp;&amp;!s;++t)if(this.requests[t])for(i=0;i&lt;this.requests[t].length;++i)if(this.requests[t][i]===e){this.requests[t].splice(i,1),s=!0;break}},tryNextDownload:function(){var e,t,i;if(this.activeDownloads&lt;this.maxDownloads){for(t=0;t&lt;this.requests.length&amp;&amp;!e;++t)if(this.requests[t])for(i=0;i&lt;this.requests[t].length;++i)if(this.requests[t][i].xhr.readyState===XMLHttpRequest.UNSENT){e=this.requests[t][i];break}e&amp;&amp;(e.send(),++this.activeDownloads)}},resultGetsStalled:function(e){var t;for(t=0;t&lt;e;++t)if(this.requests[t]&amp;&amp;this.requests[t].length)return!0;return!1},updateStalledResults:function(){if(x3dom.DownloadManager.stallToKeepOrder){var e,t,i,s,r=!1;for(e=0;e&lt;this.requests.length&amp;&amp;!r;++e)if(this.requests[e])for(t=0;t&lt;this.requests[e].length;++t)if((s=this.requests[e][t]).xhr.readyState===XMLHttpRequest.DONE){for(x3dom.DownloadManager.debugOutput&amp;&amp;x3dom.debug.logInfo("Download manager releases stalled result for URL '"+s.url+"'."),i=0;i&lt;s.onloadCallbacks.length;++i)s.onloadCallbacks[i](s.xhr.response);this.requests[e].splice(t,1)}else r=!0}},get:function(e,t,i){var s,r,o,n,a,h,d,l=!1;if(e.length===t.length&amp;&amp;e.length===i.length){for(o=0;o&lt;e.length;++o)if(void 0!==!t[o]&amp;&amp;void 0!==!i[o]){for(a=e[o],h=t[o],d=i[o],s=0;s&lt;this.requests.length&amp;&amp;!l;++s)if(this.requests[s])for(r=0;r&lt;this.requests[s].length;++r)if(this.requests[s][r].url===a){this.requests[s][r].onloadCallbacks.push(h),x3dom.DownloadManager.debugOutput&amp;&amp;x3dom.debug.logInfo("Download manager appended onload callback for URL '"+a+"' to a registered request using the same URL."),l=!0;break}l||(n=new x3dom.Request(a,h,d),void 0!=this.requests[d]?this.requests[d].push(n):this.requests[d]=[n])}else x3dom.debug.logError('DownloadManager: No onload callback and / or priority specified. Ignoring request for "'+a+'"');for(s=0;s&lt;e.length&amp;&amp;this.activeDownloads&lt;this.maxDownloads;++s)this.tryNextDownload()}else x3dom.debug.logError("DownloadManager: The number of given urls, onload callbacks and priorities is not equal. Ignoring requests.")},abortAllDownloads:function(){for(var e,t=0;t&lt;this.requests.length;t++)if(void 0!=this.requests[t])for(var i=0;i&lt;this.requests[t].length;i++)(e=this.requests[t][i]).xhr.abort(),this.removeDownload(e)}},x3dom.RequestManager={},x3dom.RequestManager.requests=[],x3dom.RequestManager.maxParallelRequests=40,x3dom.RequestManager.failedRequests=0,x3dom.RequestManager.loadedRequests=0,x3dom.RequestManager.totalRequests=0,x3dom.RequestManager.activeRequests=[],x3dom.RequestManager.requestHeaders=[],x3dom.RequestManager.withCredentials=!1,x3dom.RequestManager.addRequestHeader=function(e,t){this.requestHeaders.push({header:e,value:t})},x3dom.RequestManager._sendRequest=function(){if(!(this.activeRequests.length&gt;this.maxParallelRequests)){var e=this.requests.pop();e&amp;&amp;(this.activeRequests.push(e),e.send(null),this._sendRequest())}},x3dom.RequestManager.addRequest=function(e){if(e instanceof XMLHttpRequest){this.totalRequests++,e.withCredentials=this.withCredentials;for(var t=0;t&lt;this.requestHeaders.length;t++){var i=this.requestHeaders[t].header,s=this.requestHeaders[t].value;e.setRequestHeader(i,s)}e.addEventListener("load",this._onLoadHandler.bind(this)),e.addEventListener("error",this._onErrorHandler.bind(this)),this.requests.push(e),this._sendRequest()}},x3dom.RequestManager.abortAllRequests=function(){for(var e=0;e&lt;this.activeRequests.length;e++)this.activeRequests[e].abort();this.requests=this.activeRequests=[]},x3dom.RequestManager._removeActiveRequest=function(e){var t=this.activeRequests.indexOf(e);return this.activeRequests.splice(t,1)},x3dom.RequestManager._onLoadHandler=function(e){this._removeActiveRequest(e.target),this.loadedRequests++,this._sendRequest()},x3dom.RequestManager._onErrorHandler=function(e){this._removeActiveRequest(e.target),this.failedRequests++,this._sendRequest()},x3dom.MultiMaterial=function(e){this._origAmbientIntensity=e.ambientIntensity,this._origDiffuseColor=e.diffuseColor,this._origEmissiveColor=e.emissiveColor,this._origShininess=e.shininess,this._origSpeclarColor=e.specularColor,this._origTransparency=e.transparency,this._origBackAmbientIntensity=e.backAmbientIntensity,this._origBackDiffuseColor=e.backDiffuseColor,this._origBackEmissiveColor=e.backEmissiveColor,this._origBackShininess=e.backShininess,this._origBackSpecularColor=e.backSpecularColor,this._origBackTransparency=e.backTransparency,this._ambientIntensity=e.ambientIntensity,this._diffuseColor=e.diffuseColor,this._emissiveColor=e.emissiveColor,this._shininess=e.shininess,this._specularColor=e.specularColor,this._transparency=e.transparency,this._backAmbientIntensity=e.backAmbientIntensity,this._backDiffuseColor=e.backDiffuseColor,this._backEmissiveColor=e.backEmissiveColor,this._backShininess=e.backShininess,this._backSpecularColor=e.backSpecularColor,this._backTransparency=e.backTransparency,this._highlighted=!1,this.reset=function(){this._ambientIntensity=this._origAmbientIntensity,this._diffuseColor=this._origDiffuseColor,this._emissiveColor=this._origEmissiveColor,this._shininess=this._origShininess,this._specularColor=this._origSpeclarColor,this._transparency=this._origTransparency,this._backAmbientIntensity=this._origBackAmbientIntensity,this._backDiffuseColor=this._origBackDiffuseColor,this._backEmissiveColor=this._origBackEmissiveColor,this._backShininess=this._origBackShininess,this._backSpecularColor=this._origBackSpecularColor,this._backTransparency=this._origBackTransparency}},x3dom.Parts=function(e,t,i,s,r,o){var n=this;this.multiPart=e,this.ids=t,this.colorMap=i,this.emissiveMap=s,this.specularMap=r,this.visibilityMap=o,this.width=n.colorMap.getWidth(),this.widthTwo=this.width*this.width,this.setDiffuseColor=function(e,i){var s,r,o,a;if(void 0==i&amp;&amp;"front"!=i&amp;&amp;"back"!=i&amp;&amp;"both"!=i&amp;&amp;(i="both"),e=x3dom.fields.SFColor.parse(e),t.length&amp;&amp;t.length&gt;1){var h=n.colorMap.getPixels();for(s=0;s&lt;n.ids.length;s++)o=r=n.ids[s],a=r+this.widthTwo,"front"==i?this.multiPart._materials[r]._diffuseColor=e:"back"==i?this.multiPart._materials[r]._backDiffuseColor=e:"both"==i&amp;&amp;(this.multiPart._materials[r]._diffuseColor=e,this.multiPart._materials[r]._backDiffuseColor=e),this.multiPart._materials[r]._highlighted||("front"==i?(h[o].r=e.r,h[o].g=e.g,h[o].b=e.b):"back"==i?(h[a].r=e.r,h[a].g=e.g,h[a].b=e.b):"both"==i&amp;&amp;(h[o].r=e.r,h[o].g=e.g,h[o].b=e.b,h[a].r=e.r,h[a].g=e.g,h[a].b=e.b));n.colorMap.setPixels(h)}else{var d,l,u,f,c,m;o=r=n.ids[0],a=r+this.widthTwo,"front"==i?(d=o%this.width,l=Math.floor(o/this.width),c=n.colorMap.getPixel(d,l),this.multiPart._materials[r]._diffuseColor=e):"back"==i?(u=a%this.width,f=Math.floor(a/this.width),m=n.colorMap.getPixel(u,f),this.multiPart._materials[r]._backDiffuseColor=e):"both"==i&amp;&amp;(d=o%this.width,l=Math.floor(o/this.width),u=a%this.width,f=Math.floor(a/this.width),c=n.colorMap.getPixel(d,l),m=n.colorMap.getPixel(u,f),this.multiPart._materials[r]._diffuseColor=e,this.multiPart._materials[r]._backDiffuseColor=e),this.multiPart._materials[r]._highlighted||("front"==i?(c.r=e.r,c.g=e.g,c.b=e.b,n.colorMap.setPixel(d,l,c)):"back"==i?(m.r=e.r,m.g=e.g,m.b=e.b,n.colorMap.setPixel(u,f,m)):"both"==i&amp;&amp;(c.r=e.r,c.g=e.g,c.b=e.b,m.r=e.r,m.g=e.g,m.b=e.b,n.colorMap.setPixel(d,l,c),n.colorMap.setPixel(u,f,m)))}},this.getDiffuseColor=function(e){var i,s;if(void 0==e&amp;&amp;"front"!=e&amp;&amp;"back"!=e&amp;&amp;(e="front"),t.length&amp;&amp;t.length&gt;1){var r=[];for(i=0;i&lt;n.ids.length;i++)s=n.ids[i],"front"==e?r.push(this.multiPart._materials[s]._diffuseColor):"back"==e&amp;&amp;r.push(this.multiPart._materials[s]._backDiffuseColor);return r}return s=n.ids[0],"front"==e?this.multiPart._materials[s]._diffuseColor:"back"==e?this.multiPart._materials[s]._backDiffuseColor:void 0},this.setEmissiveColor=function(e,i){var s,r,o,a;if(void 0==i&amp;&amp;"front"!=i&amp;&amp;"back"!=i&amp;&amp;"both"!=i&amp;&amp;(i="both"),e=x3dom.fields.SFColor.parse(e),t.length&amp;&amp;t.length&gt;1){var h=n.emissiveMap.getPixels();for(s=0;s&lt;n.ids.length;s++)o=r=n.ids[s],a=r+this.widthTwo,"front"==i?this.multiPart._materials[r]._emissiveColor=e:"back"==i?this.multiPart._materials[r]._backEmissiveColor=e:"both"==i&amp;&amp;(this.multiPart._materials[r]._emissiveColor=e,this.multiPart._materials[r]._backEmissiveColor=e),this.multiPart._materials[r]._highlighted||("front"==i?(h[o].r=e.r,h[o].g=e.g,h[o].b=e.b):"back"==i?(h[a].r=e.r,h[a].g=e.g,h[a].b=e.b):"both"==i&amp;&amp;(h[o].r=e.r,h[o].g=e.g,h[o].b=e.b,h[a].r=e.r,h[a].g=e.g,h[a].b=e.b));n.emissiveMap.setPixels(h)}else{var d,l,u,f,c,m;o=r=n.ids[0],a=r+this.widthTwo,"front"==i?(d=o%this.width,l=Math.floor(o/this.width),c=n.emissiveMap.getPixel(d,l),this.multiPart._materials[r]._emissiveColor=e):"back"==i?(u=a%this.width,f=Math.floor(a/this.width),m=n.emissiveMap.getPixel(u,f),this.multiPart._materials[r]._backEmissiveColor=e):"both"==i&amp;&amp;(d=o%this.width,l=Math.floor(o/this.width),u=a%this.width,f=Math.floor(a/this.width),c=n.emissiveMap.getPixel(d,l),m=n.emissiveMap.getPixel(u,f),this.multiPart._materials[r]._emissiveColor=e,this.multiPart._materials[r]._backEmissiveColor=e),this.multiPart._materials[r]._highlighted||("front"==i?(c.r=e.r,c.g=e.g,c.b=e.b,n.emissiveMap.setPixel(d,l,c)):"back"==i?(m.r=e.r,m.g=e.g,m.b=e.b,n.emissiveMap.setPixel(u,f,m)):"both"==i&amp;&amp;(c.r=e.r,c.g=e.g,c.b=e.b,m.r=e.r,m.g=e.g,m.b=e.b,n.emissiveMap.setPixel(d,l,c),n.emissiveMap.setPixel(u,f,m)))}},this.getEmissiveColor=function(e){var i,s;if(void 0==e&amp;&amp;"front"!=e&amp;&amp;"back"!=e&amp;&amp;(e="front"),t.length&amp;&amp;t.length&gt;1){var r=[];for(i=0;i&lt;n.ids.length;i++)s=n.ids[i],"front"==e?r.push(this.multiPart._materials[s]._emissiveColor):"back"==e&amp;&amp;r.push(this.multiPart._materials[s]._backEmissiveColor);return r}return s=n.ids[0],"front"==e?this.multiPart._materials[s]._emissiveColor:"back"==e?this.multiPart._materials[s]._backEmissiveColor:void 0},this.setSpecularColor=function(e,i){var s,r,o,a;if(void 0==i&amp;&amp;"front"!=i&amp;&amp;"back"!=i&amp;&amp;"both"!=i&amp;&amp;(i="both"),e=x3dom.fields.SFColor.parse(e),t.length&amp;&amp;t.length&gt;1){var h=n.specularMap.getPixels();for(s=0;s&lt;n.ids.length;s++)o=r=n.ids[s],a=r+this.widthTwo,"front"==i?this.multiPart._materials[r]._specularColor=e:"back"==i?this.multiPart._materials[r]._backSpecularColor=e:"both"==i&amp;&amp;(this.multiPart._materials[r]._specularColor=e,this.multiPart._materials[r]._backSpecularColor=e),this.multiPart._materials[r]._highlighted||("front"==i?(h[o].r=e.r,h[o].g=e.g,h[o].b=e.b):"back"==i?(h[a].r=e.r,h[a].g=e.g,h[a].b=e.b):"both"==i&amp;&amp;(h[o].r=e.r,h[o].g=e.g,h[o].b=e.b,h[a].r=e.r,h[a].g=e.g,h[a].b=e.b));n.specularMap.setPixels(h)}else{var d,l,u,f,c,m;o=r=n.ids[0],a=r+this.widthTwo,"front"==i?(d=o%this.width,l=Math.floor(o/this.width),c=n.specularMap.getPixel(d,l),this.multiPart._materials[r]._specularColor=e):"back"==i?(u=a%this.width,f=Math.floor(a/this.width),m=n.specularMap.getPixel(u,f),this.multiPart._materials[r]._backSpecularColor=e):"both"==i&amp;&amp;(d=o%this.width,l=Math.floor(o/this.width),u=a%this.width,f=Math.floor(a/this.width),c=n.specularMap.getPixel(d,l),m=n.specularMap.getPixel(u,f),this.multiPart._materials[r]._specularColor=e,this.multiPart._materials[r]._backSpecularColor=e),this.multiPart._materials[r]._highlighted||("front"==i?(c.r=e.r,c.g=e.g,c.b=e.b,n.specularMap.setPixel(d,l,c)):"back"==i?(m.r=e.r,m.g=e.g,m.b=e.b,n.specularMap.setPixel(u,f,m)):"both"==i&amp;&amp;(c.r=e.r,c.g=e.g,c.b=e.b,m.r=e.r,m.g=e.g,m.b=e.b,n.specularMap.setPixel(d,l,c),n.specularMap.setPixel(u,f,m)))}},this.getSpecularColor=function(e){var i,s;if(void 0==e&amp;&amp;"front"!=e&amp;&amp;"back"!=e&amp;&amp;(e="front"),t.length&amp;&amp;t.length&gt;1){var r=[];for(i=0;i&lt;n.ids.length;i++)s=n.ids[i],"front"==e?r.push(this.multiPart._materials[s]._specularColor):"back"==e&amp;&amp;r.push(this.multiPart._materials[s]._backSpecularColor);return r}return s=n.ids[0],"front"==e?this.multiPart._materials[s]._specularColor:"back"==e?this.multiPart._materials[s]._backSpecularColor:void 0},this.setTransparency=function(e,i){var s,r,o,a;if(void 0==i&amp;&amp;"front"!=i&amp;&amp;"back"!=i&amp;&amp;"both"!=i&amp;&amp;(i="both"),t.length&amp;&amp;t.length&gt;1){var h=n.colorMap.getPixels();for(s=0;s&lt;n.ids.length;s++)o=r=n.ids[s],a=r+this.widthTwo,"front"==i?this.multiPart._materials[r]._transparency=e:"back"==i?this.multiPart._materials[r]._backTransparency=e:"both"==i&amp;&amp;(this.multiPart._materials[r]._transparency=e,this.multiPart._materials[r]._backTransparency=e),this.multiPart._materials[r]._highlighted||("front"==i?h[o].a=1-e:"back"==i?h[a].a=1-e:"both"==i&amp;&amp;(h[o].a=1-e,h[a].a=1-e));n.colorMap.setPixels(h)}else{var d,l,u,f,c,m;o=r=n.ids[0],a=r+this.widthTwo,"front"==i?(d=o%this.width,l=Math.floor(o/this.width),c=n.colorMap.getPixel(d,l),this.multiPart._materials[r]._transparency=e):"back"==i?(u=a%this.width,f=Math.floor(a/this.width),m=n.colorMap.getPixel(u,f),this.multiPart._materials[r]._backTransparency=e):"both"==i&amp;&amp;(d=o%this.width,l=Math.floor(o/this.width),u=a%this.width,f=Math.floor(a/this.width),c=n.colorMap.getPixel(d,l),m=n.colorMap.getPixel(u,f),this.multiPart._materials[r]._transparency=e,this.multiPart._materials[r]._backTransparency=e),this.multiPart._materials[r]._highlighted||("front"==i?(c.a=1-e,n.colorMap.setPixel(d,l,c)):"back"==i?(m.a=1-e,n.colorMap.setPixel(u,f,m)):"both"==i&amp;&amp;(c.a=1-e,m.a=1-e,n.colorMap.setPixel(d,l,c),n.colorMap.setPixel(u,f,m)))}},this.getTransparency=function(e){var i,s;if(void 0==e&amp;&amp;"front"!=e&amp;&amp;"back"!=e&amp;&amp;(e="front"),t.length&amp;&amp;t.length&gt;1){var r=[];for(i=0;i&lt;n.ids.length;i++)s=n.ids[i],"front"==e?r.push(this.multiPart._materials[s]._transparency):"back"==e&amp;&amp;r.push(this.multiPart._materials[s]._backTransparency);return r}return s=n.ids[0],"front"==e?this.multiPart._materials[s]._transparency:"back"==e?this.multiPart._materials[s]._backTransparency:void 0},this.setShininess=function(e,i){var s,r,o,a;if(void 0==i&amp;&amp;"front"!=i&amp;&amp;"back"!=i&amp;&amp;"both"!=i&amp;&amp;(i="both"),t.length&amp;&amp;t.length&gt;1){var h=n.specularMap.getPixels();for(s=0;s&lt;n.ids.length;s++)o=r=n.ids[s],a=r+this.widthTwo,"front"==i?this.multiPart._materials[r]._shininess=e:"back"==i?this.multiPart._materials[r]._backShininess=e:"both"==i&amp;&amp;(this.multiPart._materials[r]._shininess=e,this.multiPart._materials[r]._backShininess=e),this.multiPart._materials[r]._highlighted||("front"==i?h[o].a=e:"back"==i?h[a].a=e:"both"==i&amp;&amp;(h[o].a=e,h[a].a=e));n.specularMap.setPixels(h)}else{var d,l,u,f,c,m;o=r=n.ids[0],a=r+this.widthTwo,"front"==i?(d=o%this.width,l=Math.floor(o/this.width),c=n.specularMap.getPixel(d,l),this.multiPart._materials[r]._shininess=e):"back"==i?(u=a%this.width,f=Math.floor(a/this.width),m=n.specularMap.getPixel(u,f),this.multiPart._materials[r]._backShininess=e):"both"==i&amp;&amp;(d=o%this.width,l=Math.floor(o/this.width),u=a%this.width,f=Math.floor(a/this.width),c=n.specularMap.getPixel(d,l),m=n.specularMap.getPixel(u,f),this.multiPart._materials[r]._shininess=e,this.multiPart._materials[r]._backShininess=e),this.multiPart._materials[r]._highlighted||("front"==i?(c.a=e,n.specularMap.setPixel(d,l,c)):"back"==i?(m.a=e,n.specularMap.setPixel(u,f,m)):"both"==i&amp;&amp;(c.a=e,m.a=e,n.specularMap.setPixel(d,l,c),n.specularMap.setPixel(u,f,m)))}},this.getShininess=function(e){var i,s;if(void 0==e&amp;&amp;"front"!=e&amp;&amp;"back"!=e&amp;&amp;(e="front"),t.length&amp;&amp;t.length&gt;1){var r=[];for(i=0;i&lt;n.ids.length;i++)s=n.ids[i],"front"==e?r.push(this.multiPart._materials[s]._shininess):"back"==e&amp;&amp;r.push(this.multiPart._materials[s]._backShininess);return r}return s=n.ids[0],"front"==e?this.multiPart._materials[s]._shininess:"back"==e?this.multiPart._materials[s]._backShininess:void 0},this.setAmbientIntensity=function(e,i){var s,r,o,a;if(void 0==i&amp;&amp;"front"!=i&amp;&amp;"back"!=i&amp;&amp;"both"!=i&amp;&amp;(i="both"),t.length&amp;&amp;t.length&gt;1){var h=n.emissiveMap.getPixels();for(s=0;s&lt;n.ids.length;s++)o=r=n.ids[s],a=r+this.widthTwo,"front"==i?this.multiPart._materials[r]._ambientIntensity=e:"back"==i?this.multiPart._materials[r]._backAmbientIntensity=e:"both"==i&amp;&amp;(this.multiPart._materials[r]._ambientIntensity=e,this.multiPart._materials[r]._backAmbientIntensity=e),this.multiPart._materials[r]._highlighted||("front"==i?h[o].a=e:"back"==i?h[a].a=e:"both"==i&amp;&amp;(h[o].a=e,h[a].a=e));n.emissiveMap.setPixels(h)}else{var d,l,u,f,c,m;o=r=n.ids[0],a=r+this.widthTwo,"front"==i?(d=o%this.width,l=Math.floor(o/this.width),c=n.emissiveMap.getPixel(d,l),this.multiPart._materials[r]._ambientIntensity=e):"back"==i?(u=a%this.width,f=Math.floor(a/this.width),m=n.emissiveMap.getPixel(u,f),this.multiPart._materials[r]._backAmbientIntensity=e):"both"==i&amp;&amp;(d=o%this.width,l=Math.floor(o/this.width),u=a%this.width,f=Math.floor(a/this.width),c=n.emissiveMap.getPixel(d,l),m=n.emissiveMap.getPixel(u,f),this.multiPart._materials[r]._ambientIntensity=e,this.multiPart._materials[r]._backAmbientIntensity=e),this.multiPart._materials[r]._highlighted||("front"==i?(c.a=e,n.emissiveMap.setPixel(d,l,c)):"back"==i?(m.a=e,n.emissiveMap.setPixel(u,f,m)):"both"==i&amp;&amp;(c.a=e,m.a=e,n.emissiveMap.setPixel(d,l,c),n.emissiveMap.setPixel(u,f,m)))}},this.getAmbientIntensity=function(e){var i,s;if(void 0==e&amp;&amp;"front"!=e&amp;&amp;"back"!=e&amp;&amp;(e="front"),t.length&amp;&amp;t.length&gt;1){var r=[];for(i=0;i&lt;n.ids.length;i++)s=n.ids[i],"front"==e?r.push(this.multiPart._materials[s]._ambientIntensity):"back"==e&amp;&amp;r.push(this.multiPart._materials[s]._backAmbientIntensity);return r}return s=n.ids[0],"front"==e?this.multiPart._materials[s]._ambientIntensity:"back"==e?this.multiPart._materials[s]._backAmbientIntensity:void 0},this.highlight=function(e){var i,s,r,o,a,h,d;if(e=x3dom.fields.SFColor.parse(e),t.length&amp;&amp;t.length&gt;1){var l=n.colorMap.getPixels(),u=n.emissiveMap.getPixels(),f=n.specularMap.getPixels();for(a=new x3dom.fields.SFColorRGBA(0,0,0,1),h=new x3dom.fields.SFColorRGBA(e.r,e.g,e.b,0),d=new x3dom.fields.SFColorRGBA(0,0,0,0),i=0;i&lt;n.ids.length;i++)r=s=n.ids[i],o=(parseInt(s)+parseInt(this.widthTwo)).toString(),this.multiPart._materials[s]._highlighted||(this.multiPart._materials[s]._highlighted=!0,l[r]=a,u[r]=h,f[r]=d,l[o]=a,u[o]=h,f[o]=d);this.colorMap.setPixels(l,!1),this.emissiveMap.setPixels(u,!1),this.specularMap.setPixels(f,!0)}else{r=s=n.ids[0],o=s+this.widthTwo;var c=r%this.width,m=Math.floor(r/this.width),_=o%this.width,p=Math.floor(o/this.width);this.multiPart._materials[s]._highlighted||(this.multiPart._materials[s]._highlighted=!0,a=new x3dom.fields.SFColorRGBA(0,0,0,1),h=new x3dom.fields.SFColorRGBA(e.r,e.g,e.b,0),d=new x3dom.fields.SFColorRGBA(0,0,0,0),this.colorMap.setPixel(c,m,a,!1),this.emissiveMap.setPixel(c,m,h,!1),this.specularMap.setPixel(c,m,d,!1),this.colorMap.setPixel(_,p,a,!1),this.emissiveMap.setPixel(_,p,h,!1),this.specularMap.setPixel(_,p,d,!0))}},this.unhighlight=function(){var e,i,s,r,o,a,h,d,l,u,f;if(t.length&amp;&amp;t.length&gt;1){var c=n.colorMap.getPixels(),m=n.emissiveMap.getPixels(),_=n.specularMap.getPixels();for(e=0;e&lt;n.ids.length;e++)s=i=n.ids[e],r=i+this.widthTwo,(o=this.multiPart._materials[i])._highlighted&amp;&amp;(o._highlighted=!1,c[s]=new x3dom.fields.SFColorRGBA(o._diffuseColor.r,o._diffuseColor.g,o._diffuseColor.b,1-o._transparency),m[s]=new x3dom.fields.SFColorRGBA(o._emissiveColor.r,o._emissiveColor.g,o._emissiveColor.b,o._ambientIntensity),_[s]=new x3dom.fields.SFColorRGBA(o._specularColor.r,o._specularColor.g,o._specularColor.b,o._shininess),c[r]=new x3dom.fields.SFColorRGBA(o._backDiffuseColor.r,o._backDiffuseColor.g,o._backDiffuseColor.b,1-o._backTransparency),m[r]=new x3dom.fields.SFColorRGBA(o._backEmissiveColor.r,o._backEmissiveColor.g,o._backEmissiveColor.b,o._backAmbientIntensity),_[r]=new x3dom.fields.SFColorRGBA(o._backSpecularColor.r,o._backSpecularColor.g,o._backSpecularColor.b,o._backShininess));this.colorMap.setPixels(c,!1),this.emissiveMap.setPixels(m,!1),this.specularMap.setPixels(_,!0)}else{s=i=n.ids[0],r=i+this.widthTwo;var p=s%this.width,x=Math.floor(s/this.width),g=r%this.width,v=Math.floor(r/this.width);(o=this.multiPart._materials[i])._highlighted&amp;&amp;(o._highlighted=!1,a=new x3dom.fields.SFColorRGBA(o._diffuseColor.r,o._diffuseColor.g,o._diffuseColor.b,1-o._transparency),h=new x3dom.fields.SFColorRGBA(o._emissiveColor.r,o._emissiveColor.g,o._emissiveColor.b,o._ambientIntensity),d=new x3dom.fields.SFColorRGBA(o._specularColor.r,o._specularColor.g,o._specularColor.b,o._shininess),l=new x3dom.fields.SFColorRGBA(o._backDiffuseColor.r,o._backDiffuseColor.g,o._backDiffuseColor.b,1-o._backTransparency),u=new x3dom.fields.SFColorRGBA(o._backEmissiveColor.r,o._backEmissiveColor.g,o._backEmissiveColor.b,o._backAmbientIntensity),f=new x3dom.fields.SFColorRGBA(o._backSpecularColor.r,o._backSpecularColor.g,o._backSpecularColor.b,o._backShininess),this.colorMap.setPixel(p,x,a,!1),this.emissiveMap.setPixel(p,x,h,!1),this.specularMap.setPixel(p,x,d,!1),this.colorMap.setPixel(g,v,l,!1),this.emissiveMap.setPixel(g,v,u,!1),this.specularMap.setPixel(g,v,f,!0))}},this.toggleHighlight=function(e){for(var t=0;t&lt;n.ids.length;t++)this.multiPart._materials[n.ids[t]]._highlighted?this.unhighlight():this.highlight(e)},this.setColor=function(e,t){this.setDiffuseColor(e,t)},this.getColorRGB=function(){var e=this.getColorRGBA().split(" ");return e[0]+" "+e[1]+" "+e[2]},this.getColorRGBA=function(){var e,t,i=this.multiPart._originalColor[n.ids[0]];return this.multiPart._highlightedParts[n.ids[0]]?i=this.multiPart._highlightedParts[n.ids[0]]:(e=n.ids[0]%n.colorMap.getWidth(),t=Math.floor(n.ids[0]/n.colorMap.getWidth()),i=n.colorMap.getPixel(e,t)),i.toString()},this.resetColor=function(){var e,i,s,r,o,a,h,d,l,u,f;if(t.length&amp;&amp;t.length&gt;1){var c=n.colorMap.getPixels(),m=n.emissiveMap.getPixels(),_=n.specularMap.getPixels();for(e=0;e&lt;n.ids.length;e++)s=i=n.ids[e],r=i+this.widthTwo,(o=this.multiPart._materials[i]).reset(),o._highlighted||(c[s]=new x3dom.fields.SFColorRGBA(o._diffuseColor.r,o._diffuseColor.g,o._diffuseColor.b,1-o._transparency),m[s]=new x3dom.fields.SFColorRGBA(o._emissiveColor.r,o._emissiveColor.g,o._emissiveColor.b,o._ambientIntensity),_[s]=new x3dom.fields.SFColorRGBA(o._specularColor.r,o._specularColor.g,o._specularColor.b,o._shininess),c[r]=new x3dom.fields.SFColorRGBA(o._backDiffuseColor.r,o._backDiffuseColor.g,o._backDiffuseColor.b,1-o._backTransparency),m[r]=new x3dom.fields.SFColorRGBA(o._backEmissiveColor.r,o._backEmissiveColor.g,o._backEmissiveColor.b,o._backAmbientIntensity),_[r]=new x3dom.fields.SFColorRGBA(o._backSpecularColor.r,o._backSpecularColor.g,o._backSpecularColor.b,o._backShininess));this.colorMap.setPixels(c,!1),this.emissiveMap.setPixels(m,!1),this.specularMap.setPixels(_,!0)}else{s=i=n.ids[0],r=i+this.widthTwo;var p=s%this.width,x=Math.floor(s/this.width),g=r%this.width,v=Math.floor(r/this.width);(o=this.multiPart._materials[i]).reset(),o._highlighted||(a=new x3dom.fields.SFColorRGBA(o._diffuseColor.r,o._diffuseColor.g,o._diffuseColor.b,1-o._transparency),h=new x3dom.fields.SFColorRGBA(o._emissiveColor.r,o._emissiveColor.g,o._emissiveColor.b,o._ambientIntensity),d=new x3dom.fields.SFColorRGBA(o._specularColor.r,o._specularColor.g,o._specularColor.b,o._shininess),l=new x3dom.fields.SFColorRGBA(o._backDiffuseColor.r,o._backDiffuseColor.g,o._backDiffuseColor.b,1-o._backTransparency),u=new x3dom.fields.SFColorRGBA(o._backEmissiveColor.r,o._backEmissiveColor.g,o._backEmissiveColor.b,o._backAmbientIntensity),f=new x3dom.fields.SFColorRGBA(o._backSpecularColor.r,o._backSpecularColor.g,o._backSpecularColor.b,o._backShininess),this.colorMap.setPixel(p,x,a,!1),this.emissiveMap.setPixel(p,x,h,!1),this.specularMap.setPixel(p,x,d,!1),this.colorMap.setPixel(g,v,l,!1),this.emissiveMap.setPixel(g,v,u,!1),this.specularMap.setPixel(g,v,f,!0))}},this.setVisibility=function(e){var i,s,r,o,a,h,d;if(t.length&amp;&amp;t.length&gt;1){var l=n.visibilityMap.getPixels();for(i=0;i&lt;n.ids.length;i++)if(d=e?1:0,l[n.ids[i]].r!=d)for(l[n.ids[i]].r=d,this.multiPart._partVisibility[n.ids[i]]=e,a=this.multiPart._idMap.mapping[n.ids[i]].usage,s=0;s&lt;a.length;s++)h=this.multiPart._visiblePartsPerShape[a[s]],e&amp;&amp;h.val&lt;h.max?h.val++:!e&amp;&amp;h.val&gt;0&amp;&amp;h.val--,h.val?this.multiPart._inlineNamespace.defMap[a[s]]._vf.render=!0:this.multiPart._inlineNamespace.defMap[a[s]]._vf.render=!1;n.visibilityMap.setPixels(l),this.multiPart.invalidateVolume()}else{r=n.ids[0]%n.colorMap.getWidth(),o=Math.floor(n.ids[0]/n.colorMap.getWidth());var u=n.visibilityMap.getPixel(r,o);if(d=e?1:0,u.r!=d)for(u.r=d,this.multiPart._partVisibility[n.ids[0]]=e,a=this.multiPart._idMap.mapping[n.ids[0]].usage,s=0;s&lt;a.length;s++)h=this.multiPart._visiblePartsPerShape[a[s]],e&amp;&amp;h.val&lt;h.max?h.val++:!e&amp;&amp;h.val&gt;0&amp;&amp;h.val--,h.val?this.multiPart._inlineNamespace.defMap[a[s]]._vf.render=!0:this.multiPart._inlineNamespace.defMap[a[s]]._vf.render=!1;n.visibilityMap.setPixel(r,o,u),this.multiPart.invalidateVolume()}},this.getVolume=function(){var e,i=this.multiPart.getCurrentTransform();if(t.length&amp;&amp;t.length&gt;1){e=new x3dom.fields.BoxVolume;for(var s=0;s&lt;n.ids.length;s++)e.extendBounds(this.multiPart._partVolume[n.ids[s]].min,this.multiPart._partVolume[n.ids[s]].max);return e.transform(i),e}return(e=x3dom.fields.BoxVolume.copy(this.multiPart._partVolume[n.ids[0]])).transform(i),e},this.fit=function(e){var t=this.getVolume();this.multiPart._nameSpace.doc._viewarea.fit(t.min,t.max,e)}},x3dom.Properties=function(){this.properties={}},x3dom.Properties.prototype.setProperty=function(e,t){x3dom.debug.logInfo("Properties: Setting property '"+e+"' to value '"+t+"'"),this.properties[e]=t},x3dom.Properties.prototype.getProperty=function(e,t){return this.properties[e]?this.properties[e]:t},x3dom.Properties.prototype.merge=function(e){for(var t in e.properties)this.properties[t]=e.properties[t]},x3dom.Properties.prototype.toString=function(){var e="";for(var t in this.properties)e+="Name: "+t+" Value: "+this.properties[t]+"\n";return e},x3dom.DoublyLinkedList=function(){this.length=0,this.first=null,this.last=null},x3dom.DoublyLinkedList.ListNode=function(e,t,i,s,r){this.point=e,this.point_index=t,this.normals=i,this.colors=s,this.texCoords=r,this.next=null,this.prev=null},x3dom.DoublyLinkedList.prototype.appendNode=function(e){null===this.first?(e.prev=e,e.next=e,this.first=e,this.last=e):(e.prev=this.last,e.next=this.first,this.first.prev=e,this.last.next=e,this.last=e),this.length++},x3dom.DoublyLinkedList.prototype.insertAfterNode=function(e,t){t.prev=e,t.next=e.next,e.next.prev=t,e.next=t,t.prev==this.last&amp;&amp;(this.last=t),this.length++},x3dom.DoublyLinkedList.prototype.deleteNode=function(e){this.length&gt;1?(e.prev.next=e.next,e.next.prev=e.prev,e==this.first&amp;&amp;(this.first=e.next),e==this.last&amp;&amp;(this.last=e.prev)):(this.first=null,this.last=null),e.prev=null,e.next=null,this.length--},x3dom.DoublyLinkedList.prototype.getNode=function(e){var t=null;if(e&gt;this.length)return t;for(var i=0;i&lt;this.length;i++)if(t=0==i?this.first:t.next,i==e)return t;return null},x3dom.DoublyLinkedList.prototype.invert=function(){for(var e=null,t=this.first,i=0;i&lt;this.length;i++)e=t.prev,t.prev=t.next,t.next=e,t=t.prev;e=this.first,this.first=this.last,this.last=e},x3dom.EarClipping={getIndexes:function(e){var t,i,s,r,o=e.first.next,n=this.identifyPlane(o.prev.point,o.point,o.next.point);for(i=[],point_indexes=[],t=0;t&lt;e.length;t++){switch(o=e.getNode(t),n){case"XY":s=o.point.x,r=o.point.y;break;case"XZ":s=o.point.z,r=o.point.x;break;default:s=o.point.y,r=o.point.z}i.push(r),i.push(s),point_indexes.push(o.point_index)}var a=x3dom.EarCut.triangulate(i,null,2);return a=a.map((function(e){return point_indexes[e]}))},getMultiIndexes:function(e){var t=e.first.next,s=this.identifyPlane(t.prev.point,t.point,t.next.point),r={indices:[],point:[],normals:[],colors:[],texCoords:[]},o={indices:[],point:[],normals:[],colors:[],texCoords:[]};for(points=[],i=0;i&lt;e.length;i++){switch(t=e.getNode(i),s){case"XY":x=t.point.x,y=t.point.y;break;case"XZ":x=t.point.z,y=t.point.x;break;default:x=t.point.y,y=t.point.z}points.push(y),points.push(x),o.indices.push(t.point_index),o.point.push(t.point),t.normals&amp;&amp;o.normals.push(t.normals),t.colors&amp;&amp;o.colors.push(t.colors),t.texCoords&amp;&amp;o.texCoords.push(t.texCoords)}var n=x3dom.EarCut.triangulate(points,null,2);return r.indices=n.map((function(e){return o.indices[e]})),r.point=n.map((function(e){return o.point[e]})),t.normals&amp;&amp;(r.normals=n.map((function(e){return o.normals[e]}))),t.colors&amp;&amp;(r.colors=n.map((function(e){return o.colors[e]}))),t.texCoords&amp;&amp;(r.texCoords=n.map((function(e){return o.texCoords[e]}))),r},identifyPlane:function(e,t,i){var s,r,o,n,a,h,d,l,u;s=t.x-e.x,r=t.y-e.y,o=t.z-e.z,n=i.x-e.x,a=i.y-e.y,h=i.z-e.z,d=Math.abs(r*h-o*a),l=Math.abs(o*n-s*h),u=Math.abs(s*a-r*n);var f=Math.max(d,l,u);return f==d?"YZ":f==l?"XZ":f==u?"XY":"XZ"}},x3dom.EarCut={triangulate:function(e,t,s){return function(e,t,i){i=i||2;var s,h,d,l,u,m,p,x=t&amp;&amp;t.length,g=x?t[0]*i:e.length,v=r(e,0,g,i),y=o(e,0,g,i,!0,v),b=[];if(!y)return b;x&amp;&amp;(y=function(e,t,i,s){var r,a,h,d,l,u=[];for(r=0,a=t.length;r&lt;a;r++)h=t[r]*s,d=r&lt;a-1?t[r+1]*s:e.length,(l=o(e,h,d,s,!1))===l.next&amp;&amp;(l.steiner=!0),u.push(_(l));for(u.sort(f),r=0;r&lt;u.length;r++)c(u[r],i),i=n(i,i.next);return i}(e,t,y,i));if(e.length&gt;80*i){s=d=e[0],h=l=e[1];for(var T=i;T&lt;g;T+=i)u=e[T],m=e[T+1],u&lt;s&amp;&amp;(s=u),m&lt;h&amp;&amp;(h=m),u&gt;d&amp;&amp;(d=u),m&gt;l&amp;&amp;(l=m);p=Math.max(d-s,l-h)}a(y,b,i,s,h,p),!1===v&amp;&amp;b.reverse();return b}(e,t,s);function r(e,t,s,r){var o=0;for(i=t,j=s-r;i&lt;s;i+=r)o+=(e[j]-e[i])*(e[i+1]+e[j+1]),j=i;return o&gt;0}function o(e,t,i,s,r,o){var n,a;if(r===o)for(n=t;n&lt;i;n+=s)a=S(n,e[n],e[n+1],a);else for(n=i-s;n&gt;=t;n-=s)a=S(n,e[n],e[n+1],a);return a}function n(e,t){if(!e)return e;t||(t=e);var i,s=e;do{if(i=!1,s.steiner||!v(s,s.next)&amp;&amp;0!==g(s.prev,s,s.next))s=s.next;else{if(w(s),(s=t=s.prev)===s.next)return null;i=!0}}while(i||s!==t);return t}function a(e,t,i,s,r,o,f){if(e){!f&amp;&amp;o&amp;&amp;function(e,t,i,s){var r=e;do{null===r.z&amp;&amp;(r.z=m(r.x,r.y,t,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,s,r,o,n,a,h,d=1;do{for(i=e,e=null,o=null,n=0;i;){for(n++,s=i,a=0,t=0;t&lt;d&amp;&amp;(a++,s=s.nextZ);t++);for(h=d;a&gt;0||h&gt;0&amp;&amp;s;)0===a?(r=s,s=s.nextZ,h--):0!==h&amp;&amp;s?i.z&lt;=s.z?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,h--):(r=i,i=i.nextZ,a--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=s}o.nextZ=null,d*=2}while(n&gt;1)}(r)}(e,s,r,o);for(var c,_,p=e;e.prev!==e.next;)if(c=e.prev,_=e.next,o?d(e,s,r,o):h(e))t.push(c.i/i),t.push(e.i/i),t.push(_.i/i),w(e),e=_.next,p=_.next;else if((e=_)===p){f?1===f?a(e=l(e,t,i),t,i,s,r,o,2):2===f&amp;&amp;u(e,t,i,s,r,o):a(n(e),t,i,s,r,o,1);break}}}function h(e){var t=e.prev,i=e,s=e.next;if(g(t,i,s)&gt;=0)return!1;for(var r=e.next.next;r!==e.prev;){if(p(t.x,t.y,i.x,i.y,s.x,s.y,r.x,r.y)&amp;&amp;g(r.prev,r,r.next)&gt;=0)return!1;r=r.next}return!0}function d(e,t,i,s){var r=e.prev,o=e,n=e.next;if(g(r,o,n)&gt;=0)return!1;for(var a=r.x&lt;o.x?r.x&lt;n.x?r.x:n.x:o.x&lt;n.x?o.x:n.x,h=r.y&lt;o.y?r.y&lt;n.y?r.y:n.y:o.y&lt;n.y?o.y:n.y,d=r.x&gt;o.x?r.x&gt;n.x?r.x:n.x:o.x&gt;n.x?o.x:n.x,l=r.y&gt;o.y?r.y&gt;n.y?r.y:n.y:o.y&gt;n.y?o.y:n.y,u=m(a,h,t,i,s),f=m(d,l,t,i,s),c=e.nextZ;c&amp;&amp;c.z&lt;=f;){if(c!==e.prev&amp;&amp;c!==e.next&amp;&amp;p(r.x,r.y,o.x,o.y,n.x,n.y,c.x,c.y)&amp;&amp;g(c.prev,c,c.next)&gt;=0)return!1;c=c.nextZ}for(c=e.prevZ;c&amp;&amp;c.z&gt;=u;){if(c!==e.prev&amp;&amp;c!==e.next&amp;&amp;p(r.x,r.y,o.x,o.y,n.x,n.y,c.x,c.y)&amp;&amp;g(c.prev,c,c.next)&gt;=0)return!1;c=c.prevZ}return!0}function l(e,t,i){var s=e;do{var r=s.prev,o=s.next.next;y(r,s,s.next,o)&amp;&amp;b(r,o)&amp;&amp;b(o,r)&amp;&amp;(t.push(r.i/i),t.push(s.i/i),t.push(o.i/i),w(s),w(s.next),s=e=o),s=s.next}while(s!==e);return s}function u(e,t,i,s,r,o){var h=e;do{for(var d=h.next.next;d!==h.prev;){if(h.i!==d.i&amp;&amp;x(h,d)){var l=T(h,d);return h=n(h,h.next),l=n(l,l.next),a(h,t,i,s,r,o),void a(l,t,i,s,r,o)}d=d.next}h=h.next}while(h!==e)}function f(e,t){return e.x-t.x}function c(e,t){if(t=function(e,t){var i,s=t,r=e.x,o=e.y,n=-1/0;do{if(o&lt;=s.y&amp;&amp;o&gt;=s.next.y){var a=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);a&lt;=r&amp;&amp;a&gt;n&amp;&amp;(n=a,i=s.x&lt;s.next.x?s:s.next)}s=s.next}while(s!==t);if(!i)return null;var h,d=i,l=1/0;s=i.next;for(;s!==d;)r&gt;=s.x&amp;&amp;s.x&gt;=i.x&amp;&amp;p(o&lt;i.y?r:n,o,i.x,i.y,o&lt;i.y?n:r,o,s.x,s.y)&amp;&amp;((h=Math.abs(o-s.y)/(r-s.x))&lt;l||h===l&amp;&amp;s.x&gt;i.x)&amp;&amp;b(s,e)&amp;&amp;(i=s,l=h),s=s.next;return i}(e,t)){var i=T(t,e);n(i,i.next)}}function m(e,t,i,s,r){return(e=1431655765&amp;((e=858993459&amp;((e=252645135&amp;((e=16711935&amp;((e=32767*(e-i)/r)|e&lt;&lt;8))|e&lt;&lt;4))|e&lt;&lt;2))|e&lt;&lt;1))|(t=1431655765&amp;((t=858993459&amp;((t=252645135&amp;((t=16711935&amp;((t=32767*(t-s)/r)|t&lt;&lt;8))|t&lt;&lt;4))|t&lt;&lt;2))|t&lt;&lt;1))&lt;&lt;1}function _(e){var t=e,i=e;do{t.x&lt;i.x&amp;&amp;(i=t),t=t.next}while(t!==e);return i}function p(e,t,i,s,r,o,n,a){return(r-n)*(t-a)-(e-n)*(o-a)&gt;=0&amp;&amp;(e-n)*(s-a)-(i-n)*(t-a)&gt;=0&amp;&amp;(i-n)*(o-a)-(r-n)*(s-a)&gt;=0}function x(e,t){return v(e,t)||e.next.i!==t.i&amp;&amp;e.prev.i!==t.i&amp;&amp;!function(e,t){var i=e;do{if(i.i!==e.i&amp;&amp;i.next.i!==e.i&amp;&amp;i.i!==t.i&amp;&amp;i.next.i!==t.i&amp;&amp;y(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&amp;&amp;b(e,t)&amp;&amp;b(t,e)&amp;&amp;function(e,t){var i=e,s=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y&gt;o!==i.next.y&gt;o&amp;&amp;r&lt;(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&amp;&amp;(s=!s),i=i.next}while(i!==e);return s}(e,t)}function g(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function v(e,t){return e.x===t.x&amp;&amp;e.y===t.y}function y(e,t,i,s){return g(e,t,i)&gt;0!==g(e,t,s)&gt;0&amp;&amp;g(i,s,e)&gt;0!==g(i,s,t)&gt;0}function b(e,t){return g(e.prev,e,e.next)&lt;0?g(e,t,e.next)&gt;=0&amp;&amp;g(e,e.prev,t)&gt;=0:g(e,t,e.prev)&lt;0||g(e,e.next,t)&lt;0}function T(e,t){var i=new M(e.i,e.x,e.y),s=new M(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s}function S(e,t,i,s){var r=new M(e,t,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function w(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&amp;&amp;(e.prevZ.nextZ=e.nextZ),e.nextZ&amp;&amp;(e.nextZ.prevZ=e.prevZ)}function M(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}}},x3dom.FieldInterpolator=function(e,t,i,s){this.beginTime=e||0,this.endTime=t||1,this.beginValue=i||0,this.endValue=s||0,this.isInterpolating=!1},x3dom.FieldInterpolator.prototype.isActive=function(){return this.beginTime&gt;0},x3dom.FieldInterpolator.prototype.calcFraction=function(e){var t=(e-this.beginTime)/(this.endTime-this.beginTime);return(Math.sin(t*Math.PI-Math.PI/2)+1)/2},x3dom.FieldInterpolator.prototype.reset=function(){this.isInterpolating=!1,this.beginTime=0,this.endTime=1,this.beginValue=0,this.endValue=0},x3dom.FieldInterpolator.prototype.interpolate=function(e){if(e&lt;this.beginTime)return this.beginValue;if(e&gt;=this.endTime){var t=this.endValue;return this.reset(),t}return this.isInterpolating=!0,this.beginValue+(this.endValue-this.beginValue)*this.calcFraction(e)},x3dom.Utils={},x3dom.Utils.maxIndexableCoords=65535,x3dom.Utils.needLineWidth=!1,x3dom.Utils.measurements=[],window.performance=window.performance||{},performance.now=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()},x3dom.Utils.startMeasure=function(e){var t=e.toUpperCase();x3dom.Utils.measurements[t]||(performance&amp;&amp;performance.now?x3dom.Utils.measurements[t]=performance.now():x3dom.Utils.measurements[t]=(new Date).getTime())},x3dom.Utils.stopMeasure=function(e){var t=e.toUpperCase();if(x3dom.Utils.measurements[t]){var i=x3dom.Utils.measurements[t];return delete x3dom.Utils.measurements[t],performance&amp;&amp;performance.now?performance.now()-i:(new Date).getTime()-i}return 0},x3dom.Utils.isNumber=function(e){return!isNaN(parseFloat(e))&amp;&amp;isFinite(e)},x3dom.Utils.createTexture2D=function(e,t,i,s,r,o,n){var a=e.createTexture(),h=new Uint8Array([0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255]);if(e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,2,2,0,e.RGBA,e.UNSIGNED_BYTE,h),n&amp;&amp;e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null),a.ready=!1,null==i||""==i)return a;var d=new Image;switch(r.toLowerCase()){case"anonymous":d.crossOrigin="anonymous";break;case"use-credentials":d.crossOrigin="use-credentials";break;case"none":break;default:x3dom.Utils.forbiddenBySOP(i)&amp;&amp;(d.crossOrigin="anonymous")}return d.src=i,t.downloadCount++,d.onload=function(){a.originalWidth=d.width,a.originalHeight=d.height,o&amp;&amp;(d=x3dom.Utils.scaleImage(d)),1==s&amp;&amp;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,d),n&amp;&amp;e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null),1==s&amp;&amp;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),a.width=d.width,a.height=d.height,a.ready=!0,t.downloadCount--,t.needRender=!0},d.onerror=function(o){-1!==x3dom.caps.EXTENSIONS.indexOf("WEBGL_compressed_texture_s3tc")?x3dom.Utils.tryCompressedTexture2D(a,e,t,i,s,r,n,(function(e){e||x3dom.debug.logError("[Utils|createTexture2D] Can't load Image: "+i),t.downloadCount--})):(x3dom.debug.logError("[Utils|createTexture2D] Can't load Image: "+i),t.downloadCount--)},a},x3dom.Utils.createCompressedTexture2D=function(e,t,i,s,r,o){var n=e.createTexture(),a=new Uint8Array([0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255]);if(e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,2,2,0,e.RGBA,e.UNSIGNED_BYTE,a),o&amp;&amp;e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null),n.ready=!1,null==i||""==i)return n;ddsXhr=new XMLHttpRequest;var h=e.getExtension("WEBGL_compressed_texture_s3tc");return ddsXhr.open("GET",i,!0),ddsXhr.responseType="arraybuffer",ddsXhr.onload=function(){e.bindTexture(e.TEXTURE_2D,n);var i=uploadDDSLevels(e,h,this.response);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,i&gt;1?e.LINEAR_MIPMAP_LINEAR:e.LINEAR),n.ready=!0,t.downloadCount--,t.needRender=!0},t.downloadCount++,x3dom.RequestManager.addRequest(ddsXhr),n},x3dom.Utils.tryCompressedTexture2D=function(e,t,i,s,r,o,n,a){ddsXhr=new XMLHttpRequest;var h=t.getExtension("WEBGL_compressed_texture_s3tc");ddsXhr.open("GET",s,!0),ddsXhr.responseType="arraybuffer",ddsXhr.onload=function(){t.bindTexture(t.TEXTURE_2D,e);var s=uploadDDSLevels(t,h,this.response);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,s&gt;1?t.LINEAR_MIPMAP_LINEAR:t.LINEAR),e.ready=!0,i.needRender=!0,a(!0)},ddsXhr.onerror=function(){a(!1)},x3dom.RequestManager.addRequest(ddsXhr)},x3dom.Utils.createTextureCube=function(e,t,i,s,r,o,n){var a,h=e.createTexture();a=s?[e.TEXTURE_CUBE_MAP_POSITIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_X]:[e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_X],h.ready=!1,h.pendingTextureLoads=-1,h.textureCubeReady=!1;for(var d=0,l=0,u=0;u&lt;a.length;u++){var f=a[u],c=new Image;switch(r.toLowerCase()){case"anonymous":c.crossOrigin="anonymous";break;case"use-credentials":c.crossOrigin="use-credentials";break;case"none":break;default:x3dom.Utils.forbiddenBySOP(i[u])&amp;&amp;(c.crossOrigin="anonymous")}h.pendingTextureLoads++,t.downloadCount++,c.onload=function(i,s,r,a){return function(){0==d&amp;&amp;0==l?(d=r.width,l=r.height):!o||d==r.width&amp;&amp;l==r.height||(x3dom.debug.logWarning("[Utils|createTextureCube] Rescaling CubeMap images, which are of different size!"),r=x3dom.Utils.rescaleImage(r,d,l)),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a),e.bindTexture(e.TEXTURE_CUBE_MAP,i),e.texImage2D(s,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r),e.bindTexture(e.TEXTURE_CUBE_MAP,null),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),i.pendingTextureLoads--,t.downloadCount--,i.pendingTextureLoads&lt;0&amp;&amp;(i.width=d,i.height=l,i.textureCubeReady=!0,n&amp;&amp;(e.bindTexture(e.TEXTURE_CUBE_MAP,i),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)),x3dom.debug.logInfo("[Utils|createTextureCube] Loading CubeMap finished..."),t.needRender=!0)}}(h,f,c,s),c.onerror=function(){t.downloadCount--,x3dom.debug.logError("[Utils|createTextureCube] Can't load CubeMap!")},c.src=i[u]}return h},x3dom.Utils.initFBO=function(e,t,i,s,r,o,n){var a=e.createTexture();a.width=t,a.height=i,e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,i,0,e.RGBA,s,null),r&amp;&amp;e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null);var h,d=null;if(x3dom.caps.DRAW_BUFFERS&amp;&amp;void 0!==n)for(d=[a],h=1;h&lt;n;h++)d[h]=e.createTexture(),d[h].width=t,d[h].height=i,e.bindTexture(e.TEXTURE_2D,d[h]),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,i,0,e.RGBA,s,null),r&amp;&amp;e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null);var l=e.createFramebuffer(),u=null,f=null;if(o&amp;&amp;(null!==x3dom.caps.DEPTH_TEXTURE?(u=e.createTexture(),e.bindTexture(e.TEXTURE_2D,u),e.texImage2D(e.TEXTURE_2D,0,e.DEPTH_COMPONENT,t,i,0,e.DEPTH_COMPONENT,e.UNSIGNED_SHORT,null),r&amp;&amp;e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null),u.width=t,u.height=i):(f=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,f),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t,i),e.bindRenderbuffer(e.RENDERBUFFER,null))),e.bindFramebuffer(e.FRAMEBUFFER,l),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0),x3dom.caps.DRAW_BUFFERS&amp;&amp;void 0!==n)for(h=1;h&lt;n;h++)e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+h,e.TEXTURE_2D,d[h],0);o&amp;&amp;null!==x3dom.caps.DEPTH_TEXTURE?e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,u,0):e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,f);var c=e.checkFramebufferStatus(e.FRAMEBUFFER);return c!=e.FRAMEBUFFER_COMPLETE&amp;&amp;x3dom.debug.logWarning("[Utils|InitFBO] FBO-Status: "+c),e.bindFramebuffer(e.FRAMEBUFFER,null),{fbo:l,dtex:u,rbo:f,tex:a,texTargets:d,width:t,height:i,type:s,mipMap:r}},x3dom.Utils.getFileName=function(e){return e.lastIndexOf("/")&gt;-1?e.substr(e.lastIndexOf("/")+1):e.lastIndexOf("\\")&gt;-1?e.substr(e.lastIndexOf("\\")+1):e},x3dom.Utils.isWebGL2Enabled=function(){var e=document.createElement("canvas");return!!(e.getContext("webgl2")||e.getContext("experimental-webgl2"))},x3dom.Utils.findTextureByName=function(e,t){for(var i=0;i&lt;e.length;++i)if(t==e[i].samplerName)return e[i];return!1},x3dom.Utils.rescaleImage=function(e,t,i){var s=document.createElement("canvas");return s.width=t,s.height=i,s.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,s.width,s.height),s},x3dom.Utils.scaleImage=function(e){if(!x3dom.Utils.isPowerOfTwo(e.width)||!x3dom.Utils.isPowerOfTwo(e.height)){var t=document.createElement("canvas");t.width=x3dom.Utils.nextHighestPowerOfTwo(e.width),t.height=x3dom.Utils.nextHighestPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),e=t}return e},x3dom.Utils.isPowerOfTwo=function(e){return 0===(e&amp;e-1)},x3dom.Utils.nextHighestPowerOfTwo=function(e){--e;for(var t=1;t&lt;32;t&lt;&lt;=1)e|=e&gt;&gt;t;return e+1},x3dom.Utils.nextBestPowerOfTwo=function(e){var t=Math.log(e)/.693147180559945;return Math.pow(2,Math.round(t))},x3dom.Utils.getDataTypeSize=function(e){switch(e){case"Int8":case"Uint8":return 1;case"Int16":case"Uint16":return 2;case"Int32":case"Uint32":case"Float32":return 4;case"Float64":default:return 8}},x3dom.Utils.getOffsetMultiplier=function(e,t){switch(e){case t.UNSIGNED_SHORT:return 1;case t.UNSIGNED_INT:return 2;case t.UNSIGNED_BYTE:return.5;default:return 1}},x3dom.Utils.getByteAwareOffset=function(e,t,i){switch(t){case i.UNSIGNED_SHORT:return 2*e;case i.UNSIGNED_INT:return 4*e;case i.UNSIGNED_BYTE:return e;default:return 2*e}},x3dom.Utils.getVertexAttribType=function(e,t){var i=t.NONE;switch(e){case"Int8":i=t.BYTE;break;case"Uint8":i=t.UNSIGNED_BYTE;break;case"Int16":i=t.SHORT;break;case"Uint16":i=t.UNSIGNED_SHORT;break;case"Int32":i=t.INT;break;case"Uint32":i=t.UNSIGNED_INT;break;case"Float32":i=t.FLOAT;break;case"Float64":default:x3dom.debug.logError("Can't find this.gl data type for "+e+", getting FLOAT..."),i=t.FLOAT}return i},x3dom.Utils.getArrayBufferView=function(e,t){var i=null;switch(e){case"Int8":i=new Int8Array(t);break;case"Uint8":i=new Uint8Array(t);break;case"Int16":i=new Int16Array(t);break;case"Uint16":i=new Uint16Array(t);break;case"Int32":i=new Int32Array(t);break;case"Uint32":i=new Uint32Array(t);break;case"Float32":i=new Float32Array(t);break;case"Float64":i=new Float64Array(t);break;default:x3dom.debug.logError("Can't create typed array view of type "+e+", trying Float32..."),i=new Float32Array(t)}return i},x3dom.Utils.isUnsignedType=function(e){return"Uint8"==e||"Uint16"==e||"Uint16"==e||"Uint32"==e},x3dom.Utils.checkDirtyLighting=function(e){return e.getLights().length+e._scene.getNavigationInfo()._vf.headlight},x3dom.Utils.checkDirtyEnvironment=function(e,t){var i=e._scene.getEnvironment();return t.GAMMACORRECTION!=i._vf.gammaCorrectionDefault},x3dom.Utils.minFilterDic=function(e,t){switch(t.toUpperCase()){case"NEAREST":return e.NEAREST;case"LINEAR":return e.LINEAR;case"NEAREST_MIPMAP_NEAREST":return e.NEAREST_MIPMAP_NEAREST;case"NEAREST_MIPMAP_LINEAR":return e.NEAREST_MIPMAP_LINEAR;case"LINEAR_MIPMAP_NEAREST":return e.LINEAR_MIPMAP_NEAREST;case"LINEAR_MIPMAP_LINEAR":return e.LINEAR_MIPMAP_LINEAR;case"AVG_PIXEL":return e.LINEAR;case"AVG_PIXEL_AVG_MIPMAP":return e.LINEAR_MIPMAP_LINEAR;case"AVG_PIXEL_NEAREST_MIPMAP":return e.LINEAR_MIPMAP_NEAREST;case"DEFAULT":return e.LINEAR_MIPMAP_LINEAR;case"FASTEST":case"NEAREST_PIXEL":return e.NEAREST;case"NEAREST_PIXEL_AVG_MIPMAP":return e.NEAREST_MIPMAP_LINEAR;case"NEAREST_PIXEL_NEAREST_MIPMAP":return e.NEAREST_MIPMAP_NEAREST;case"NICEST":return e.LINEAR_MIPMAP_LINEAR;default:return e.LINEAR}},x3dom.Utils.magFilterDic=function(e,t){switch(t.toUpperCase()){case"NEAREST":return e.NEAREST;case"LINEAR":case"AVG_PIXEL":case"DEFAULT":return e.LINEAR;case"FASTEST":case"NEAREST_PIXEL":return e.NEAREST;case"NICEST":default:return e.LINEAR}},x3dom.Utils.boundaryModesDic=function(e,t){switch(t.toUpperCase()){case"CLAMP":case"CLAMP_TO_EDGE":case"CLAMP_TO_BOUNDARY":return e.CLAMP_TO_EDGE;case"MIRRORED_REPEAT":return e.MIRRORED_REPEAT;case"REPEAT":default:return e.REPEAT}},x3dom.Utils.primTypeDic=function(e,t){switch(t.toUpperCase()){case"POINTS":return e.POINTS;case"LINES":return e.LINES;case"LINELOOP":return e.LINE_LOOP;case"LINESTRIP":return e.LINE_STRIP;case"TRIANGLES":return e.TRIANGLES;case"TRIANGLESTRIP":return e.TRIANGLE_STRIP;case"TRIANGLEFAN":return e.TRIANGLE_FAN;default:return e.TRIANGLES}},x3dom.Utils.depthFunc=function(e,t){switch(t.toUpperCase()){case"NEVER":return e.NEVER;case"ALWAYS":return e.ALWAYS;case"LESS":return e.LESS;case"EQUAL":return e.EQUAL;case"LEQUAL":return e.LEQUAL;case"GREATER":return e.GREATER;case"GEQUAL":return e.GEQUAL;case"NOTEQUAL":return e.NOTEQUAL;default:return e.LEQUAL}},x3dom.Utils.blendFunc=function(e,t){switch(t.toLowerCase()){case"zero":return e.ZERO;case"one":return e.ONE;case"dst_color":return e.DST_COLOR;case"dst_alpha":return e.DST_ALPHA;case"src_color":return e.SRC_COLOR;case"src_alpha":return e.SRC_ALPHA;case"one_minus_dst_color":return e.ONE_MINUS_DST_COLOR;case"one_minus_dst_alpha":return e.ONE_MINUS_DST_ALPHA;case"one_minus_src_color":return e.ONE_MINUS_SRC_COLOR;case"one_minus_src_alpha":return e.ONE_MINUS_SRC_ALPHA;case"src_alpha_saturate":return e.SRC_ALPHA_SATURATE;case"constant_color":return e.CONSTANT_COLOR;case"constant_alpha":return e.CONSTANT_ALPHA;case"one_minus_constant_color":return e.ONE_MINUS_CONSTANT_COLOR;case"one_minus_constant_alpha":return e.ONE_MINUS_CONSTANT_ALPHA;default:return 0}},x3dom.Utils.blendEquation=function(e,t){switch(t.toLowerCase()){case"func_add":return e.FUNC_ADD;case"func_subtract":return e.FUNC_SUBTRACT;case"func_reverse_subtract":return e.FUNC_REVERSE_SUBTRACT;case"min":case"max":case"logic_op":default:return 0}},x3dom.Utils.gunzip=function(e){var t=new Uint8Array(e);try{e=new Zlib.Gunzip(t).decompress().buffer}catch(i){}return e},x3dom.Utils.generateProperties=function(e,t){var i={},s=t._cf.geometry.node,r=t._cf.appearance.node,o=r?r._cf.texture.node:null,n=r?r._cf.material.node:null,a=e._scene.getEnvironment();return r&amp;&amp;r._shader&amp;&amp;x3dom.isa(r._shader,x3dom.nodeTypes.ComposedShader)?i.CSHADER=r._shader._id:s&amp;&amp;(i.CSHADER=-1,i.SOLID=t.isSolid()?1:0,i.TEXT=x3dom.isa(s,x3dom.nodeTypes.Text)?1:0,i.POPGEOMETRY=x3dom.isa(s,x3dom.nodeTypes.PopGeometry)?1:0,i.IMAGEGEOMETRY=x3dom.isa(s,x3dom.nodeTypes.ImageGeometry)?1:0,i.BINARYGEOMETRY=x3dom.isa(s,x3dom.nodeTypes.BinaryGeometry)?1:0,i.EXTERNALGEOMETRY=x3dom.isa(s,x3dom.nodeTypes.ExternalGeometry)?1:0,i.IG_PRECISION=i.IMAGEGEOMETRY?s.numCoordinateTextures():0,i.IG_INDEXED=i.IMAGEGEOMETRY&amp;&amp;null!=s.getIndexTexture()?1:0,i.POINTLINE2D=s.needLighting()?0:1,i.VERTEXID=(i.BINARYGEOMETRY||i.EXTERNALGEOMETRY)&amp;&amp;s._vf.idsPerVertex?1:0,i.IS_PARTICLE=x3dom.isa(s,x3dom.nodeTypes.ParticleSet)?1:0,i.TWOSIDEDMAT=i.APPMAT&amp;&amp;x3dom.isa(n,x3dom.nodeTypes.TwoSidedMaterial)?1:0,i.SEPARATEBACKMAT=i.TWOSIDEDMAT&amp;&amp;n._vf.separateBackColor?1:0,i.SHADOW=e.getLightsShadow()?1:0,i.FOG=e._scene.getFog()._vf.visibilityRange&gt;0?1:0,i.CSSHADER=r&amp;&amp;r._shader&amp;&amp;x3dom.isa(r._shader,x3dom.nodeTypes.CommonSurfaceShader)?1:0,i.APPMAT=r&amp;&amp;(n||i.CSSHADER)?1:0,i.LIGHTS=!i.POINTLINE2D&amp;&amp;r&amp;&amp;t.isLit()&amp;&amp;(n||i.CSSHADER)?e.getLights().length+e._scene.getNavigationInfo()._vf.headlight:0,i.TEXTURED=o||i.TEXT||i.CSSHADER&amp;&amp;r._shader.needTexcoords()?1:0,i.CUBEMAP=o&amp;&amp;x3dom.isa(o,x3dom.nodeTypes.X3DEnvironmentTextureNode)||i.CSSHADER&amp;&amp;r._shader.getEnvironmentMap()?1:0,i.PIXELTEX=o&amp;&amp;x3dom.isa(o,x3dom.nodeTypes.PixelTexture)?1:0,i.TEXTRAFO=r&amp;&amp;r._cf.textureTransform.node?1:0,i.DIFFUSEMAP=o&amp;&amp;!x3dom.isa(o,x3dom.nodeTypes.X3DEnvironmentTextureNode)||i.CSSHADER&amp;&amp;r._shader.getDiffuseMap()?1:0,i.NORMALMAP=i.CSSHADER&amp;&amp;r._shader.getNormalMap()?1:0,i.NORMALSPACE=i.NORMALMAP?r._shader._vf.normalSpace.toUpperCase():"",i.SPECMAP=i.CSSHADER&amp;&amp;r._shader.getSpecularMap()?1:0,i.SHINMAP=i.CSSHADER&amp;&amp;r._shader.getShininessMap()?1:0,i.DISPLACEMENTMAP=i.CSSHADER&amp;&amp;r._shader.getDisplacementMap()?1:0,i.DIFFPLACEMENTMAP=i.CSSHADER&amp;&amp;r._shader.getDiffuseDisplacementMap()?1:0,i.MULTIDIFFALPMAP=i.VERTEXID&amp;&amp;i.CSSHADER&amp;&amp;r._shader.getMultiDiffuseAlphaMap()?1:0,i.MULTIEMIAMBMAP=i.VERTEXID&amp;&amp;i.CSSHADER&amp;&amp;r._shader.getMultiEmissiveAmbientMap()?1:0,i.MULTISPECSHINMAP=i.VERTEXID&amp;&amp;i.CSSHADER&amp;&amp;r._shader.getMultiSpecularShininessMap()?1:0,i.MULTIVISMAP=i.VERTEXID&amp;&amp;i.CSSHADER&amp;&amp;r._shader.getMultiVisibilityMap()?1:0,i.BLENDING=i.TEXT||i.CUBEMAP||i.CSSHADER||o&amp;&amp;o._blending?1:0,i.REQUIREBBOX=void 0!==s._vf.coordType&amp;&amp;"Float32"!=s._vf.coordType?1:0,i.REQUIREBBOXNOR=void 0!==s._vf.normalType&amp;&amp;"Float32"!=s._vf.normalType?1:0,i.REQUIREBBOXCOL=void 0!==s._vf.colorType&amp;&amp;"Float32"!=s._vf.colorType?1:0,i.REQUIREBBOXTEX=void 0!==s._vf.texCoordType&amp;&amp;"Float32"!=s._vf.texCoordType?1:0,i.COLCOMPONENTS=s._mesh._numColComponents,i.NORCOMPONENTS=s._mesh._numNormComponents,i.POSCOMPONENTS=s._mesh._numPosComponents,i.SPHEREMAPPING=void 0!==s._cf.texCoord&amp;&amp;null!==s._cf.texCoord.node&amp;&amp;s._cf.texCoord.node._vf.mode&amp;&amp;"sphere"==s._cf.texCoord.node._vf.mode.toLowerCase()?1:0,i.VERTEXCOLOR=s._mesh._colors[0].length&gt;0||i.IMAGEGEOMETRY&amp;&amp;s.getColorTexture()||i.POPGEOMETRY&amp;&amp;s.hasColor()||void 0!==s._vf.color&amp;&amp;s._vf.color.length&gt;0?1:0,i.CLIPPLANES=t._clipPlanes.length,i.ALPHATHRESHOLD=r?r._vf.alphaClipThreshold.toFixed(2):.1,i.GAMMACORRECTION=a._vf.gammaCorrectionDefault,i.KHR_MATERIAL_COMMONS=0),i.toIdentifier=function(){delete this.id;var e="";for(var t in this)this[t]!=this.toIdentifier&amp;&amp;this[t]!=this.toString&amp;&amp;(e+=this[t]);return this.id=e,e},i.toString=function(){var e="";for(var t in this)this[t]!=this.toIdentifier&amp;&amp;this[t]!=this.toString&amp;&amp;(e+=t+": "+this[t]+", ");return e},i.toIdentifier(),i},x3dom.Utils.wrapProgram=function(e,t,i){var s,r,o={shaderID:i,program:t,bind:function(){e.useProgram(t)}},n=null,a=null,h=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(s=0;s&lt;h;++s){try{a=e.getActiveUniform(t,s)}catch(l){if(!a)continue}switch((r=e.getError())&amp;&amp;x3dom.debug.logError("GL-Error (on searching uniforms): "+r),n=e.getUniformLocation(t,a.name),a.type){case e.SAMPLER_2D:case e.SAMPLER_CUBE:case e.BOOL:o.__defineSetter__(a.name,function(t){return function(i){e.uniform1i(t,i)}}(n));break;case e.FLOAT:-1!=a.name.indexOf("[0]")?o.__defineSetter__(a.name.substring(0,a.name.length-3),function(t){return function(i){e.uniform1fv(t,new Float32Array(i))}}(n)):o.__defineSetter__(a.name,function(t){return function(i){e.uniform1f(t,i)}}(n));break;case e.FLOAT_VEC2:o.__defineSetter__(a.name,function(t){return function(i){e.uniform2f(t,i[0],i[1])}}(n));break;case e.FLOAT_VEC3:-1!=a.name.indexOf("[0]")?o.__defineSetter__(a.name.substring(0,a.name.length-3),function(t){return function(i){e.uniform3fv(t,new Float32Array(i))}}(n)):o.__defineSetter__(a.name,function(t){return function(i){e.uniform3f(t,i[0],i[1],i[2])}}(n));break;case e.FLOAT_VEC4:o.__defineSetter__(a.name,function(t){return function(i){e.uniform4f(t,i[0],i[1],i[2],i[3])}}(n));break;case e.FLOAT_MAT2:o.__defineSetter__(a.name,function(t){return function(i){e.uniformMatrix2fv(t,!1,new Float32Array(i))}}(n));break;case e.FLOAT_MAT3:o.__defineSetter__(a.name,function(t){return function(i){e.uniformMatrix3fv(t,!1,new Float32Array(i))}}(n));break;case e.FLOAT_MAT4:o.__defineSetter__(a.name,function(t){return function(i){e.uniformMatrix4fv(t,!1,new Float32Array(i))}}(n));break;case e.INT:o.__defineSetter__(a.name,function(t){return function(i){e.uniform1i(t,i)}}(n));break;default:x3dom.debug.logWarning("GLSL program variable "+a.name+" has unknown type "+a.type)}}var d=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(s=0;s&lt;d;++s){try{a=e.getActiveAttrib(t,s)}catch(u){if(!a)continue}(r=e.getError())&amp;&amp;x3dom.debug.logError("GL-Error (on searching attributes): "+r),n=e.getAttribLocation(t,a.name),o[a.name]=n}return o},x3dom.Utils.forbiddenBySOP=function(e){var t,i,s,r,o,n=(e=e.toLowerCase()).split("//"),a=""===document.location.port?"80":document.location.port;return 2===n.length&amp;&amp;(t=n[0],o=(s=(1===(i=n[1].split("/")[0].split("?")[0].split("#")[0].split("@")).length?i[0]:i[1]).split(":"))[0],r=s[1]),r=r||"80",o=o||document.location.host,t=t||document.location.protocol,!(r===a&amp;&amp;o===document.location.host&amp;&amp;t===document.location.protocol)},x3dom.States=function(e){var t=this;this.active=!1,this.viewer=document.createElement("div"),this.viewer.id="x3dom-state-viewer";var i=document.createElement("div");i.className="x3dom-states-head",i.appendChild(document.createTextNode("x3dom"));var s=document.createElement("span");s.className="x3dom-states-head2",s.appendChild(document.createTextNode("stats")),i.appendChild(s),this.renderMode=document.createElement("div"),this.renderMode.className="x3dom-states-rendermode-hardware",this.measureList=document.createElement("ul"),this.measureList.className="x3dom-states-list",this.infoList=document.createElement("ul"),this.infoList.className="x3dom-states-list",this.requestList=document.createElement("ul"),this.requestList.className="x3dom-states-list",this.viewer.appendChild(this.renderMode),this.viewer.appendChild(this.measureList),this.viewer.appendChild(this.infoList),this.viewer.appendChild(this.requestList),this.disableContextMenu=function(e){return e.preventDefault(),e.stopPropagation(),e.returnValue=!1,!1},this.thousandSeperator=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},this.toFixed=function(e){return e.toFixed(2)},this.addItem=function(e,t,i){var s=document.createElement("li");s.className="x3dom-states-item";var r=document.createElement("div");r.className="x3dom-states-item-title",r.appendChild(document.createTextNode(t));var o=document.createElement("div");o.className="x3dom-states-item-value",o.appendChild(document.createTextNode(i)),s.appendChild(r),s.appendChild(o),e.appendChild(s)},this.update=function(){if(e.runtime||void 0===this.updateMethodID){var t=e.runtime.states.infos,i=e.runtime.states.measurements,s=x3dom.caps.RENDERMODE;for(var r in"HARDWARE"==s?(this.renderMode.innerHTML="Hardware-Rendering",this.renderMode.className="x3dom-states-rendermode-hardware"):"SOFTWARE"==s&amp;&amp;(this.renderMode.innerHTML="Software-Rendering",this.renderMode.className="x3dom-states-rendermode-software"),this.measureList.innerHTML="",i)i.hasOwnProperty(r)&amp;&amp;this.addItem(this.measureList,r,this.toFixed(i[r]));for(var o in this.infoList.innerHTML="",t)t.hasOwnProperty(o)&amp;&amp;this.addItem(this.infoList,o,this.thousandSeperator(t[o]));this.requestList.innerHTML="",this.addItem(this.requestList,"#ACTIVE",x3dom.RequestManager.activeRequests.length),this.addItem(this.requestList,"#TOTAL",x3dom.RequestManager.totalRequests),this.addItem(this.requestList,"#LOADED",x3dom.RequestManager.loadedRequests),this.addItem(this.requestList,"#FAILED",x3dom.RequestManager.failedRequests)}else clearInterval(this.updateMethodID)},this.updateMethodID=window.setInterval((function(){t.update()}),1e3),this.viewer.addEventListener("contextmenu",t.disableContextMenu)},x3dom.States.prototype.display=function(e){this.active=void 0!==e?e:!this.active,this.viewer.style.display=this.active?"block":"none"},x3dom.StateManager=function(e){this.gl=e,this.states=[],this.initStates()},x3dom.StateManager.prototype.initStates=function(){this.states.shaderID=null,this.states.colorMask={red:null,green:null,blue:null,alpha:null},this.states.depthMask=null,this.states.stencilMask=null,this.states.cullFace=null,this.states.frontFace=null,this.states.lineWidth=null,this.states.blendColor={red:null,green:null,blue:null,alpha:null},this.states.blendEquation=null,this.states.blendEquationSeparate={modeRGB:null,modeAlpha:null},this.states.blendFunc={sfactor:null,dfactor:null},this.states.blendFuncSeparate={srcRGB:null,dstRGB:null,srcAlpha:null,dstAlpha:null},this.states.depthFunc=null,this.states.viewport={x:null,y:null,width:null,height:null},this.states.depthRange={zNear:null,zFar:null}},x3dom.StateManager.prototype.useProgram=function(e){return this.states.shaderID!=e.shaderID&amp;&amp;(this.gl.useProgram(e.program),this.states.shaderID=e.shaderID,!0)},x3dom.StateManager.prototype.unsetProgram=function(){this.states.shaderID=null},x3dom.StateManager.prototype.enable=function(e){!0!==this.states[e]&amp;&amp;(this.gl.enable(e),this.states[e]=!0)},x3dom.StateManager.prototype.disable=function(e){!1!==this.states[e]&amp;&amp;(this.gl.disable(e),this.states[e]=!1)},x3dom.StateManager.prototype.colorMask=function(e,t,i,s){this.states.colorMask.red==e&amp;&amp;this.states.colorMask.green==t&amp;&amp;this.states.colorMask.blue==i&amp;&amp;this.states.colorMask.alpha==s||(this.gl.colorMask(e,t,i,s),this.states.colorMask.red=e,this.states.colorMask.green=t,this.states.colorMask.blue=i,this.states.colorMask.alpha=s)},x3dom.StateManager.prototype.depthMask=function(e){this.states.depthMask!=e&amp;&amp;(this.gl.depthMask(e),this.states.depthMask=e)},x3dom.StateManager.prototype.stencilMask=function(e){this.states.stencilMask!=e&amp;&amp;(this.gl.stencilMask(e),this.states.stencilMask=e)},x3dom.StateManager.prototype.cullFace=function(e){this.states.cullFace!=e&amp;&amp;(this.gl.cullFace(e),this.states.cullFace=e)},x3dom.StateManager.prototype.frontFace=function(e){this.states.frontFace!=e&amp;&amp;(this.gl.frontFace(e),this.states.frontFace=e)},x3dom.StateManager.prototype.lineWidth=function(e){e=e&lt;=1?1:e,this.states.lineWidth!=e&amp;&amp;(this.gl.lineWidth(e),this.states.lineWidth=e)},x3dom.StateManager.prototype.blendColor=function(e,t,i,s){this.states.blendColor.red==e&amp;&amp;this.states.blendColor.green==t&amp;&amp;this.states.blendColor.blue==i&amp;&amp;this.states.blendColor.alpha==s||(this.gl.blendColor(e,t,i,s),this.states.blendColor.red=e,this.states.blendColor.green=t,this.states.blendColor.blue=i,this.states.blendColor.alpha=s)},x3dom.StateManager.prototype.blendEquation=function(e){e&amp;&amp;this.states.blendEquation!=e&amp;&amp;(this.gl.blendEquation(e),this.states.blendEquation=e)},x3dom.StateManager.prototype.blendEquationSeparate=function(e,t){this.states.blendEquationSeparate.modeRGB==e&amp;&amp;this.states.blendEquationSeparate.modeAlpha==t||(this.gl.blendEquationSeparate(e,t),this.states.blendEquationSeparate.modeRGB=e,this.states.blendEquationSeparate.modeAlpha=t)},x3dom.StateManager.prototype.blendFunc=function(e,t){this.states.blendFunc.sfactor==e&amp;&amp;this.states.blendFunc.dfactor==t||(this.gl.blendFunc(e,t),this.states.blendFunc.sfactor=e,this.states.blendFunc.dfactor=t)},x3dom.StateManager.prototype.blendFuncSeparate=function(e,t,i,s){this.states.blendFuncSeparate.srcRGB==e&amp;&amp;this.states.blendFuncSeparate.dstRGB==t&amp;&amp;this.states.blendFuncSeparate.srcAlpha==i&amp;&amp;this.states.blendFuncSeparate.dstAlpha==s||(this.gl.blendFuncSeparate(e,t,i,s),this.states.blendFuncSeparate.srcRGB=e,this.states.blendFuncSeparate.dstRGB=t,this.states.blendFuncSeparate.srcAlpha=i,this.states.blendFuncSeparate.dstAlpha=s)},x3dom.StateManager.prototype.depthFunc=function(e){this.states.depthFunc!=e&amp;&amp;(this.gl.depthFunc(e),this.states.depthFunc=e)},x3dom.StateManager.prototype.depthRange=function(e,t){e&lt;0||t&lt;0||e&gt;t||(e=e&gt;1?1:e,t=t&gt;1?1:t,this.states.depthRange.zNear==e&amp;&amp;this.states.depthRange.zFar==t||(this.gl.depthRange(e,t),this.states.depthRange.zNear=e,this.states.depthRange.zFar=t))},x3dom.StateManager.prototype.viewport=function(e,t,i,s){this.states.viewport.x==e&amp;&amp;this.states.viewport.y==t&amp;&amp;this.states.viewport.width==i&amp;&amp;this.states.viewport.height==s||(this.gl.viewport(e,t,i,s),this.states.viewport.x=e,this.states.viewport.y=t,this.states.viewport.width=i,this.states.viewport.height=s)},x3dom.StateManager.prototype.bindFramebuffer=function(e,t){this.gl.bindFramebuffer(e,t),this.initStates()},x3dom.BinaryContainerLoader={outOfMemory:!1,checkError:function(e){var t=e.getError();t&amp;&amp;(t==e.OUT_OF_MEMORY?(this.outOfMemory=!0,x3dom.debug.logError("GL-Error "+t+" on loading binary container (out of memory)."),console.error("WebGL: OUT_OF_MEMORY")):x3dom.debug.logError("GL-Error "+t+" on loading binary container."))}},x3dom.BinaryContainerLoader.setupBinGeo=function(e,t,i,s,r){if(!this.outOfMemory){var o=(new Date).getTime(),n=this,a=e._cf.geometry.node;e._webgl.binaryGeometry=-1,e._webgl.internalDownloadCount=(a._vf.index.length&gt;0?1:0)+(a._hasStrideOffset&amp;&amp;a._vf.coord.length&gt;0?1:0)+(!a._hasStrideOffset&amp;&amp;a._vf.coord.length&gt;0?1:0)+(!a._hasStrideOffset&amp;&amp;a._vf.normal.length&gt;0?1:0)+(!a._hasStrideOffset&amp;&amp;a._vf.texCoord.length&gt;0?1:0)+(!a._hasStrideOffset&amp;&amp;a._vf.color.length&gt;0?1:0);var h=0==a._vf.normalPerVertex||a._vf.index.length&gt;0&amp;&amp;("Int32"==a._vf.indexType||"Uint32"==a._vf.indexType&amp;&amp;!x3dom.caps.INDEX_UINT);if(e._webgl.makeSeparateTris={index:null,coord:null,normal:null,texCoord:null,color:null,pushBuffer:function(t,i){this[t]=i,0==--e._webgl.internalDownloadCount&amp;&amp;(this.coord&amp;&amp;this.createMesh(),e._nameSpace.doc.needRender=!0),0==--e._nameSpace.doc.downloadCount&amp;&amp;(e._nameSpace.doc.needRender=!0)},createMesh:function(){var o=a;if(o._hasStrideOffset)x3dom.debug.logError(o._vf.indexType+" index type and per-face normals not supported for interleaved arrays.");else{for(var h=0;h&lt;e._webgl.primType.length;h++)if(e._webgl.primType[h]==i.TRIANGLE_STRIP)return void x3dom.debug.logError("makeSeparateTris: triangle strips not yet supported for per-face normals.");var d,l,u=o._vf.coordType;e._webgl.coordType=x3dom.Utils.getVertexAttribType(u,i),e._webgl.coordType!=i.FLOAT?(4==o._mesh._numPosComponents&amp;&amp;x3dom.Utils.isUnsignedType(o._vf.coordType)?x3dom.fields.SFVec3f.copy(o.getMin()):x3dom.fields.SFVec3f.copy(o._vf.position),d=x3dom.fields.SFVec3f.copy(o._vf.size),l=o.getPrecisionMax("coordType")):(new x3dom.fields.SFVec3f(0,0,0),d=new x3dom.fields.SFVec3f(1,1,1),l=1);var f=e._coordStrideOffset[0]/x3dom.Utils.getDataTypeSize(o._vf.coordType);f=0==f?3:f,x3dom.debug.logWarning("makeSeparateTris.createMesh called with coord length "+f),this.color&amp;&amp;f!=e._colorStrideOffset[0]/x3dom.Utils.getDataTypeSize(o._vf.colorType)&amp;&amp;(this.color=null,x3dom.debug.logWarning("Color format not supported."));var c=this.texCoord?e._texCoordStrideOffset[0]/x3dom.Utils.getDataTypeSize(o._vf.texCoordType):0;o._vf.normalType="Float32",e._webgl.normalType=i.FLOAT,o._mesh._numNormComponents=3,e._normalStrideOffset=[0,0];var m,_,p,x=[],g=[],v=[],y=[],b=this.index?this.index.length-2:this.coord.length/3-2;for(m=0;m&lt;b;m+=3){_=f*(this.index?this.index[m]:m);var T=new x3dom.fields.SFVec3f(d.x*this.coord[_]/l,d.y*this.coord[_+1]/l,d.z*this.coord[_+2]/l);x.push(this.coord[_]),x.push(this.coord[_+1]),x.push(this.coord[_+2]),f&gt;3&amp;&amp;x.push(this.coord[_+3]),this.color&amp;&amp;(y.push(this.color[_]),y.push(this.color[_+1]),y.push(this.color[_+2]),f&gt;3&amp;&amp;y.push(this.color[_+3])),this.texCoord&amp;&amp;(p=c*(this.index?this.index[m]:m),v.push(this.texCoord[p]),v.push(this.texCoord[p+1]),c&gt;3&amp;&amp;(v.push(this.texCoord[p+2]),v.push(this.texCoord[p+3]))),_=f*(this.index?this.index[m+1]:m+1);var S=new x3dom.fields.SFVec3f(d.x*this.coord[_]/l,d.y*this.coord[_+1]/l,d.z*this.coord[_+2]/l);x.push(this.coord[_]),x.push(this.coord[_+1]),x.push(this.coord[_+2]),f&gt;3&amp;&amp;x.push(this.coord[_+3]),this.color&amp;&amp;(y.push(this.color[_]),y.push(this.color[_+1]),y.push(this.color[_+2]),f&gt;3&amp;&amp;y.push(this.color[_+3])),this.texCoord&amp;&amp;(p=c*(this.index?this.index[m+1]:m+1),v.push(this.texCoord[p]),v.push(this.texCoord[p+1]),c&gt;3&amp;&amp;(v.push(this.texCoord[p+2]),v.push(this.texCoord[p+3]))),_=f*(this.index?this.index[m+2]:m+2);var w=new x3dom.fields.SFVec3f(d.x*this.coord[_]/l,d.y*this.coord[_+1]/l,d.z*this.coord[_+2]/l);x.push(this.coord[_]),x.push(this.coord[_+1]),x.push(this.coord[_+2]),f&gt;3&amp;&amp;x.push(this.coord[_+3]),this.color&amp;&amp;(y.push(this.color[_]),y.push(this.color[_+1]),y.push(this.color[_+2]),f&gt;3&amp;&amp;y.push(this.color[_+3])),this.texCoord&amp;&amp;(p=c*(this.index?this.index[m+2]:m+2),v.push(this.texCoord[p]),v.push(this.texCoord[p+1]),c&gt;3&amp;&amp;(v.push(this.texCoord[p+2]),v.push(this.texCoord[p+3])));var M=T.subtract(S),E=S.subtract(w),F=M.cross(E).normalize();for(_=0;_&lt;3;_++)g.push(F.x),g.push(F.y),g.push(F.z)}var C=i.createBuffer();e._webgl.buffers[1]=C,i.bindBuffer(i.ARRAY_BUFFER,C),i.bufferData(i.ARRAY_BUFFER,x3dom.Utils.getArrayBufferView(o._vf.coordType,x),i.STATIC_DRAW),i.vertexAttribPointer(t.position,o._mesh._numPosComponents,e._webgl.coordType,!1,e._coordStrideOffset[0],e._coordStrideOffset[1]),i.enableVertexAttribArray(t.position),C=i.createBuffer(),e._webgl.buffers[2]=C,i.bindBuffer(i.ARRAY_BUFFER,C),i.bufferData(i.ARRAY_BUFFER,new Float32Array(g),i.STATIC_DRAW),i.vertexAttribPointer(t.normal,o._mesh._numNormComponents,e._webgl.normalType,!1,e._normalStrideOffset[0],e._normalStrideOffset[1]),i.enableVertexAttribArray(t.normal),this.texCoord&amp;&amp;(C=i.createBuffer(),e._webgl.buffers[3]=C,i.bindBuffer(i.ARRAY_BUFFER,C),i.bufferData(i.ARRAY_BUFFER,x3dom.Utils.getArrayBufferView(o._vf.texCoordType,v),i.STATIC_DRAW),i.vertexAttribPointer(t.texcoord,o._mesh._numTexComponents,e._webgl.texCoordType,!1,e._texCoordStrideOffset[0],e._texCoordStrideOffset[1]),i.enableVertexAttribArray(t.texcoord)),this.color&amp;&amp;(C=i.createBuffer(),e._webgl.buffers[4]=C,i.bindBuffer(i.ARRAY_BUFFER,C),i.bufferData(i.ARRAY_BUFFER,x3dom.Utils.getArrayBufferView(o._vf.colorType,y),i.STATIC_DRAW),i.vertexAttribPointer(t.color,o._mesh._numColComponents,e._webgl.colorType,!1,e._colorStrideOffset[0],e._colorStrideOffset[1]),i.enableVertexAttribArray(t.color)),o._vf.vertexCount=[],o._vf.vertexCount[0]=x.length/f,o._mesh._numCoords=o._vf.vertexCount[0],o._mesh._numFaces=o._vf.vertexCount[0]/3,e._webgl.primType=[],e._webgl.primType[0]=i.TRIANGLES,x=null,g=null,v=null,y=null,this.index=null,this.coord=null,this.normal=null,this.texCoord=null,this.color=null,n.checkError(i),delete e._webgl.shader,e._webgl.shader=r.cache.getDynamicShader(i,s,e)}}},a._vf.index.length&gt;0){e._webgl.binaryGeometry=1;var d=new XMLHttpRequest;d.open("GET",e._nameSpace.getURL(a._vf.index),!0),d.responseType="arraybuffer",e._nameSpace.doc.downloadCount+=1,x3dom.RequestManager.addRequest(d),d.onload=function(){if(e._nameSpace.doc.downloadCount-=1,e._webgl.internalDownloadCount-=1,200==d.status){if(e._webgl){var t=1==a._vf.compressed?x3dom.Utils.gunzip(d.response):d.response,s=a,r=s._vf.indexType,l=x3dom.Utils.getArrayBufferView(r,t);if(h)e._webgl.makeSeparateTris.pushBuffer("index",l);else{var u=i.createBuffer();x3dom.caps.INDEX_UINT&amp;&amp;"Uint32"==r?e._webgl.indexType=i.UNSIGNED_INT:e._webgl.indexType=i.UNSIGNED_SHORT,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,u),i.bufferData(i.ELEMENT_ARRAY_BUFFER,l,i.STATIC_DRAW),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),0==s._vf.vertexCount[0]&amp;&amp;(s._vf.vertexCount[0]=l.length),s._mesh._numFaces=0;for(var f=0;f&lt;s._vf.vertexCount.length;f++)e._webgl.primType[f]==i.TRIANGLE_STRIP?s._mesh._numFaces+=s._vf.vertexCount[f]-2:s._mesh._numFaces+=s._vf.vertexCount[f]/3;l=null,0==e._webgl.internalDownloadCount&amp;&amp;(e._nameSpace.doc.needRender=!0),n.checkError(i);var c=(new Date).getTime()-o;x3dom.debug.logInfo("XHR0/ index load time: "+c+" ms"),e._webgl.buffers[0]=u}}}else x3dom.debug.logError("XHR1/ index load failed with status: "+d.status)}}if(a._hasStrideOffset&amp;&amp;a._vf.coord.length&gt;0){var l=new XMLHttpRequest;l.open("GET",e._nameSpace.getURL(a._vf.coord),!0),l.responseType="arraybuffer",e._nameSpace.doc.downloadCount+=1,x3dom.RequestManager.addRequest(l),l.onload=function(){if(e._nameSpace.doc.downloadCount-=1,e._webgl.internalDownloadCount-=1,200==l.status){if(e._webgl){var s=1==a._vf.compressed?x3dom.Utils.gunzip(l.response):l.response,r=a,h=r._vf.coordType;e._webgl.coordType=x3dom.Utils.getVertexAttribType(h,i),e._webgl.normalType=e._webgl.coordType,e._webgl.texCoordType=e._webgl.coordType,e._webgl.colorType=e._webgl.coordType;var d=x3dom.Utils.getArrayBufferView(h,s),u=e._coordStrideOffset[0]/x3dom.Utils.getDataTypeSize(h);if(u&amp;&amp;(r._mesh._numCoords=d.length/u),0==r._vf.index.length)for(var f=0;f&lt;r._vf.vertexCount.length;f++)e._webgl.primType[f]==i.TRIANGLE_STRIP?r._mesh._numFaces+=r._vf.vertexCount[f]-2:r._mesh._numFaces+=r._vf.vertexCount[f]/3;var c=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,c),i.bufferData(i.ARRAY_BUFFER,d,i.STATIC_DRAW),i.vertexAttribPointer(t.position,r._mesh._numPosComponents,e._webgl.coordType,!1,e._coordStrideOffset[0],e._coordStrideOffset[1]),i.enableVertexAttribArray(t.position),r._vf.normal.length&gt;0&amp;&amp;(e._webgl.buffers[2]=c,i.bindBuffer(i.ARRAY_BUFFER,c),i.bufferData(i.ARRAY_BUFFER,d,i.STATIC_DRAW),i.vertexAttribPointer(t.normal,r._mesh._numNormComponents,e._webgl.normalType,!1,e._normalStrideOffset[0],e._normalStrideOffset[1]),i.enableVertexAttribArray(t.normal)),r._vf.texCoord.length&gt;0&amp;&amp;(e._webgl.buffers[3]=c,i.bindBuffer(i.ARRAY_BUFFER,c),i.bufferData(i.ARRAY_BUFFER,d,i.STATIC_DRAW),i.vertexAttribPointer(t.texcoord,r._mesh._numTexComponents,e._webgl.texCoordType,!1,e._texCoordStrideOffset[0],e._texCoordStrideOffset[1]),i.enableVertexAttribArray(t.texcoord)),r._vf.color.length&gt;0&amp;&amp;(e._webgl.buffers[4]=c,i.bindBuffer(i.ARRAY_BUFFER,c),i.bufferData(i.ARRAY_BUFFER,d,i.STATIC_DRAW),i.vertexAttribPointer(t.color,r._mesh._numColComponents,e._webgl.colorType,!1,e._colorStrideOffset[0],e._colorStrideOffset[1]),i.enableVertexAttribArray(t.color)),d=null,0==e._webgl.internalDownloadCount&amp;&amp;(e._nameSpace.doc.needRender=!0),n.checkError(i);var m=(new Date).getTime()-o;x3dom.debug.logInfo("XHR/ interleaved array load time: "+m+" ms"),e._webgl.buffers[1]=c}}else x3dom.debug.logError("XHR1/ interleaved array load failed with status: "+l.status)}}if(!a._hasStrideOffset&amp;&amp;a._vf.coord.length&gt;0){var u=new XMLHttpRequest;u.open("GET",e._nameSpace.getURL(a._vf.coord),!0),u.responseType="arraybuffer",e._nameSpace.doc.downloadCount+=1,x3dom.RequestManager.addRequest(u),u.onload=function(){if(e._nameSpace.doc.downloadCount-=1,e._webgl.internalDownloadCount-=1,200==u.status){if(e._webgl){var s=1==a._vf.compressed?x3dom.Utils.gunzip(u.response):u.response,r=a,d=0,l=r._vf.coordType;e._webgl.coordType=x3dom.Utils.getVertexAttribType(l,i);var f=x3dom.Utils.getArrayBufferView(l,s);if(h)e._webgl.makeSeparateTris.pushBuffer("coord",f);else{i.bindAttribLocation(t.program,0,"position");var c=i.createBuffer();if(i.bindBuffer(i.ARRAY_BUFFER,c),i.bufferData(i.ARRAY_BUFFER,f,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,null),r._mesh._numCoords=f.length/r._mesh._numPosComponents,0==r._vf.index.length)for(d=0;d&lt;r._vf.vertexCount.length;d++)e._webgl.primType[d]==i.TRIANGLE_STRIP?r._mesh._numFaces+=r._vf.vertexCount[d]-2:r._mesh._numFaces+=r._vf.vertexCount[d]/3;if("Float32"==l&amp;&amp;(e._vf.bboxSize.x&lt;0||e._vf.bboxSize.y&lt;0||e._vf.bboxSize.z&lt;0)){var m=new x3dom.fields.SFVec3f(f[0],f[1],f[2]),_=new x3dom.fields.SFVec3f(f[0],f[1],f[2]);for(d=3;d&lt;f.length;d+=3)m.x&gt;f[d+0]&amp;&amp;(m.x=f[d+0]),m.y&gt;f[d+1]&amp;&amp;(m.y=f[d+1]),m.z&gt;f[d+2]&amp;&amp;(m.z=f[d+2]),_.x&lt;f[d+0]&amp;&amp;(_.x=f[d+0]),_.y&lt;f[d+1]&amp;&amp;(_.y=f[d+1]),_.z&lt;f[d+2]&amp;&amp;(_.z=f[d+2]);e._vf.bboxCenter.setValues(m.add(_).multiply(.5)),e._vf.bboxSize.setValues(_.subtract(m))}f=null,0==e._webgl.internalDownloadCount&amp;&amp;(e._nameSpace.doc.needRender=!0),n.checkError(i);var p=(new Date).getTime()-o;x3dom.debug.logInfo("XHR1/ coord load time: "+p+" ms"),e._webgl.buffers[1]=c}}}else x3dom.debug.logError("XHR1/ coord load failed with status: "+u.status)}}if(!a._hasStrideOffset&amp;&amp;a._vf.normal.length&gt;0){var f=new XMLHttpRequest;f.open("GET",e._nameSpace.getURL(a._vf.normal),!0),f.responseType="arraybuffer",e._nameSpace.doc.downloadCount+=1,x3dom.RequestManager.addRequest(f),f.onload=function(){if(e._nameSpace.doc.downloadCount-=1,e._webgl.internalDownloadCount-=1,200==f.status){if(e._webgl){var t=1==a._vf.compressed?x3dom.Utils.gunzip(f.response):f.response,s=a._vf.normalType;e._webgl.normalType=x3dom.Utils.getVertexAttribType(s,i);var r=x3dom.Utils.getArrayBufferView(s,t);if(h)e._webgl.makeSeparateTris.pushBuffer("normal",r);else{var d=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,d),i.bufferData(i.ARRAY_BUFFER,r,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,null),r=null,0==e._webgl.internalDownloadCount&amp;&amp;(e._nameSpace.doc.needRender=!0),n.checkError(i);var l=(new Date).getTime()-o;x3dom.debug.logInfo("XHR2/ normal load time: "+l+" ms"),e._webgl.buffers[2]=d}}}else x3dom.debug.logError("XHR2/ normal load failed with status: "+f.status)}}if(!a._hasStrideOffset&amp;&amp;a._vf.texCoord.length&gt;0){var c=new XMLHttpRequest;c.open("GET",e._nameSpace.getURL(a._vf.texCoord),!0),c.responseType="arraybuffer",e._nameSpace.doc.downloadCount+=1,x3dom.RequestManager.addRequest(c),c.onload=function(){var t,s;if(e._nameSpace.doc.downloadCount-=1,e._webgl.internalDownloadCount-=1,200==c.status){if(e._webgl){var r=1==a._vf.compressed?x3dom.Utils.gunzip(c.response):c.response,d=a._vf.texCoordType;e._webgl.texCoordType=x3dom.Utils.getVertexAttribType(d,i);var l=x3dom.Utils.getArrayBufferView(d,r);if(h)e._webgl.makeSeparateTris.pushBuffer("texCoord",l);else{if(a._vf.idsPerVertex){var u=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,u);var f=x3dom.Utils.getArrayBufferView("Float32",l.length/2);for(t=0,s=0;t&lt;l.length;t+=2,s++)f[s]=65536*l[t+1]+l[t];i.bufferData(i.ARRAY_BUFFER,f,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,null),e._webgl.buffers[5]=u}else{var m=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,m),i.bufferData(i.ARRAY_BUFFER,l,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,null),e._webgl.buffers[3]=m}l=null,0==e._webgl.internalDownloadCount&amp;&amp;(e._nameSpace.doc.needRender=!0),n.checkError(i);var _=(new Date).getTime()-o;x3dom.debug.logInfo("XHR3/ texCoord load time: "+_+" ms")}}}else x3dom.debug.logError("XHR3/ texcoord load failed with status: "+c.status)}}if(!a._hasStrideOffset&amp;&amp;a._vf.color.length&gt;0){var m=new XMLHttpRequest;m.open("GET",e._nameSpace.getURL(a._vf.color),!0),m.responseType="arraybuffer",e._nameSpace.doc.downloadCount+=1,x3dom.RequestManager.addRequest(m),m.onload=function(){if(e._nameSpace.doc.downloadCount-=1,e._webgl.internalDownloadCount-=1,200==m.status){if(e._webgl){var t=1==a._vf.compressed?x3dom.Utils.gunzip(m.response):m.response,s=a._vf.colorType;e._webgl.colorType=x3dom.Utils.getVertexAttribType(s,i);var r=x3dom.Utils.getArrayBufferView(s,t);if(h)e._webgl.makeSeparateTris.pushBuffer("color",r);else{var d=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,d),i.bufferData(i.ARRAY_BUFFER,r,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,null),r=null,0==e._webgl.internalDownloadCount&amp;&amp;(e._nameSpace.doc.needRender=!0),n.checkError(i);var l=(new Date).getTime()-o;x3dom.debug.logInfo("XHR4/ color load time: "+l+" ms"),e._webgl.buffers[4]=d}}}else x3dom.debug.logError("XHR4/ color load failed with status: "+m.status)}}}},x3dom.BinaryContainerLoader.setupPopGeo=function(e,t,i,s,r){if(!this.outOfMemory){var o=e._cf.geometry.node;if(o.hasIndex()){e._webgl.popGeometry=1,e._webgl.buffers[0]=i.createBuffer(),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e._webgl.buffers[0]),i.bufferData(i.ELEMENT_ARRAY_BUFFER,2*o.getTotalNumberOfIndices(),i.STATIC_DRAW),e._webgl.buffers[5]=i.createBuffer();var n=new Float32Array(o._vf.vertexBufferSize);!function(){for(var e=0;e&lt;n.length;++e)n[e]=e}(),i.bindBuffer(i.ARRAY_BUFFER,e._webgl.buffers[5]),i.bufferData(i.ARRAY_BUFFER,n,i.STATIC_DRAW)}else e._webgl.popGeometry=-1;e._webgl.buffers[1]=i.createBuffer(),i.bindBuffer(i.ARRAY_BUFFER,e._webgl.buffers[1]),i.bufferData(i.ARRAY_BUFFER,o._vf.attributeStride*o._vf.vertexBufferSize,i.STATIC_DRAW);var a=o._vf.coordType;e._webgl.coordType=x3dom.Utils.getVertexAttribType(a,i),e._coordStrideOffset[0]=o.getAttributeStride(),e._coordStrideOffset[1]=o.getPositionOffset(),i.vertexAttribPointer(t.position,e._cf.geometry.node._mesh._numPosComponents,e._webgl.coordType,!1,e._coordStrideOffset[0],e._coordStrideOffset[1]),i.enableVertexAttribArray(t.position),o.hasNormal()&amp;&amp;(a=o._vf.normalType,e._webgl.normalType=x3dom.Utils.getVertexAttribType(a,i),e._normalStrideOffset[0]=o.getAttributeStride(),e._normalStrideOffset[1]=o.getNormalOffset(),e._webgl.buffers[2]=e._webgl.buffers[1],i.vertexAttribPointer(t.normal,e._cf.geometry.node._mesh._numNormComponents,e._webgl.normalType,!1,e._normalStrideOffset[0],e._normalStrideOffset[1]),i.enableVertexAttribArray(t.normal)),o.hasTexCoord()&amp;&amp;(a=o._vf.texCoordType,e._webgl.texCoordType=x3dom.Utils.getVertexAttribType(a,i),e._webgl.buffers[3]=e._webgl.buffers[1],e._texCoordStrideOffset[0]=o.getAttributeStride(),e._texCoordStrideOffset[1]=o.getTexCoordOffset(),i.vertexAttribPointer(t.texcoord,e._cf.geometry.node._mesh._numTexComponents,e._webgl.texCoordType,!1,e._texCoordStrideOffset[0],e._texCoordStrideOffset[1]),i.enableVertexAttribArray(t.texcoord)),o.hasColor()&amp;&amp;(a=o._vf.colorType,e._webgl.colorType=x3dom.Utils.getVertexAttribType(a,i),e._webgl.buffers[4]=e._webgl.buffers[1],e._colorStrideOffset[0]=o.getAttributeStride(),e._colorStrideOffset[1]=o.getColorOffset(),i.vertexAttribPointer(t.color,e._cf.geometry.node._mesh._numColComponents,e._webgl.colorType,!1,e._colorStrideOffset[0],e._colorStrideOffset[1]),i.enableVertexAttribArray(t.color)),e._webgl.currentNumIndices=0,e._webgl.currentNumVertices=0,e._webgl.numVerticesAtLevel=[],e._webgl.levelsAvailable=0,this.checkError(i),e._webgl.levelLoaded=[],function(){for(var t=0;t&lt;o.getNumLevels();++t)e._webgl.levelLoaded.push(!1)}();var h=function(t,s){if(e._webgl.levelLoaded[s]=!0,e._webgl.numVerticesAtLevel[s]=0,t){var r=0,n=!1;if(o.hasIndex()&amp;&amp;(r=2*o.getNumIndicesByLevel(s))&gt;0){n=!0;var a=new Uint8Array(t,0,r);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e._webgl.buffers[0]),function(){for(var e=0,t=0;t&lt;s;++t)e+=o.getNumIndicesByLevel(t);i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,2*e,a)}()}var h=t.byteLength-r;if(h&gt;0){n=!0;var d=new Uint8Array(t,r,h);i.bindBuffer(i.ARRAY_BUFFER,e._webgl.buffers[1]),o.hasIndex()?i.bufferSubData(i.ARRAY_BUFFER,o.getVertexDataBufferOffset(s)*o.getAttributeStride(),d):i.bufferSubData(i.ARRAY_BUFFER,e._webgl.currentNumVertices*o.getAttributeStride(),d),e._webgl.numVerticesAtLevel[s]=h/o.getAttributeStride(),e._webgl.currentNumVertices+=e._webgl.numVerticesAtLevel[s]}!function(){for(var t=0,i=e._webgl.levelsAvailable;i&lt;o.getNumLevels()&amp;&amp;!1!==e._webgl.levelLoaded[i];++i)t+=o.getNumIndicesByLevel(i),++e._webgl.levelsAvailable;e._webgl.currentNumIndices=t}(),o._mesh._numCoords=e._webgl.currentNumVertices,o._mesh._numFaces=(o.hasIndex()?e._webgl.currentNumIndices:e._webgl.currentNumVertices)/3,o.adaptVertexCount(o.hasIndex()?3*o._mesh._numFaces:o._mesh._numCoords),n&amp;&amp;(e._nameSpace.doc.needRender=!0)}},d=o.getDataURLs(),l=[],u=[];e._webgl.downloadStartTimer=(new Date).getTime();for(var f=0;f&lt;d.length;++f)e._nameSpace.doc.downloadCount+=1,function(t){l.push((function(i){return e._nameSpace.doc.downloadCount-=1,h(i,t)}))}(f),u.push(f);x3dom.DownloadManager.get(d,l,u)}},x3dom.BinaryContainerLoader.setupImgGeo=function(e,t,i,s,r){if(!this.outOfMemory){var o=e._cf.geometry.node;o.getIndexTexture()?e._webgl.imageGeometry=1:e._webgl.imageGeometry=-1,o.unsetGeoDirty(),null==r.IG_PositionBuffer&amp;&amp;(r.IG_PositionBuffer=i.createBuffer()),e._webgl.buffers[1]=r.IG_PositionBuffer,i.bindBuffer(i.ARRAY_BUFFER,r.IG_PositionBuffer);var n=new Float32Array(e._webgl.positions[0]);i.bufferData(i.ARRAY_BUFFER,n,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,r.IG_PositionBuffer),i.vertexAttribPointer(t.position,o._mesh._numPosComponents,e._webgl.coordType,!1,e._coordStrideOffset[0],e._coordStrideOffset[1]),i.enableVertexAttribArray(t.position),n=null,this.checkError(i)}},x3dom.DrawableCollection=function(e){this.collection=[],this.viewMatrix=e.viewMatrix,this.projMatrix=e.projMatrix,this.sceneMatrix=e.sceneMatrix,this.viewarea=e.viewArea;var t=this.viewarea._scene,i=t.getEnvironment(),s=t.getViewpoint();this.near=s.getNear(),this.pixelHeightAtDistOne=s.getImgPlaneHeightAtDistOne()/this.viewarea._height,this.context=e.context,this.gl=e.gl,this.viewFrustum=this.viewarea.getViewfrustum(this.sceneMatrix),this.worldVol=new x3dom.fields.BoxVolume,this.frustumCulling=e.frustumCulling&amp;&amp;null!=this.viewFrustum,this.smallFeatureThreshold=e.smallFeatureThreshold,this.sortOpaque=this.smallFeatureThreshold&gt;0&amp;&amp;i._lowPriorityThreshold&lt;1,this.sortTrans=e.sortTrans,this.prioLevels=10,this.maxTreshold=100,this.sortBySortKey=!1,this.sortByPriority=!1,this.numberOfNodes=0,this.length=0},x3dom.DrawableCollection.prototype.cull=function(e,t,i,s){var r=t.boundedNode;if(!r||!r._vf.render)return-1;var o,n=r.getVolume();if(this.frustumCulling&amp;&amp;t.needCulling){if(i&amp;&amp;!t.worldVolume.isValid()?(t.worldVolume.transformFrom(e,n),o=t.worldVolume):s&lt;63&amp;&amp;(this.worldVol.transformFrom(e,n),o=this.worldVol),s&lt;63&amp;&amp;(s=this.viewFrustum.intersect(o,s)),-1==s)return-1}else s=63;if(t.coverage=-1,this.smallFeatureThreshold&gt;0||r.forceUpdateCoverage()){var a=this.viewMatrix.mult(e);t.center=a.multMatrixPnt(n.getCenter());var h=a.multMatrixVec(n.getRadialVec()).length(),d=Math.max(-t.center.z-h,this.near)*this.pixelHeightAtDistOne;if(t.coverage=2*h/d,this.smallFeatureThreshold&gt;0&amp;&amp;t.coverage&lt;this.smallFeatureThreshold&amp;&amp;t.needCulling)return-1}return this.numberOfNodes++,s},x3dom.DrawableCollection.prototype.addShape=function(e,t,i){var s={};s.shape=e,s.transform=t,s.localTransform=i.localMatrix,s.localVolume=i.volume,s.worldVolume=x3dom.fields.BoxVolume.copy(i.worldVolume),s.priority=Math.max(0,i.coverage),s.shaderID=e.getShaderProperties(this.viewarea).id;var r=e._cf.appearance.node;if(s.sortType=r?r._vf.sortType.toLowerCase():"opaque",s.sortKey=r?r._vf.sortKey:0,"transparent"==s.sortType)if(this.smallFeatureThreshold&gt;0)s.zPos=i.center.z;else{var o=t.multMatrixPnt(e.getCenter());o=this.viewMatrix.multMatrixPnt(o),s.zPos=o.z}this.sortBySortKey||0==s.sortKey||(this.sortBySortKey=!0),void 0===this.collection[s.sortType]&amp;&amp;(this.collection[s.sortType]=[]),this.collection[s.sortType].push(s),this.length++,this.context&amp;&amp;this.gl&amp;&amp;this.context.setupShape(this.gl,s,this.viewarea)},x3dom.DrawableCollection.prototype.addDrawable=function(e){e.shaderID=e.shape.getShaderProperties(this.viewarea).id;var t=e.shape._cf.appearance.node;if(e.sortType=t?t._vf.sortType.toLowerCase():"opaque",e.sortKey=t?t._vf.sortKey:0,"transparent"==e.sortType){var i=e.transform.multMatrixPnt(e.shape.getCenter());i=this.viewMatrix.multMatrixPnt(i),e.zPos=i.z}this.sortBySortKey||0==e.sortKey||(this.sortBySortKey=!0),void 0===this.collection[e.sortType]&amp;&amp;(this.collection[e.sortType]=[]),this.collection[e.sortType].push(e),this.length++,this.context&amp;&amp;this.gl&amp;&amp;this.context.setupShape(this.gl,e,this.viewarea)},x3dom.DrawableCollection.prototype.calculatePriority=function(e){var t=Math.max(0,e.coverage),i=this.prioLevels-1;return t=Math.min(Math.round(t/(this.maxTreshold/i)),i)},x3dom.DrawableCollection.prototype.concat=function(){var e=void 0!==this.collection.opaque?this.collection.opaque:[],t=void 0!==this.collection.transparent?this.collection.transparent:[];this.collection=e.concat(t)},x3dom.DrawableCollection.prototype.get=function(e){return this.collection[e]},x3dom.DrawableCollection.prototype.sort=function(){var e=[],t=[],i=this;void 0!==this.collection.opaque&amp;&amp;(this.sortOpaque&amp;&amp;this.collection.opaque.sort((function(e,t){return e.sortKey!=t.sortKey&amp;&amp;i.sortBySortKey?e.sortKey-t.sortKey:t.priority-e.priority})),e=this.collection.opaque),void 0!==this.collection.transparent&amp;&amp;(this.sortTrans&amp;&amp;this.collection.transparent.sort((function(e,t){return e.sortKey!=t.sortKey&amp;&amp;i.sortBySortKey?e.sortKey-t.sortKey:e.priority!=t.priority&amp;&amp;i.sortByPriority?t.priority-e.priority:e.zPos-t.zPos})),t=this.collection.transparent),this.collection=e.concat(t)},x3dom.DrawableCollection.prototype.forEach=function(e,t){var i,s,r,o;for(t=void 0!==t?Math.min(t,this.prioLevels):this.prioLevels,i=0;i&lt;this.collection.opaque.length;++i)if(void 0!==this.collection.opaque[i])for(s=this.collection.opaque[i].length;s&gt;0;--s)if(void 0!==this.collection.opaque[i][s])for(r in this.collection.opaque[i][s])for(o=0;o&lt;this.collection.opaque[i][s][r].length;++o)e(this.collection.opaque[i][s][r][o]);for(i=0;i&lt;this.collection.transparent.length;++i)if(void 0!==this.collection.transparent[i])for(s=this.collection.transparent[i].length;s&gt;0;--s)if(void 0!==this.collection.transparent[i][s])for(var n in this.collection.transparent[i][s])for(this.collection.transparent[i][s][n].sort((function(e,t){return e.zPos-t.zPos})),o=0;o&lt;this.collection.transparent[i][s][n].length;++o)e(this.collection.transparent[i][s][n][o])},x3dom.Moveable=function(e,t,i,s,r){this._x3domRoot=e,this._runtime=e.runtime,this._callback=i,this._gridSize=s||0,this._moveable=t,this._drag=!1,this._w=0,this._h=0,this._uPlane=null,this._vPlane=null,this._pPlane=null,this._isect=null,this._translationOffset=null,this._rotationOffset=null,this._scaleOffset=null,this._lastX=0,this._lastY=0,this._buttonState=0,this._mode=r&amp;&amp;r.length?r.toLowerCase():"translation",this._firstRay=null,this._matrixTrafo=null,this._navType="examine",this.attachHandlers()},x3dom.Moveable.prototype.setGridSize=function(e){this._gridSize=e},x3dom.Moveable.prototype.setMode=function(e){this._mode=e.toLowerCase()},x3dom.Moveable.prototype.attachHandlers=function(){this._moveable._iMove=this,this._x3domRoot._iMove||(this._x3domRoot._iMove=[]),this._x3domRoot._iMove.push(this),this._moveable.addEventListener("mousedown",this.start,!1),this._moveable.addEventListener("mouseover",this.over,!1),this._moveable.addEventListener("mouseout",this.out,!1),1==this._x3domRoot._iMove.length&amp;&amp;(this._x3domRoot.addEventListener("mouseup",this.stop,!1),this._x3domRoot.addEventListener("mouseout",this.stop,!1),this._x3domRoot.addEventListener("mousemove",this.move,!0),this._runtime.canvas.disableTouch||(this._x3domRoot.addEventListener("MozTouchDown",this.touchStartHandlerMoz,!1),this._x3domRoot.addEventListener("MozTouchMove",this.touchMoveHandlerMoz,!0),this._x3domRoot.addEventListener("MozTouchUp",this.touchEndHandlerMoz,!1),this._x3domRoot.addEventListener("touchstart",this.touchStartHandler,!1),this._x3domRoot.addEventListener("touchmove",this.touchMoveHandler,!0),this._x3domRoot.addEventListener("touchend",this.touchEndHandler,!1)))},x3dom.Moveable.prototype.detachHandlers=function(){var e=this._x3domRoot._iMove;if(e)for(var t=0,i=e.length;t&lt;i;t++)if(e[t]==this){e.splice(t,1);break}this._moveable.removeEventListener("mousedown",this.start,!1),this._moveable.removeEventListener("mouseover",this.over,!1),this._moveable.removeEventListener("mouseout",this.out,!1),0==e.length&amp;&amp;(this._x3domRoot.removeEventListener("mouseup",this.stop,!1),this._x3domRoot.removeEventListener("mouseout",this.stop,!1),this._x3domRoot.removeEventListener("mousemove",this.move,!0),this._runtime.canvas.disableTouch||(this._x3domRoot.removeEventListener("MozTouchDown",this.touchStartHandlerMoz,!1),this._x3domRoot.removeEventListener("MozTouchMove",this.touchMoveHandlerMoz,!0),this._x3domRoot.removeEventListener("MozTouchUp",this.touchEndHandlerMoz,!1),this._x3domRoot.removeEventListener("touchstart",this.touchStartHandler,!1),this._x3domRoot.removeEventListener("touchmove",this.touchMoveHandler,!0),this._x3domRoot.removeEventListener("touchend",this.touchEndHandler,!1))),this._moveable._iMove&amp;&amp;delete this._moveable._iMove},x3dom.Moveable.prototype.calcViewPlane=function(e){this._w=this._runtime.getWidth(),this._h=this._runtime.getHeight();var t=this._runtime.getViewingRay(0,this._h-1),i=t.pos.add(t.dir),s=(t=this._runtime.getViewingRay(this._w-1,this._h-1)).pos.add(t.dir),r=(t=this._runtime.getViewingRay(0,0)).pos.add(t.dir);this._uPlane=s.subtract(i).normalize(),this._vPlane=r.subtract(i).normalize(),0===arguments.length?this._pPlane=i:this._pPlane=x3dom.fields.SFVec3f.copy(e)},x3dom.Moveable.prototype.det=function(e){return e[0][0]*e[1][1]*e[2][2]+e[0][1]*e[1][2]*e[2][0]+e[0][2]*e[2][1]*e[1][0]-e[2][0]*e[1][1]*e[0][2]-e[0][0]*e[2][1]*e[1][2]-e[1][0]*e[0][1]*e[2][2]},x3dom.Moveable.prototype.translateXY=function(e){for(var t=null,i=[],s=[],r=0;r&lt;3;r++)i[r]=[],s[r]=[],i[r][0]=this._uPlane.at(r),s[r][0]=i[r][0],i[r][1]=this._vPlane.at(r),s[r][1]=i[r][1],i[r][2]=e.pos.subtract(this._pPlane).at(r),s[r][2]=-e.dir.at(r);var o=this.det(s);if(0!==o){var n=this.det(i)/o;t=e.pos.addScaled(e.dir,n)}return t&amp;&amp;(this._isect&amp;&amp;(t=t.subtract(this._isect)),t=t.add(this._translationOffset)),t},x3dom.Moveable.prototype.translateZ=function(e,t){var i=this._runtime.getSceneBBox(),s=(t&lt;this._lastY?1:-1)*i.max.subtract(i.min).length()/100;return this._translationOffset=this._translationOffset.addScaled(e.dir,s),this._translationOffset},x3dom.Moveable.prototype.rotate=function(e,t){var i=2*Math.PI,s=(t-this._lastY)*i/this._w,r=(e-this._lastX)*i/this._h,o=x3dom.fields.Quaternion.axisAngle(this._uPlane,s),n=o.toMatrix();this._rotationOffset=n.mult(this._rotationOffset),n=(o=x3dom.fields.Quaternion.axisAngle(this._vPlane,r)).toMatrix(),this._rotationOffset=n.mult(this._rotationOffset);var a=this._rotationOffset.mult(x3dom.fields.SFMatrix4f.scale(this._scaleOffset)),h=new x3dom.fields.Quaternion(0,0,1,0);return h.setValue(a),h},x3dom.Moveable.prototype.over=function(e){this._iMove._runtime.getCanvas().style.cursor="crosshair"},x3dom.Moveable.prototype.out=function(e){var t=this._iMove;t._drag||(t._runtime.getCanvas().style.cursor="pointer")},x3dom.Moveable.prototype.start=function(e){var t=this._iMove;switch(t._mode){case"translation":t._buttonState=4==e.button?1:3&amp;e.button;break;case"rotation":t._buttonState=4;break;case"all":default:t._buttonState=e.button}if(!t._drag&amp;&amp;t._buttonState){t._lastX=e.layerX,t._lastY=e.layerY,t._drag=!0,t._navType=t._runtime.navigationType(),t._runtime.noNav(),t._isect=new x3dom.fields.SFVec3f(e.worldX,e.worldY,e.worldZ),t.calcViewPlane(t._isect),t._firstRay=t._runtime.getViewingRay(e.layerX,e.layerY);var i=t._moveable.getAttribute("translation");if(t._matrixTrafo=null,i){t._translationOffset=x3dom.fields.SFVec3f.parse(i);var s=t._moveable.getAttribute("rotation");s=s?x3dom.fields.Quaternion.parseAxisAngle(s):new x3dom.fields.Quaternion(0,0,1,0),t._rotationOffset=s.toMatrix();var r=t._moveable.getAttribute("scale");t._scaleOffset=r?x3dom.fields.SFVec3f.parse(r):new x3dom.fields.SFVec3f(1,1,1)}else if(i=t._moveable.getAttribute("matrix")){t._matrixTrafo=x3dom.fields.SFMatrix4f.parse(i).transpose();var o=new x3dom.fields.SFVec3f(0,0,0),n=new x3dom.fields.SFVec3f(1,1,1),a=new x3dom.fields.Quaternion(0,0,1,0),h=new x3dom.fields.Quaternion(0,0,1,0);t._matrixTrafo.getTransform(o,a,n,h),t._translationOffset=o,t._rotationOffset=a.toMatrix(),t._scaleOffset=n}else t._translationOffset=new x3dom.fields.SFVec3f(0,0,0),t._rotationOffset=new x3dom.fields.SFMatrix4f,t._scaleOffset=new x3dom.fields.SFVec3f(1,1,1);t._runtime.getCanvas().style.cursor="crosshair"}},x3dom.Moveable.prototype.move=function(e){for(var t=0,i=this._iMove.length;t&lt;i;t++){var s=this._iMove[t];if(s._drag){var r=s._runtime.mousePosition(e),o=s._runtime.getViewingRay(r[0],r[1]),n=null;if(n=2==s._buttonState?s.translateZ(s._firstRay,r[1]):1==s._buttonState?s.translateXY(o):s.rotate(r[0],r[1])){if(s._gridSize&gt;0&amp;&amp;4!=s._buttonState){var a=s._gridSize*Math.round(n.x/s._gridSize),h=s._gridSize*Math.round(n.y/s._gridSize),d=s._gridSize*Math.round(n.z/s._gridSize);n=new x3dom.fields.SFVec3f(a,h,d)}s._matrixTrafo?(4==s._buttonState?s._matrixTrafo.setRotate(n):s._matrixTrafo.setTranslate(n),s._moveable.setAttribute("matrix",s._matrixTrafo.toGL().toString())):4==s._buttonState?s._moveable.setAttribute("rotation",n.toAxisAngle().toString()):s._moveable.setAttribute("translation",n.toString()),s._callback&amp;&amp;s._callback(s._moveable,n)}s._lastX=r[0],s._lastY=r[1]}}},x3dom.Moveable.prototype.stop=function(e){for(var t=0,i=this._iMove.length;t&lt;i;t++){var s=this._iMove[t];if(s._drag)s._lastX=e.layerX,s._lastY=e.layerY,s._isect=null,s._drag=!1,s._runtime.canvas.doc._scene.getNavigationInfo().setType(s._navType),s._runtime.getCanvas().style.cursor="pointer"}},x3dom.Moveable.prototype.touchStartHandler=function(e){e.preventDefault()},x3dom.Moveable.prototype.touchStartHandlerMoz=function(e){e.preventDefault()},x3dom.Moveable.prototype.touchMoveHandler=function(e){e.preventDefault()},x3dom.Moveable.prototype.touchMoveHandlerMoz=function(e){e.preventDefault()},x3dom.Moveable.prototype.touchEndHandler=function(e){if(this._iMove.length){var t=this._iMove[0];t.stop.apply(t._x3domRoot,[e])}e.preventDefault()},x3dom.Moveable.prototype.touchEndHandlerMoz=function(e){if(this._iMove.length){var t=this._iMove[0];t.stop.apply(t._x3domRoot,[e])}e.preventDefault()},function(){"use strict";function e(e){throw e}var t=void 0,i=!0,s=this;function r(e,i){var r,o=e.split("."),n=s;!(o[0]in n)&amp;&amp;n.execScript&amp;&amp;n.execScript("var "+o[0]);for(;o.length&amp;&amp;(r=o.shift());)o.length||i===t?n=n[r]?n[r]:n[r]={}:n[r]=i}var o="undefined"!==typeof Uint8Array&amp;&amp;"undefined"!==typeof Uint16Array&amp;&amp;"undefined"!==typeof Uint32Array&amp;&amp;"undefined"!==typeof DataView;function n(t,i){this.index="number"===typeof i?i:0,this.m=0,this.buffer=t instanceof(o?Uint8Array:Array)?t:new(o?Uint8Array:Array)(32768),2*this.buffer.length&lt;=this.index&amp;&amp;e(Error("invalid index")),this.buffer.length&lt;=this.index&amp;&amp;this.f()}n.prototype.f=function(){var e,t=this.buffer,i=t.length,s=new(o?Uint8Array:Array)(i&lt;&lt;1);if(o)s.set(t);else for(e=0;e&lt;i;++e)s[e]=t[e];return this.buffer=s},n.prototype.d=function(e,t,i){var s,r=this.buffer,o=this.index,n=this.m,a=r[o];if(i&amp;&amp;1&lt;t&amp;&amp;(e=8&lt;t?(f[255&amp;e]&lt;&lt;24|f[e&gt;&gt;&gt;8&amp;255]&lt;&lt;16|f[e&gt;&gt;&gt;16&amp;255]&lt;&lt;8|f[e&gt;&gt;&gt;24&amp;255])&gt;&gt;32-t:f[e]&gt;&gt;8-t),8&gt;t+n)a=a&lt;&lt;t|e,n+=t;else for(s=0;s&lt;t;++s)a=a&lt;&lt;1|e&gt;&gt;t-s-1&amp;1,8===++n&amp;&amp;(n=0,r[o++]=f[a],a=0,o===r.length&amp;&amp;(r=this.f()));r[o]=a,this.buffer=r,this.m=n,this.index=o},n.prototype.finish=function(){var e,t=this.buffer,i=this.index;return 0&lt;this.m&amp;&amp;(t[i]&lt;&lt;=8-this.m,t[i]=f[t[i]],i++),o?e=t.subarray(0,i):(t.length=i,e=t),e};var a,h=new(o?Uint8Array:Array)(256);for(a=0;256&gt;a;++a){for(var d=u=a,l=7,u=u&gt;&gt;&gt;1;u;u&gt;&gt;&gt;=1)d&lt;&lt;=1,d|=1&amp;u,--l;h[a]=(d&lt;&lt;l&amp;255)&gt;&gt;&gt;0}var f=h;function c(e,t,i){var s,r="number"===typeof t?t:t=0,o="number"===typeof i?i:e.length;for(s=-1,r=7&amp;o;r--;++t)s=s&gt;&gt;&gt;8^_[255&amp;(s^e[t])];for(r=o&gt;&gt;3;r--;t+=8)s=(s=(s=(s=(s=(s=(s=(s=s&gt;&gt;&gt;8^_[255&amp;(s^e[t])])&gt;&gt;&gt;8^_[255&amp;(s^e[t+1])])&gt;&gt;&gt;8^_[255&amp;(s^e[t+2])])&gt;&gt;&gt;8^_[255&amp;(s^e[t+3])])&gt;&gt;&gt;8^_[255&amp;(s^e[t+4])])&gt;&gt;&gt;8^_[255&amp;(s^e[t+5])])&gt;&gt;&gt;8^_[255&amp;(s^e[t+6])])&gt;&gt;&gt;8^_[255&amp;(s^e[t+7])];return(4294967295^s)&gt;&gt;&gt;0}var m=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],_=o?new Uint32Array(m):m;function p(){}function x(e){this.buffer=new(o?Uint16Array:Array)(2*e),this.length=0}function g(e){var t,i,s,r,n,a,h,d,l,u,f=e.length,c=0,m=Number.POSITIVE_INFINITY;for(d=0;d&lt;f;++d)e[d]&gt;c&amp;&amp;(c=e[d]),e[d]&lt;m&amp;&amp;(m=e[d]);for(t=1&lt;&lt;c,i=new(o?Uint32Array:Array)(t),s=1,r=0,n=2;s&lt;=c;){for(d=0;d&lt;f;++d)if(e[d]===s){for(a=0,h=r,l=0;l&lt;s;++l)a=a&lt;&lt;1|1&amp;h,h&gt;&gt;=1;for(u=s&lt;&lt;16|d,l=a;l&lt;t;l+=n)i[l]=u;++r}++s,r&lt;&lt;=1,n&lt;&lt;=1}return[i,c,m]}function v(e,t){this.k=b,this.I=0,this.input=o&amp;&amp;e instanceof Array?new Uint8Array(e):e,this.b=0,t&amp;&amp;(t.lazy&amp;&amp;(this.I=t.lazy),"number"===typeof t.compressionType&amp;&amp;(this.k=t.compressionType),t.outputBuffer&amp;&amp;(this.a=o&amp;&amp;t.outputBuffer instanceof Array?new Uint8Array(t.outputBuffer):t.outputBuffer),"number"===typeof t.outputIndex&amp;&amp;(this.b=t.outputIndex)),this.a||(this.a=new(o?Uint8Array:Array)(32768))}p.prototype.getName=function(){return this.name},p.prototype.getData=function(){return this.data},p.prototype.Y=function(){return this.Z},r("Zlib.GunzipMember",p),r("Zlib.GunzipMember.prototype.getName",p.prototype.getName),r("Zlib.GunzipMember.prototype.getData",p.prototype.getData),r("Zlib.GunzipMember.prototype.getMtime",p.prototype.Y),x.prototype.getParent=function(e){return 2*((e-2)/4|0)},x.prototype.push=function(e,t){var i,s,r,o=this.buffer;for(i=this.length,o[this.length++]=t,o[this.length++]=e;0&lt;i&amp;&amp;(s=this.getParent(i),o[i]&gt;o[s]);)r=o[i],o[i]=o[s],o[s]=r,r=o[i+1],o[i+1]=o[s+1],o[s+1]=r,i=s;return this.length},x.prototype.pop=function(){var e,t,i,s,r,o=this.buffer;for(t=o[0],e=o[1],this.length-=2,o[0]=o[this.length],o[1]=o[this.length+1],r=0;!((s=2*r+2)&gt;=this.length)&amp;&amp;(s+2&lt;this.length&amp;&amp;o[s+2]&gt;o[s]&amp;&amp;(s+=2),o[s]&gt;o[r]);)i=o[r],o[r]=o[s],o[s]=i,i=o[r+1],o[r+1]=o[s+1],o[s+1]=i,r=s;return{index:e,value:t,length:this.length}};var y,b=2,T={NONE:0,v:1,o:b,ba:3},S=[];for(y=0;288&gt;y;y++)switch(!0){case 143&gt;=y:S.push([y+48,8]);break;case 255&gt;=y:S.push([y-144+400,9]);break;case 279&gt;=y:S.push([y-256+0,7]);break;case 287&gt;=y:S.push([y-280+192,8]);break;default:e("invalid literal: "+y)}function w(e,t){this.length=e,this.Q=t}v.prototype.g=function(){var s,r,a,h,d=this.input;switch(this.k){case 0:for(a=0,h=d.length;a&lt;h;){var l,u,f,c=r=o?d.subarray(a,a+65535):d.slice(a,a+65535),m=(a+=r.length)===h,_=t,p=t,x=this.a,g=this.b;if(o){for(x=new Uint8Array(this.a.buffer);x.length&lt;=g+c.length+5;)x=new Uint8Array(x.length&lt;&lt;1);x.set(this.a)}if(l=m?1:0,x[g++]=0|l,f=65536+~(u=c.length)&amp;65535,x[g++]=255&amp;u,x[g++]=u&gt;&gt;&gt;8&amp;255,x[g++]=255&amp;f,x[g++]=f&gt;&gt;&gt;8&amp;255,o)x.set(c,g),g+=c.length,x=x.subarray(0,g);else{for(_=0,p=c.length;_&lt;p;++_)x[g++]=c[_];x.length=g}this.b=g,this.a=x}break;case 1:var v=new n(o?new Uint8Array(this.a.buffer):this.a,this.b);v.d(1,1,i),v.d(1,2,i);var y,T,w,M=F(this,d);for(y=0,T=M.length;y&lt;T;y++)if(w=M[y],n.prototype.d.apply(v,S[w]),256&lt;w)v.d(M[++y],M[++y],i),v.d(M[++y],5),v.d(M[++y],M[++y],i);else if(256===w)break;this.a=v.finish(),this.b=this.a.length;break;case b:var E,C,I,N,P,D,V,L,O,k,B,U,z,G,X,j=new n(o?new Uint8Array(this.a.buffer):this.a,this.b),H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],W=Array(19);for(E=b,j.d(1,1,i),j.d(E,2,i),C=F(this,d),V=R(D=A(this.W,15)),O=R(L=A(this.V,7)),I=286;257&lt;I&amp;&amp;0===D[I-1];I--);for(N=30;1&lt;N&amp;&amp;0===L[N-1];N--);var q,Y,Z,Q,K,$,J=I,ee=N,te=new(o?Uint32Array:Array)(J+ee),ie=new(o?Uint32Array:Array)(316),se=new(o?Uint8Array:Array)(19);for(q=Y=0;q&lt;J;q++)te[Y++]=D[q];for(q=0;q&lt;ee;q++)te[Y++]=L[q];if(!o)for(q=0,Q=se.length;q&lt;Q;++q)se[q]=0;for(q=K=0,Q=te.length;q&lt;Q;q+=Y){for(Y=1;q+Y&lt;Q&amp;&amp;te[q+Y]===te[q];++Y);if(Z=Y,0===te[q])if(3&gt;Z)for(;0&lt;Z--;)ie[K++]=0,se[0]++;else for(;0&lt;Z;)($=138&gt;Z?Z:138)&gt;Z-3&amp;&amp;$&lt;Z&amp;&amp;($=Z-3),10&gt;=$?(ie[K++]=17,ie[K++]=$-3,se[17]++):(ie[K++]=18,ie[K++]=$-11,se[18]++),Z-=$;else if(ie[K++]=te[q],se[te[q]]++,3&gt;--Z)for(;0&lt;Z--;)ie[K++]=te[q],se[te[q]]++;else for(;0&lt;Z;)($=6&gt;Z?Z:6)&gt;Z-3&amp;&amp;$&lt;Z&amp;&amp;($=Z-3),ie[K++]=16,ie[K++]=$-3,se[16]++,Z-=$}for(s=o?ie.subarray(0,K):ie.slice(0,K),k=A(se,7),G=0;19&gt;G;G++)W[G]=k[H[G]];for(P=19;4&lt;P&amp;&amp;0===W[P-1];P--);for(B=R(k),j.d(I-257,5,i),j.d(N-1,5,i),j.d(P-4,4,i),G=0;G&lt;P;G++)j.d(W[G],3,i);for(G=0,X=s.length;G&lt;X;G++)if(U=s[G],j.d(B[U],k[U],i),16&lt;=U){switch(G++,U){case 16:z=2;break;case 17:z=3;break;case 18:z=7;break;default:e("invalid code: "+U)}j.d(s[G],z,i)}var re,oe,ne,ae,he,de,le,ue,fe=[V,D],ce=[O,L];for(he=fe[0],de=fe[1],le=ce[0],ue=ce[1],re=0,oe=C.length;re&lt;oe;++re)if(ne=C[re],j.d(he[ne],de[ne],i),256&lt;ne)j.d(C[++re],C[++re],i),ae=C[++re],j.d(le[ae],ue[ae],i),j.d(C[++re],C[++re],i);else if(256===ne)break;this.a=j.finish(),this.b=this.a.length;break;default:e("invalid compression type")}return this.a};var M=function(){function t(t){switch(!0){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case 12&gt;=t:return[265,t-11,1];case 14&gt;=t:return[266,t-13,1];case 16&gt;=t:return[267,t-15,1];case 18&gt;=t:return[268,t-17,1];case 22&gt;=t:return[269,t-19,2];case 26&gt;=t:return[270,t-23,2];case 30&gt;=t:return[271,t-27,2];case 34&gt;=t:return[272,t-31,2];case 42&gt;=t:return[273,t-35,3];case 50&gt;=t:return[274,t-43,3];case 58&gt;=t:return[275,t-51,3];case 66&gt;=t:return[276,t-59,3];case 82&gt;=t:return[277,t-67,4];case 98&gt;=t:return[278,t-83,4];case 114&gt;=t:return[279,t-99,4];case 130&gt;=t:return[280,t-115,4];case 162&gt;=t:return[281,t-131,5];case 194&gt;=t:return[282,t-163,5];case 226&gt;=t:return[283,t-195,5];case 257&gt;=t:return[284,t-227,5];case 258===t:return[285,t-258,0];default:e("invalid length: "+t)}}var i,s,r=[];for(i=3;258&gt;=i;i++)s=t(i),r[i]=s[2]&lt;&lt;24|s[1]&lt;&lt;16|s[0];return r}(),E=o?new Uint32Array(M):M;function F(i,s){function r(t,i){var s,r,o,n,a=t.Q,h=[],d=0;switch(s=E[t.length],h[d++]=65535&amp;s,h[d++]=s&gt;&gt;16&amp;255,h[d++]=s&gt;&gt;24,!0){case 1===a:r=[0,a-1,0];break;case 2===a:r=[1,a-2,0];break;case 3===a:r=[2,a-3,0];break;case 4===a:r=[3,a-4,0];break;case 6&gt;=a:r=[4,a-5,1];break;case 8&gt;=a:r=[5,a-7,1];break;case 12&gt;=a:r=[6,a-9,2];break;case 16&gt;=a:r=[7,a-13,2];break;case 24&gt;=a:r=[8,a-17,3];break;case 32&gt;=a:r=[9,a-25,3];break;case 48&gt;=a:r=[10,a-33,4];break;case 64&gt;=a:r=[11,a-49,4];break;case 96&gt;=a:r=[12,a-65,5];break;case 128&gt;=a:r=[13,a-97,5];break;case 192&gt;=a:r=[14,a-129,6];break;case 256&gt;=a:r=[15,a-193,6];break;case 384&gt;=a:r=[16,a-257,7];break;case 512&gt;=a:r=[17,a-385,7];break;case 768&gt;=a:r=[18,a-513,8];break;case 1024&gt;=a:r=[19,a-769,8];break;case 1536&gt;=a:r=[20,a-1025,9];break;case 2048&gt;=a:r=[21,a-1537,9];break;case 3072&gt;=a:r=[22,a-2049,10];break;case 4096&gt;=a:r=[23,a-3073,10];break;case 6144&gt;=a:r=[24,a-4097,11];break;case 8192&gt;=a:r=[25,a-6145,11];break;case 12288&gt;=a:r=[26,a-8193,12];break;case 16384&gt;=a:r=[27,a-12289,12];break;case 24576&gt;=a:r=[28,a-16385,13];break;case 32768&gt;=a:r=[29,a-24577,13];break;default:e("invalid distance")}for(s=r,h[d++]=s[0],h[d++]=s[1],h[d++]=s[2],o=0,n=h.length;o&lt;n;++o)p[x++]=h[o];v[h[0]]++,y[h[3]]++,g=t.length+i-1,c=null}var n,a,h,d,l,u,f,c,m,_={},p=o?new Uint16Array(2*s.length):[],x=0,g=0,v=new(o?Uint32Array:Array)(286),y=new(o?Uint32Array:Array)(30),b=i.I;if(!o){for(h=0;285&gt;=h;)v[h++]=0;for(h=0;29&gt;=h;)y[h++]=0}for(v[256]=1,n=0,a=s.length;n&lt;a;++n){for(h=l=0,d=3;h&lt;d&amp;&amp;n+h!==a;++h)l=l&lt;&lt;8|s[n+h];if(_[l]===t&amp;&amp;(_[l]=[]),u=_[l],!(0&lt;g--)){for(;0&lt;u.length&amp;&amp;32768&lt;n-u[0];)u.shift();if(n+3&gt;=a){for(c&amp;&amp;r(c,-1),h=0,d=a-n;h&lt;d;++h)m=s[n+h],p[x++]=m,++v[m];break}0&lt;u.length?(f=C(s,n,u),c?c.length&lt;f.length?(m=s[n-1],p[x++]=m,++v[m],r(f,0)):r(c,-1):f.length&lt;b?c=f:r(f,0)):c?r(c,-1):(m=s[n],p[x++]=m,++v[m])}u.push(n)}return p[x++]=256,v[256]++,i.W=v,i.V=y,o?p.subarray(0,x):p}function C(e,t,i){var s,r,o,n,a,h,d=0,l=e.length;n=0,h=i.length;e:for(;n&lt;h;n++){if(s=i[h-n-1],o=3,3&lt;d){for(a=d;3&lt;a;a--)if(e[s+a-1]!==e[t+a-1])continue e;o=d}for(;258&gt;o&amp;&amp;t+o&lt;l&amp;&amp;e[s+o]===e[t+o];)++o;if(o&gt;d&amp;&amp;(r=s,d=o),258===o)break}return new w(d,t-r)}function A(e,t){var i,s,r,n,a,h=e.length,d=new x(572),l=new(o?Uint8Array:Array)(h);if(!o)for(n=0;n&lt;h;n++)l[n]=0;for(n=0;n&lt;h;++n)0&lt;e[n]&amp;&amp;d.push(n,e[n]);if(i=Array(d.length/2),s=new(o?Uint32Array:Array)(d.length/2),1===i.length)return l[d.pop().index]=1,l;for(n=0,a=d.length/2;n&lt;a;++n)i[n]=d.pop(),s[n]=i[n].value;for(r=function(e,t,i){function s(e){var i=m[e][_[e]];i===t?(s(e+1),s(e+1)):--f[i],++_[e]}var r,n,a,h,d,l=new(o?Uint16Array:Array)(i),u=new(o?Uint8Array:Array)(i),f=new(o?Uint8Array:Array)(t),c=Array(i),m=Array(i),_=Array(i),p=(1&lt;&lt;i)-t,x=1&lt;&lt;i-1;for(l[i-1]=t,n=0;n&lt;i;++n)p&lt;x?u[n]=0:(u[n]=1,p-=x),p&lt;&lt;=1,l[i-2-n]=(l[i-1-n]/2|0)+t;for(l[0]=u[0],c[0]=Array(l[0]),m[0]=Array(l[0]),n=1;n&lt;i;++n)l[n]&gt;2*l[n-1]+u[n]&amp;&amp;(l[n]=2*l[n-1]+u[n]),c[n]=Array(l[n]),m[n]=Array(l[n]);for(r=0;r&lt;t;++r)f[r]=i;for(a=0;a&lt;l[i-1];++a)c[i-1][a]=e[a],m[i-1][a]=a;for(r=0;r&lt;i;++r)_[r]=0;for(1===u[i-1]&amp;&amp;(--f[0],++_[i-1]),n=i-2;0&lt;=n;--n){for(h=r=0,d=_[n+1],a=0;a&lt;l[n];a++)(h=c[n+1][d]+c[n+1][d+1])&gt;e[r]?(c[n][a]=h,m[n][a]=t,d+=2):(c[n][a]=e[r],m[n][a]=r,++r);_[n]=0,1===u[n]&amp;&amp;s(n)}return f}(s,s.length,t),n=0,a=i.length;n&lt;a;++n)l[i[n].index]=r[n];return l}function R(e){var t,i,s,r,n=new(o?Uint16Array:Array)(e.length),a=[],h=[],d=0;for(t=0,i=e.length;t&lt;i;t++)a[e[t]]=1+(0|a[e[t]]);for(t=1,i=16;t&lt;=i;t++)h[t]=d,d+=0|a[t],d&lt;&lt;=1;for(t=0,i=e.length;t&lt;i;t++)for(d=h[e[t]],h[e[t]]+=1,s=n[t]=0,r=e[t];s&lt;r;s++)n[t]=n[t]&lt;&lt;1|1&amp;d,d&gt;&gt;&gt;=1;return n}function I(e,t){this.input=e,this.b=this.c=0,this.i={},t&amp;&amp;(t.flags&amp;&amp;(this.i=t.flags),"string"===typeof t.filename&amp;&amp;(this.filename=t.filename),"string"===typeof t.comment&amp;&amp;(this.A=t.comment),t.deflateOptions&amp;&amp;(this.l=t.deflateOptions)),this.l||(this.l={})}I.prototype.g=function(){var e,i,s,r,n,a,h,d,l=new(o?Uint8Array:Array)(32768),u=0,f=this.input,m=this.c,_=this.filename,p=this.A;if(l[u++]=31,l[u++]=139,l[u++]=8,e=0,this.i.fname&amp;&amp;(e|=D),this.i.fcomment&amp;&amp;(e|=V),this.i.fhcrc&amp;&amp;(e|=P),l[u++]=e,i=(Date.now?Date.now():+new Date)/1e3|0,l[u++]=255&amp;i,l[u++]=i&gt;&gt;&gt;8&amp;255,l[u++]=i&gt;&gt;&gt;16&amp;255,l[u++]=i&gt;&gt;&gt;24&amp;255,l[u++]=0,l[u++]=N,this.i.fname!==t){for(h=0,d=_.length;h&lt;d;++h)255&lt;(a=_.charCodeAt(h))&amp;&amp;(l[u++]=a&gt;&gt;&gt;8&amp;255),l[u++]=255&amp;a;l[u++]=0}if(this.i.comment){for(h=0,d=p.length;h&lt;d;++h)255&lt;(a=p.charCodeAt(h))&amp;&amp;(l[u++]=a&gt;&gt;&gt;8&amp;255),l[u++]=255&amp;a;l[u++]=0}return this.i.fhcrc&amp;&amp;(s=65535&amp;c(l,0,u),l[u++]=255&amp;s,l[u++]=s&gt;&gt;&gt;8&amp;255),this.l.outputBuffer=l,this.l.outputIndex=u,l=(n=new v(f,this.l)).g(),u=n.b,o&amp;&amp;(u+8&gt;l.buffer.byteLength?(this.a=new Uint8Array(u+8),this.a.set(new Uint8Array(l.buffer)),l=this.a):l=new Uint8Array(l.buffer)),r=c(f,t,t),l[u++]=255&amp;r,l[u++]=r&gt;&gt;&gt;8&amp;255,l[u++]=r&gt;&gt;&gt;16&amp;255,l[u++]=r&gt;&gt;&gt;24&amp;255,d=f.length,l[u++]=255&amp;d,l[u++]=d&gt;&gt;&gt;8&amp;255,l[u++]=d&gt;&gt;&gt;16&amp;255,l[u++]=d&gt;&gt;&gt;24&amp;255,this.c=m,o&amp;&amp;u&lt;l.length&amp;&amp;(this.a=l=l.subarray(0,u)),l};var N=255,P=2,D=8,V=16;function L(t,i){switch(this.p=[],this.q=32768,this.e=this.j=this.c=this.u=0,this.input=o?new Uint8Array(t):t,this.w=!1,this.r=k,this.M=!1,!i&amp;&amp;(i={})||(i.index&amp;&amp;(this.c=i.index),i.bufferSize&amp;&amp;(this.q=i.bufferSize),i.bufferType&amp;&amp;(this.r=i.bufferType),i.resize&amp;&amp;(this.M=i.resize)),this.r){case O:this.b=32768,this.a=new(o?Uint8Array:Array)(32768+this.q+258);break;case k:this.b=0,this.a=new(o?Uint8Array:Array)(this.q),this.f=this.U,this.B=this.R,this.s=this.T;break;default:e(Error("invalid inflate mode"))}}r("Zlib.Gzip",I),r("Zlib.Gzip.prototype.compress",I.prototype.g);var O=0,k=1,B={O:O,N:k};L.prototype.h=function(){for(;!this.w;){var s=re(this,3);switch(1&amp;s&amp;&amp;(this.w=i),s&gt;&gt;&gt;=1){case 0:var r=this.input,n=this.c,a=this.a,h=this.b,d=r.length,l=t,u=a.length,f=t;switch(this.e=this.j=0,n+1&gt;=d&amp;&amp;e(Error("invalid uncompressed block header: LEN")),l=r[n++]|r[n++]&lt;&lt;8,n+1&gt;=d&amp;&amp;e(Error("invalid uncompressed block header: NLEN")),l===~(r[n++]|r[n++]&lt;&lt;8)&amp;&amp;e(Error("invalid uncompressed block header: length verify")),n+l&gt;r.length&amp;&amp;e(Error("input buffer is broken")),this.r){case O:for(;h+l&gt;a.length;){if(l-=f=u-h,o)a.set(r.subarray(n,n+f),h),h+=f,n+=f;else for(;f--;)a[h++]=r[n++];this.b=h,a=this.f(),h=this.b}break;case k:for(;h+l&gt;a.length;)a=this.f({F:2});break;default:e(Error("invalid inflate mode"))}if(o)a.set(r.subarray(n,n+l),h),h+=l,n+=l;else for(;l--;)a[h++]=r[n++];this.c=n,this.b=h,this.a=a;break;case 1:this.s(te,se);break;case 2:ne(this);break;default:e(Error("unknown BTYPE: "+s))}}return this.B()};var U,z,G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X=o?new Uint16Array(G):G,j=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],H=o?new Uint16Array(j):j,W=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],q=o?new Uint8Array(W):W,Y=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],Z=o?new Uint16Array(Y):Y,Q=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],K=o?new Uint8Array(Q):Q,$=new(o?Uint8Array:Array)(288);for(U=0,z=$.length;U&lt;z;++U)$[U]=143&gt;=U?8:255&gt;=U?9:279&gt;=U?7:8;var J,ee,te=g($),ie=new(o?Uint8Array:Array)(30);for(J=0,ee=ie.length;J&lt;ee;++J)ie[J]=5;var se=g(ie);function re(t,i){for(var s,r=t.j,o=t.e,n=t.input,a=t.c,h=n.length;o&lt;i;)a&gt;=h&amp;&amp;e(Error("input buffer is broken")),r|=n[a++]&lt;&lt;o,o+=8;return s=r&amp;(1&lt;&lt;i)-1,t.j=r&gt;&gt;&gt;i,t.e=o-i,t.c=a,s}function oe(e,t){for(var i,s,r=e.j,o=e.e,n=e.input,a=e.c,h=n.length,d=t[0],l=t[1];o&lt;l&amp;&amp;!(a&gt;=h);)r|=n[a++]&lt;&lt;o,o+=8;return s=(i=d[r&amp;(1&lt;&lt;l)-1])&gt;&gt;&gt;16,e.j=r&gt;&gt;s,e.e=o-s,e.c=a,65535&amp;i}function ne(e){function t(e,t,i){var s,r,o,n=this.J;for(o=0;o&lt;e;)switch(s=oe(this,t)){case 16:for(r=3+re(this,2);r--;)i[o++]=n;break;case 17:for(r=3+re(this,3);r--;)i[o++]=0;n=0;break;case 18:for(r=11+re(this,7);r--;)i[o++]=0;n=0;break;default:n=i[o++]=s}return this.J=n,i}var i,s,r,n,a=re(e,5)+257,h=re(e,5)+1,d=re(e,4)+4,l=new(o?Uint8Array:Array)(X.length);for(n=0;n&lt;d;++n)l[X[n]]=re(e,3);if(!o)for(n=d,d=l.length;n&lt;d;++n)l[X[n]]=0;i=g(l),s=new(o?Uint8Array:Array)(a),r=new(o?Uint8Array:Array)(h),e.J=0,e.s(g(t.call(e,a,i,s)),g(t.call(e,h,i,r)))}function ae(e){this.input=e,this.c=0,this.t=[],this.D=!1}function he(e){if("string"===typeof e){var t,i,s=e.split("");for(t=0,i=s.length;t&lt;i;t++)s[t]=(255&amp;s[t].charCodeAt(0))&gt;&gt;&gt;0;e=s}for(var r,o=1,n=0,a=e.length,h=0;0&lt;a;){a-=r=1024&lt;a?1024:a;do{n+=o+=e[h++]}while(--r);o%=65521,n%=65521}return(n&lt;&lt;16|o)&gt;&gt;&gt;0}function de(t,i){var s,r;switch(this.input=t,this.c=0,!i&amp;&amp;(i={})||(i.index&amp;&amp;(this.c=i.index),i.verify&amp;&amp;(this.$=i.verify)),s=t[this.c++],r=t[this.c++],15&amp;s){case le:this.method=le;break;default:e(Error("unsupported compression method"))}0!==((s&lt;&lt;8)+r)%31&amp;&amp;e(Error("invalid fcheck flag:"+((s&lt;&lt;8)+r)%31)),32&amp;r&amp;&amp;e(Error("fdict flag is not supported")),this.L=new L(t,{index:this.c,bufferSize:i.bufferSize,bufferType:i.bufferType,resize:i.resize})}L.prototype.s=function(e,t){var i=this.a,s=this.b;this.C=e;for(var r,o,n,a,h=i.length-258;256!==(r=oe(this,e));)if(256&gt;r)s&gt;=h&amp;&amp;(this.b=s,i=this.f(),s=this.b),i[s++]=r;else for(a=H[o=r-257],0&lt;q[o]&amp;&amp;(a+=re(this,q[o])),r=oe(this,t),n=Z[r],0&lt;K[r]&amp;&amp;(n+=re(this,K[r])),s&gt;=h&amp;&amp;(this.b=s,i=this.f(),s=this.b);a--;)i[s]=i[s++-n];for(;8&lt;=this.e;)this.e-=8,this.c--;this.b=s},L.prototype.T=function(e,t){var i=this.a,s=this.b;this.C=e;for(var r,o,n,a,h=i.length;256!==(r=oe(this,e));)if(256&gt;r)s&gt;=h&amp;&amp;(h=(i=this.f()).length),i[s++]=r;else for(a=H[o=r-257],0&lt;q[o]&amp;&amp;(a+=re(this,q[o])),r=oe(this,t),n=Z[r],0&lt;K[r]&amp;&amp;(n+=re(this,K[r])),s+a&gt;h&amp;&amp;(h=(i=this.f()).length);a--;)i[s]=i[s++-n];for(;8&lt;=this.e;)this.e-=8,this.c--;this.b=s},L.prototype.f=function(){var e,t,i=new(o?Uint8Array:Array)(this.b-32768),s=this.b-32768,r=this.a;if(o)i.set(r.subarray(32768,i.length));else for(e=0,t=i.length;e&lt;t;++e)i[e]=r[e+32768];if(this.p.push(i),this.u+=i.length,o)r.set(r.subarray(s,s+32768));else for(e=0;32768&gt;e;++e)r[e]=r[s+e];return this.b=32768,r},L.prototype.U=function(e){var t,i,s,r=this.input.length/this.c+1|0,n=this.input,a=this.a;return e&amp;&amp;("number"===typeof e.F&amp;&amp;(r=e.F),"number"===typeof e.P&amp;&amp;(r+=e.P)),2&gt;r?i=(s=(n.length-this.c)/this.C[2]/2*258|0)&lt;a.length?a.length+s:a.length&lt;&lt;1:i=a.length*r,o?(t=new Uint8Array(i)).set(a):t=a,this.a=t},L.prototype.B=function(){var e,t,i,s,r,n=0,a=this.a,h=this.p,d=new(o?Uint8Array:Array)(this.u+(this.b-32768));if(0===h.length)return o?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(t=0,i=h.length;t&lt;i;++t)for(s=0,r=(e=h[t]).length;s&lt;r;++s)d[n++]=e[s];for(t=32768,i=this.b;t&lt;i;++t)d[n++]=a[t];return this.p=[],this.buffer=d},L.prototype.R=function(){var e,t=this.b;return o?this.M?(e=new Uint8Array(t)).set(this.a.subarray(0,t)):e=this.a.subarray(0,t):(this.a.length&gt;t&amp;&amp;(this.a.length=t),e=this.a),this.buffer=e},ae.prototype.X=function(){return this.D||this.h(),this.t.slice()},ae.prototype.h=function(){for(var s=this.input.length;this.c&lt;s;){var r,n,a=new p,h=t,d=t,l=t,u=t,f=t,m=t,_=t,x=this.input,g=this.c;switch(a.G=x[g++],a.H=x[g++],(31!==a.G||139!==a.H)&amp;&amp;e(Error("invalid file signature:"+a.G+","+a.H)),a.z=x[g++],a.z){case 8:break;default:e(Error("unknown compression method: "+a.z))}if(a.n=x[g++],n=x[g++]|x[g++]&lt;&lt;8|x[g++]&lt;&lt;16|x[g++]&lt;&lt;24,a.Z=new Date(1e3*n),a.fa=x[g++],a.ea=x[g++],0&lt;(4&amp;a.n)&amp;&amp;(a.aa=x[g++]|x[g++]&lt;&lt;8,g+=a.aa),0&lt;(a.n&amp;D)){for(m=[],f=0;0&lt;(u=x[g++]);)m[f++]=String.fromCharCode(u);a.name=m.join("")}if(0&lt;(a.n&amp;V)){for(m=[],f=0;0&lt;(u=x[g++]);)m[f++]=String.fromCharCode(u);a.A=m.join("")}0&lt;(a.n&amp;P)&amp;&amp;(a.S=65535&amp;c(x,0,g),a.S!==(x[g++]|x[g++]&lt;&lt;8)&amp;&amp;e(Error("invalid header crc16"))),h=x[x.length-4]|x[x.length-3]&lt;&lt;8|x[x.length-2]&lt;&lt;16|x[x.length-1]&lt;&lt;24,x.length-g-4-4&lt;512*h&amp;&amp;(l=h),d=new L(x,{index:g,bufferSize:l}),a.data=r=d.h(),g=d.c,a.ca=_=(x[g++]|x[g++]&lt;&lt;8|x[g++]&lt;&lt;16|x[g++]&lt;&lt;24)&gt;&gt;&gt;0,c(r,t,t)!==_&amp;&amp;e(Error("invalid CRC-32 checksum: 0x"+c(r,t,t).toString(16)+" / 0x"+_.toString(16))),a.da=h=(x[g++]|x[g++]&lt;&lt;8|x[g++]&lt;&lt;16|x[g++]&lt;&lt;24)&gt;&gt;&gt;0,(4294967295&amp;r.length)!==h&amp;&amp;e(Error("invalid input size: "+(4294967295&amp;r.length)+" / "+h)),this.t.push(a),this.c=g}this.D=i;var v,y,b,T=this.t,S=0,w=0;for(v=0,y=T.length;v&lt;y;++v)w+=T[v].data.length;if(o)for(b=new Uint8Array(w),v=0;v&lt;y;++v)b.set(T[v].data,S),S+=T[v].data.length;else{for(b=[],v=0;v&lt;y;++v)b[v]=T[v].data;b=Array.prototype.concat.apply([],b)}return b},r("Zlib.Gunzip",ae),r("Zlib.Gunzip.prototype.decompress",ae.prototype.h),r("Zlib.Gunzip.prototype.getMembers",ae.prototype.X),de.prototype.h=function(){var t,i=this.input;return t=this.L.h(),this.c=this.L.c,this.$&amp;&amp;((i[this.c++]&lt;&lt;24|i[this.c++]&lt;&lt;16|i[this.c++]&lt;&lt;8|i[this.c++])&gt;&gt;&gt;0!==he(t)&amp;&amp;e(Error("invalid adler-32 checksum"))),t};var le=8;function ue(e,t){this.input=e,this.a=new(o?Uint8Array:Array)(32768),this.k=fe.o;var i,s={};for(i in!t&amp;&amp;(t={})||"number"!==typeof t.compressionType||(this.k=t.compressionType),t)s[i]=t[i];s.outputBuffer=this.a,this.K=new v(this.input,s)}var fe=T;function ce(e,t){var i,s,o,n;if(Object.keys)i=Object.keys(t);else for(s in i=[],o=0,t)i[o++]=s;for(o=0,n=i.length;o&lt;n;++o)r(e+"."+(s=i[o]),t[s])}ue.prototype.g=function(){var t,i,s,r,n,a,h,d=0;switch(h=this.a,t=le){case le:i=Math.LOG2E*Math.log(32768)-8;break;default:e(Error("invalid compression method"))}switch(s=i&lt;&lt;4|t,h[d++]=s,t){case le:switch(this.k){case fe.NONE:n=0;break;case fe.v:n=1;break;case fe.o:n=2;break;default:e(Error("unsupported compression type"))}break;default:e(Error("invalid compression method"))}return r=n&lt;&lt;6|0,h[d++]=r|31-(256*s+r)%31,a=he(this.input),this.K.b=d,d=(h=this.K.g()).length,o&amp;&amp;((h=new Uint8Array(h.buffer)).length&lt;=d+4&amp;&amp;(this.a=new Uint8Array(h.length+4),this.a.set(h),h=this.a),h=h.subarray(0,d+4)),h[d++]=a&gt;&gt;24&amp;255,h[d++]=a&gt;&gt;16&amp;255,h[d++]=a&gt;&gt;8&amp;255,h[d++]=255&amp;a,h},r("Zlib.Inflate",de),r("Zlib.Inflate.prototype.decompress",de.prototype.h),ce("Zlib.Inflate.BufferType",{ADAPTIVE:B.N,BLOCK:B.O}),r("Zlib.Deflate",ue),r("Zlib.Deflate.compress",(function(e,t){return new ue(e,t).g()})),r("Zlib.Deflate.prototype.compress",ue.prototype.g),ce("Zlib.Deflate.CompressionType",{NONE:fe.NONE,FIXED:fe.v,DYNAMIC:fe.o})}.call(this),null==x3dom.glTF&amp;&amp;(x3dom.glTF={}),x3dom.glTF.glTFLoader=function(e,t){this.meshOnly=t,this.header=this.readHeader(e),this.header.sceneLength&gt;0&amp;&amp;(this.scene=this.readScene(e,this.header),this.body=this.readBody(e,this.header)),this._mesh={}},x3dom.glTF.glTFLoader.prototype.getScene=function(e,t,i,s){this.reset(e,i),null==s&amp;&amp;(s=this.scene.scene);var r=this.scene.scenes[s];this.updateScene(e,t,i,r)},x3dom.glTF.glTFLoader.prototype.getMesh=function(e,t,i,s){var r;if(this.reset(e,i),null==s)r=Object.keys(this.scene.meshes)[0];else for(var o in this.scene.meshes)if(this.scene.meshes.hasOwnProperty(o)&amp;&amp;o==s){r=this.scene.meshes[o];break}this.updateMesh(e,t,i,r)},x3dom.glTF.glTFLoader.prototype.reset=function(e,t){this._mesh._numCoords=0,this._mesh._numFaces=0,e._webgl.externalGeometry=-1,null==this.loaded.bufferViews&amp;&amp;(this.loaded.bufferViews=this.loadBufferViews(e,t))},x3dom.glTF.glTFLoader.prototype.updateScene=function(e,t,i,s){for(var r=s.nodes,o=0;o&lt;r.length;++o){var n=r[o];this.traverseNode(e,t,i,this.scene.nodes[n])}},x3dom.glTF.glTFLoader.prototype.traverseNode=function(e,t,i,s){var r=s.children;if(null!=r)for(var o=0;o&lt;r.length;++o){var n=r[o];this.traverseNode(e,t,i,this.scene.nodes[n])}var a=s.meshes;if(null!=a&amp;&amp;a.length&gt;0)for(o=0;o&lt;a.length;++o){var h=a[o];null==this.loaded.meshes[h]&amp;&amp;(this.updateMesh(e,t,i,this.scene.meshes[h]),this.loaded.meshes[h]=1)}},x3dom.glTF.glTFLoader.prototype.updateMesh=function(e,t,i,s){for(var r=s.primitives,o=0;o&lt;r.length;++o)this.loadglTFMesh(e,t,i,r[o])},x3dom.glTF.glTFLoader.prototype.loadPrimitive=function(e,t,i,s){var r,o,n=this.loaded.meshCount,a=6*n;e._webgl.primType[n]=s.mode;var h=null!=s.indices&amp;&amp;""!=s.indices;if(1==h){var d=this.scene.accessors[s.indices];e._webgl.indexOffset[n]=d.byteOffset,e._webgl.drawCount[n]=d.count,e._webgl.buffers[0+a]=this.loaded.bufferViews[d.bufferView],this._mesh._numFaces+=d.count/3}var l=s.attributes;for(var u in l){var f=l[u],c=this.scene.accessors[f];switch(u){case"POSITION":r="coord",o="Pos",e._webgl.buffers[1+a]=this.loaded.bufferViews[c.bufferView],0==h&amp;&amp;(e._webgl.drawCount[n]=c.count,this._mesh._numFaces+=c.count/3),this._mesh._numCoords+=c.count;break;case"NORMAL":r="normal",o="Norm",e._webgl.buffers[2+a]=this.loaded.bufferViews[c.bufferView];break;case"TEXCOORD_0":r="texCoord",o="Tex",e._webgl.buffers[3+a]=this.loaded.bufferViews[c.bufferView];break;case"COLOR":r="color",o="Col",e._webgl.buffers[4+a]=this.loaded.bufferViews[c.bufferView]}null!=r&amp;&amp;(e["_"+r+"StrideOffset"][n]=[],e["_"+r+"StrideOffset"][n][0]=c.byteStride,e["_"+r+"StrideOffset"][n][1]=c.byteOffset,e._webgl[r+"Type"]=c.componentType,this._mesh["_num"+o+"Components"]=this.getNumComponentsForType(c.type))}this.loaded.meshCount+=1,e._dirty.shader=!0,e._nameSpace.doc.needRender=!0,x3dom.BinaryContainerLoader.checkError(i)},x3dom.glTF.glTFLoader.prototype.loadglTFMesh=function(e,t,i,s){"use strict";var r=new x3dom.glTF.glTFMesh;r.primitiveType=s.mode;var o=null!=s.indices&amp;&amp;""!=s.indices;if(1==o){var n=this.scene.accessors[s.indices];r.buffers[glTF_BUFFER_IDX.INDEX]={},r.buffers[glTF_BUFFER_IDX.INDEX].offset=n.byteOffset,r.buffers[glTF_BUFFER_IDX.INDEX].type=n.componentType,r.buffers[glTF_BUFFER_IDX.INDEX].idx=this.loaded.bufferViews[n.bufferView],r.drawCount=n.count,this._mesh._numFaces+=n.count/3}var a=s.attributes;for(var h in a){var d=a[h],l=this.scene.accessors[d],u=null;switch(h){case"POSITION":u=glTF_BUFFER_IDX.POSITION,0==o&amp;&amp;(r.drawCount=l.count,this._mesh._numFaces+=n.count/3),this._mesh.numCoords+=l.count;break;case"NORMAL":u=glTF_BUFFER_IDX.NORMAL;break;case"TEXCOORD_0":u=glTF_BUFFER_IDX.TEXCOORD;break;case"COLOR":u=glTF_BUFFER_IDX.COLOR}null!=u&amp;&amp;(r.buffers[u]={},r.buffers[u].idx=this.loaded.bufferViews[l.bufferView],r.buffers[u].offset=l.byteOffset,r.buffers[u].stride=l.byteStride,r.buffers[u].type=l.componentType,r.buffers[u].numComponents=this.getNumComponentsForType(l.type))}this.loaded.meshCount+=1,e._dirty.shader=!0,e._nameSpace.doc.needRender=!0,x3dom.BinaryContainerLoader.checkError(i),null==s.material||this.meshOnly||(r.material=this.loadMaterial(i,this.scene.materials[s.material])),null==e.meshes&amp;&amp;(e.meshes=[]),e.meshes.push(r)},x3dom.glTF.glTFLoader.prototype.loadBufferViews=function(e,t){var i={},s=this.scene.bufferViews;for(var r in s)if(s.hasOwnProperty(r)){var o=s[r];if(null!=o.target||o.target==t.ARRAY_BUFFER||o.target==t.ELEMENT_ARRAY_BUFFER){o.target==t.ELEMENT_ARRAY_BUFFER&amp;&amp;(e._webgl.externalGeometry=1);var n=new Uint8Array(this.body.buffer,this.header.bodyOffset+o.byteOffset,o.byteLength),a=t.createBuffer();t.bindBuffer(o.target,a),t.bufferData(o.target,n,t.STATIC_DRAW),i[r]=a}}return i},x3dom.glTF.glTFLoader.prototype.readHeader=function(e){var t={},i=new Uint8Array(e,0,4),s=new Uint32Array(e,4,1),r=new Uint32Array(e,8,1),o=new Uint32Array(e,12,1),n=new Uint32Array(e,16,1);return t.magic=new TextDecoder("ascii").decode(i),1==s[0]&amp;&amp;(t.version="Version 1"),t.length=r[0],t.sceneLength=o[0],0==n[0]&amp;&amp;(t.sceneFormat="JSON"),t.bodyOffset=t.sceneLength+20,t},x3dom.glTF.glTFLoader.prototype.readScene=function(e,t){var i=new Uint8Array(e,20,t.sceneLength);return JSON.parse(new TextDecoder("utf-8").decode(i))},x3dom.glTF.glTFLoader.prototype.readBody=function(e,t){var i=t.sceneLength+20;return new Uint8Array(e,i,t.length-i)},x3dom.glTF.glTFLoader.prototype.getNumComponentsForType=function(e){switch(e){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;default:return 0}},x3dom.glTF.glTFLoader.prototype.loadImage=function(e,t){if(null==this.loaded.images&amp;&amp;(this.loaded.images={}),null!=this.loaded.images[e])return this.loaded.images[e];var i=this.scene.images[e];if(null!=i.extensions&amp;&amp;null!=i.extensions.KHR_binary_glTF){var s=i.extensions.KHR_binary_glTF,r=this.scene.bufferViews[s.bufferView],o=new Uint8Array(this.body.buffer,this.header.bodyOffset+r.byteOffset,r.byteLength),n=new Blob([o],{type:s.mimeType}),a=window.URL.createObjectURL(n),h=new Image;return h.src=a,this.loaded.images[e]=h,h}return null},x3dom.glTF.glTFLoader.prototype.loadTexture=function(e,t){var i=t.format,s=t.internalFormat,r={},o=this.scene.samplers[t.sampler];if(null!=o)for(var n in o)o.hasOwnProperty(n)&amp;&amp;(r[n]=o[n]);var a=this.loadImage(t.source),h=t.target,d=t.type;return new x3dom.glTF.glTFTexture(e,i,s,r,h,d,a)},x3dom.glTF.glTFLoader.prototype.loadMaterial=function(e,t){if(null!=t.extensions&amp;&amp;null!=t.extensions.KHR_materials_common){t=t.extensions.KHR_materials_common;var i=new x3dom.glTF.glTFKHRMaterialCommons;for(var s in i.technique=glTF_KHR_MATERIAL_COMMON_TECHNIQUE[t.technique],i.doubleSided=t.doubleSided,t.values){if(t.values.hasOwnProperty(s))if("string"===typeof(a=t.values[s])){var r=this.scene.textures[a];i[s+"Tex"]=this.loadTexture(e,r)}else i[s]=a}return i}var o=this.scene.techniques[t.technique],n=this.loadShaderProgram(e,o.program);i=new x3dom.glTF.glTFMaterial(o);for(var s in i.program=n,t.values){var a;if(t.values.hasOwnProperty(s))if("string"===typeof(a=t.values[s])){r=this.scene.textures[a];i.textures[s]=this.loadTexture(e,r)}else i.values[s]=a}return i},x3dom.glTF.glTFLoader.prototype.loadShaderProgram=function(e,t){if(null==this.loaded.programs&amp;&amp;(this.loaded.programs={}),null!=this.loaded.programs[t])return this.loaded.programs[t];var i=this.scene.programs[t],s=this.scene.shaders[i.vertexShader],r=this._loadShaderSource(s),o=this.scene.shaders[i.fragmentShader],n=this._loadShaderSource(o),a=e.createProgram(),h=e.createShader(e.VERTEX_SHADER);e.shaderSource(h,r),e.compileShader(h),e.getShaderParameter(h,e.COMPILE_STATUS)||x3dom.debug.logError("[glTF binary] VertexShader "+e.getShaderInfoLog(h));var d=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(d,n),e.compileShader(d),e.getShaderParameter(d,e.COMPILE_STATUS)||x3dom.debug.logError("[glTF binary] FragmentShader "+e.getShaderInfoLog(d)),e.attachShader(a,h),e.attachShader(a,d),e.bindAttribLocation(a,0,"position"),e.linkProgram(a);a=x3dom.Utils.wrapProgram(e,a);return this.loaded.programs[t]=a,a},x3dom.glTF.glTFLoader.prototype._loadShaderSource=function(e){var t=this.scene.bufferViews[e.extensions.KHR_binary_glTF.bufferView],i=new Uint8Array(this.body.buffer,this.header.bodyOffset+t.byteOffset,t.byteLength);return new TextDecoder("ascii").decode(i)},null==x3dom.glTF&amp;&amp;(x3dom.glTF={}),glTF_BUFFER_IDX={INDEX:0,POSITION:1,NORMAL:2,TEXCOORD:3,COLOR:4},glTF_KHR_MATERIAL_COMMON_TECHNIQUE={BLINN:0,PHONG:1,LAMBERT:2,CONSTANT:3},x3dom.glTF.glTFMesh=function(){this.indexOffset=0,this.drawCount=0,this.numFaces=0,this.primitiveType=0,this.numCoords=0,this.buffers={},this.material=null},x3dom.glTF.glTFMesh.prototype.bindVertexAttribPointer=function(e,t){if(this.buffers[glTF_BUFFER_IDX.INDEX]&amp;&amp;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.buffers[glTF_BUFFER_IDX.INDEX].idx),null!=this.material&amp;&amp;null!=this.material.attributeMapping){var i=this.material.attributeMapping;this._bindVertexAttribPointer(e,t[i[glTF_BUFFER_IDX.POSITION]],this.buffers[glTF_BUFFER_IDX.POSITION]),this._bindVertexAttribPointer(e,t[i[glTF_BUFFER_IDX.NORMAL]],this.buffers[glTF_BUFFER_IDX.NORMAL]),this._bindVertexAttribPointer(e,t[i[glTF_BUFFER_IDX.TEXCOORD]],this.buffers[glTF_BUFFER_IDX.TEXCOORD]),this._bindVertexAttribPointer(e,t[i[glTF_BUFFER_IDX.COLOR]],this.buffers[glTF_BUFFER_IDX.COLOR])}else this._bindVertexAttribPointer(e,t.position,this.buffers[glTF_BUFFER_IDX.POSITION]),this._bindVertexAttribPointer(e,t.normal,this.buffers[glTF_BUFFER_IDX.NORMAL]),this._bindVertexAttribPointer(e,t.texcoord,this.buffers[glTF_BUFFER_IDX.TEXCOORD]),this._bindVertexAttribPointer(e,t.color,this.buffers[glTF_BUFFER_IDX.COLOR])},x3dom.glTF.glTFMesh.prototype.bindVertexAttribPointerPosition=function(e,t,i){if(this.buffers[glTF_BUFFER_IDX.INDEX]&amp;&amp;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.buffers[glTF_BUFFER_IDX.INDEX].idx),1==i&amp;&amp;null!=this.material&amp;&amp;null!=this.material.attributeMapping){var s=this.material.attributeMapping;this._bindVertexAttribPointer(e,t[s[glTF_BUFFER_IDX.POSITION]],this.buffers[glTF_BUFFER_IDX.POSITION])}else this._bindVertexAttribPointer(e,t.position,this.buffers[glTF_BUFFER_IDX.POSITION])},x3dom.glTF.glTFMesh.prototype._bindVertexAttribPointer=function(e,t,i){null!=t&amp;&amp;null!=i&amp;&amp;(e.bindBuffer(e.ARRAY_BUFFER,i.idx),e.vertexAttribPointer(t,i.numComponents,i.type,!1,i.stride,i.offset),e.enableVertexAttribArray(t))},x3dom.glTF.glTFMesh.prototype.render=function(e,t){(null==this.material||this.material.created())&amp;&amp;(null==t&amp;&amp;(t=this.primitiveType),this.buffers[glTF_BUFFER_IDX.INDEX]?e.drawElements(t,this.drawCount,this.buffers[glTF_BUFFER_IDX.INDEX].type,this.buffers[glTF_BUFFER_IDX.INDEX].offset):e.drawArrays(t,0,this.drawCount))},x3dom.glTF.glTFTexture=function(e,t,i,s,r,o,n){this.format=t,this.internalFormat=i,this.sampler=s,this.target=r,this.type=o,this.image=n,this.created=!1,this.create(e)},x3dom.glTF.glTFTexture.prototype.isPowerOfTwo=function(e){return!(0==e)&amp;&amp;!(e&amp;e-1)},x3dom.glTF.glTFTexture.prototype.create=function(e){0!=this.image.complete&amp;&amp;(this.glTexture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.glTexture),e.texImage2D(e.TEXTURE_2D,0,this.internalFormat,this.format,this.type,this.image),null!=this.sampler.magFilter&amp;&amp;e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,this.sampler.magFilter),null!=this.sampler.minFilter&amp;&amp;e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,this.sampler.minFilter),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),this.created=!0)},x3dom.glTF.glTFTexture.prototype.bind=function(e,t,i,s){this.created||this.create(e),e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.glTexture),e.uniform1i(e.getUniformLocation(i,s),t)},x3dom.glTF.glTFKHRMaterialCommons=function(){this.diffuse=[.3,.1,.1,1],this.diffuseTex=null,this.emission=[0,0,0,1],this.emissionTex=null,this.specular=[.8,.8,.8,1],this.specularTex=null,this.ambient=[0,0,0,1],this.shininess=2,this.transparency=0,this.globalAmbient=[0,0,0,1],this.lightVector=[1,0,0,1],this.doubleSided=!1,this.technique=glTF_KHR_MATERIAL_COMMON_TECHNIQUE.BLINN},x3dom.glTF.glTFKHRMaterialCommons.prototype.created=function(){return(null==this.diffuseTex||1==this.diffuseTex.created)&amp;&amp;((null==this.emissionTex||1==this.emissionTex.created)&amp;&amp;(null==this.specularTex||1==this.specularTex.created))},x3dom.glTF.glTFKHRMaterialCommons.prototype.setShader=function(e,t,i,s){s.EMPTY_SHADER=0,s.KHR_MATERIAL_COMMONS=1,null!=this.diffuseTex?s.USE_DIFFUSE_TEX=1:s.USE_DIFFUSE_TEX=0,null!=this.emissionTex?s.USE_SPECULAR_TEX=1:s.USE_SPECULAR_TEX=0,null!=this.specularTex?s.USE_EMISSION_TEX=1:s.USE_EMISSION_TEX=0,s.toIdentifier(),this.program=t.getShaderByProperties(e,i,s)},x3dom.glTF.glTFKHRMaterialCommons.prototype.bind=function(e,t){for(var i in this.program.bind(),t)t.hasOwnProperty(i)&amp;&amp;this.program.hasOwnProperty(i)&amp;&amp;(this.program[i]=t[i]);null!=this.diffuseTex?this.diffuseTex.bind(e,0,this.program.program,"diffuseTex"):this.program.diffuse=this.diffuse,null!=this.emissionTex?this.emissionTex.bind(e,0,this.program.program,"emissionTex"):this.program.emission=this.emission,null!=this.specularTex?this.specularTex.bind(e,0,this.program.program,"specularTex"):this.program.specular=this.specular,this.program.shininess=this.shininess,this.program.transparency=this.transparency,this.program.globalAmbient=this.globalAmbient,this.program.lightVector=this.lightVector,this.program.technique=this.technique},x3dom.glTF.glTFMaterial=function(e){for(var t in this.technique=e,this.values={},this.semanticMapping={},this.attributeMapping={},this.textures={},this.technique.uniforms){if(this.technique.uniforms.hasOwnProperty(t))if(null!=(i=this.technique.parameters[this.technique.uniforms[t]]).semantic)switch(i.semantic){case"MODELVIEW":this.semanticMapping.modelViewMatrix=t;break;case"MODELVIEWINVERSETRANSPOSE":this.semanticMapping.modelViewInverseTransposeMatrix=t;break;case"PROJECTION":this.semanticMapping.projectionMatrix=t;break;case"MODEL":this.semanticMapping.modelMatrix=t;break;case"MODELVIEWPROJECTION":this.semanticMapping.modelViewProjectionMatrix=t;break;case"VIEW":this.semanticMapping.viewMatrix=t;break;case"MODELVIEWINVERSE":this.semanticMapping.modelViewInverseMatrix=t}}for(var t in this.technique.attributes){var i;if(this.technique.attributes.hasOwnProperty(t))if(null!=(i=this.technique.parameters[this.technique.attributes[t]]).semantic)switch(i.semantic){case"POSITION":this.attributeMapping[glTF_BUFFER_IDX.POSITION]=t;break;case"NORMAL":this.attributeMapping[glTF_BUFFER_IDX.NORMAL]=t;break;case"TEXCOORD_0":this.attributeMapping[glTF_BUFFER_IDX.TEXCOORD]=t;break;case"COLOR":this.attributeMapping[glTF_BUFFER_IDX.COLOR]=t}}},x3dom.glTF.glTFMaterial.prototype.created=function(){for(var e in this.textures)if(this.textures.hasOwnProperty(e)&amp;&amp;1!=this.textures[e].created)return!1;return!0},x3dom.glTF.glTFMaterial.prototype.bind=function(e,t){for(var i in null!=this.program&amp;&amp;this.program.bind(),this.updateTransforms(t),this.technique.uniforms)if(this.technique.uniforms.hasOwnProperty(i)){var s=this.technique.uniforms[i];if(null!=this.textures[s])this.textures[s].bind(e,0,this.program.program,i);else null!=this.values[s]&amp;&amp;(this.program[i]=this.values[s])}},x3dom.glTF.glTFMaterial.prototype.updateTransforms=function(e){if(null!=this.program){if(this.program.bind(),null!=this.semanticMapping.modelViewMatrix&amp;&amp;(this.program[this.semanticMapping.modelViewMatrix]=e.modelViewMatrix),null!=this.semanticMapping.viewMatrix&amp;&amp;(this.program[this.semanticMapping.viewMatrix]=e.viewMatrix),null!=this.semanticMapping.modelViewInverseTransposeMatrix){var t=e.normalMatrix,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];this.program[this.semanticMapping.modelViewInverseTransposeMatrix]=i}null!=this.semanticMapping.modelViewInverseMatrix&amp;&amp;(this.program[this.semanticMapping.modelViewInverseMatrix]=e.modelViewMatrixInverse),null!=this.semanticMapping.modelViewProjectionMatrix&amp;&amp;(this.program[this.semanticMapping.modelViewProjectionMatrix]=e.modelViewProjectionMatrix),null!=this.semanticMapping.modelMatrix&amp;&amp;(this.program[this.semanticMapping.modelMatrix]=e.model),null!=this.semanticMapping.projectionMatrix&amp;&amp;(this.program[this.semanticMapping.projectionMatrix]=e.projectionMatrix)}},x3dom.X3DCanvas=function(e,t){var i=this;if(this._canvasIdx=t,this.x3dElem=e,this._current_dim=[0,0],this.fps_t0=(new Date).getTime(),this.lastTimeFPSWasTaken=0,this.framesSinceLastTime=0,this._totalTime=0,this._elapsedTime=0,this.doc=null,this.devicePixelRatio=window.devicePixelRatio||1,this.lastMousePos={x:0,y:0},x3dom.caps.DOMNodeInsertedEvent_perSubtree=!(-1!=navigator.userAgent.indexOf("MSIE")||-1!=navigator.userAgent.indexOf("Trident")),e.__setAttribute=e.setAttribute,e.setAttribute=function(e,t){switch(this.__setAttribute(e,t),t=parseInt(t)*i.devicePixelRatio,e){case"width":i.canvas.setAttribute("width",t),i.doc&amp;&amp;i.doc._viewarea&amp;&amp;(i.doc._viewarea._width=parseInt(i.canvas.getAttribute("width"),0),i.doc.needRender=!0);break;case"height":i.canvas.setAttribute("height",t),i.doc&amp;&amp;i.doc._viewarea&amp;&amp;(i.doc._viewarea._height=parseInt(i.canvas.getAttribute("height"),0),i.doc.needRender=!0)}},x3dom.caps.MOBILE=navigator.appVersion.indexOf("Mobile")&gt;-1,this.backend=this.x3dElem.getAttribute("backend"),this.backend=this.backend?this.backend.toLowerCase():"none",this.canvas=this._createHTMLCanvas(e),this.canvas.parent=this,this.gl=this._initContext(this.canvas,this.backend.search("desktop")&gt;=0,this.backend.search("mobile")&gt;=0,this.backend.search("flashie")&gt;=0,this.backend.search("webgl2")&gt;=0),this.backend="webgl",null==this.gl)return this.hasRuntime=!1,void this._createInitFailedDiv(e);x3dom.caps.BACKEND=this.backend;var s=e.getAttribute("runtimeEnabled");this.hasRuntime=null!==s?"true"==s.toLowerCase():e.hasRuntime,this.showStat=e.getAttribute("showStat"),this.stateViewer=new x3dom.States(e),null!==this.showStat&amp;&amp;"true"==this.showStat&amp;&amp;this.stateViewer.display(!0),this.x3dElem.appendChild(this.stateViewer.viewer),this.showProgress=e.getAttribute("showProgress"),this.progressDiv=this._createProgressDiv(),this.progressDiv.style.display=null!==this.showProgress&amp;&amp;"true"==this.showProgress?"inline":"none",this.x3dElem.appendChild(this.progressDiv),this.showTouchpoints=e.getAttribute("showTouchpoints"),this.showTouchpoints=!!this.showTouchpoints&amp;&amp;this.showTouchpoints,this.disableTouch=e.getAttribute("disableTouch"),this.disableTouch=!!this.disableTouch&amp;&amp;"true"==this.disableTouch.toLowerCase(),this.disableKeys=e.getAttribute("keysEnabled"),this.disableKeys=!!this.disableKeys&amp;&amp;"true"==this.disableKeys.toLowerCase(),this.disableRightDrag=e.getAttribute("disableRightDrag"),this.disableRightDrag=!!this.disableRightDrag&amp;&amp;"true"==this.disableRightDrag.toLowerCase(),this.disableLeftDrag=e.getAttribute("disableLeftDrag"),this.disableLeftDrag=!!this.disableLeftDrag&amp;&amp;"true"==this.disableLeftDrag.toLowerCase(),this.disableMiddleDrag=e.getAttribute("disableMiddleDrag"),this.disableMiddleDrag=!!this.disableMiddleDrag&amp;&amp;"true"==this.disableMiddleDrag.toLowerCase(),this.bindEventListeners()},x3dom.X3DCanvas.prototype.bindEventListeners=function(){var e=this;if(this.onMouseDown=function(t){if(!this.isMulti){switch(this.focus(),this.classList.add("x3dom-canvas-mousedown"),t.button){case 0:this.mouse_button=1;break;case 1:this.mouse_button=4;break;case 2:this.mouse_button=2;break;default:this.mouse_button=0}t.shiftKey&amp;&amp;(this.mouse_button=1),t.ctrlKey&amp;&amp;(this.mouse_button=4),t.altKey&amp;&amp;(this.mouse_button=2);var i=this.parent.mousePosition(t);this.mouse_drag_x=i.x,this.mouse_drag_y=i.y,this.mouse_dragging=!0,this.parent.doc.onMousePress(e.gl,this.mouse_drag_x,this.mouse_drag_y,this.mouse_button),this.parent.doc.needRender=!0}},this.onMouseUp=function(t){if(!this.isMulti){var i=this.mouse_button;this.classList.remove("x3dom-canvas-mousedown"),this.mouse_button=0,this.mouse_dragging=!1,this.parent.doc.onMouseRelease(e.gl,this.mouse_drag_x,this.mouse_drag_y,this.mouse_button,i),this.parent.doc.needRender=!0}},this.onMouseOver=function(t){this.isMulti||(this.mouse_button=0,this.mouse_dragging=!1,this.parent.doc.onMouseOver(e.gl,this.mouse_drag_x,this.mouse_drag_y,this.mouse_button),this.parent.doc.needRender=!0)},this.onMouseAlt=function(t){this.isMulti||(this.mouse_button=0,this.mouse_dragging=!1,this.classList.remove("x3dom-canvas-mousedown"),this.parent.doc.onMouseOut(e.gl,this.mouse_drag_x,this.mouse_drag_y,this.mouse_button),this.parent.doc.needRender=!0)},this.onDoubleClick=function(t){if(!this.isMulti){this.mouse_button=0;var i=this.parent.mousePosition(t);this.mouse_drag_x=i.x,this.mouse_drag_y=i.y,this.mouse_dragging=!1,this.parent.doc.onDoubleClick(e.gl,this.mouse_drag_x,this.mouse_drag_y),this.parent.doc.needRender=!0}},this.onMouseMove=function(t){if(!this.isMulti){var i=this.parent.mousePosition(t);i.x==e.lastMousePos.x&amp;&amp;i.y==e.lastMousePos.y||(e.lastMousePos=i,t.shiftKey&amp;&amp;(this.mouse_button=1),t.ctrlKey&amp;&amp;(this.mouse_button=4),t.altKey&amp;&amp;(this.mouse_button=2),this.mouse_drag_x=i.x,this.mouse_drag_y=i.y,this.mouse_dragging?(1==this.mouse_button&amp;&amp;!this.parent.disableLeftDrag||2==this.mouse_button&amp;&amp;!this.parent.disableRightDrag||4==this.mouse_button&amp;&amp;!this.parent.disableMiddleDrag)&amp;&amp;this.parent.doc.onDrag(e.gl,this.mouse_drag_x,this.mouse_drag_y,this.mouse_button):this.parent.doc.onMove(e.gl,this.mouse_drag_x,this.mouse_drag_y,this.mouse_button),this.parent.doc.needRender=!0,t.preventDefault(),t.stopPropagation())}},this.onDOMMouseScroll=function(t){if(!this.isMulti){this.focus();var i=this.parent.mousePosition(t).y;this.mouse_drag_y+=2*t.detail,this.parent.doc.onWheel(e.gl,this.mouse_drag_x,this.mouse_drag_y,i),this.parent.doc.needRender=!0,t.preventDefault(),t.stopPropagation()}},this.onKeyPress=function(e){this.parent.disableKeys||this.parent.doc.onKeyPress(e.charCode),this.parent.doc.needRender=!0},this.onMouseWheel=function(t){if(!this.isMulti){this.focus();var i=this.parent.mousePosition(t).y;this.mouse_drag_y-=.1*t.wheelDelta,this.parent.doc.onWheel(e.gl,this.mouse_drag_x,this.mouse_drag_y,i),this.parent.doc.needRender=!0,t.preventDefault(),t.stopPropagation()}},this.onKeyUp=function(e){this.parent.disableKeys||this.parent.doc.onKeyUp(e.keyCode),this.parent.doc.needRender=!0},this.onKeyDown=function(e){this.parent.disableKeys||this.parent.doc.onKeyDown(e.keyCode),this.parent.doc.needRender=!0},null!==this.canvas&amp;&amp;null!==this.gl&amp;&amp;this.hasRuntime){this.canvas.mouse_dragging=!1,this.canvas.mouse_button=0,this.canvas.mouse_drag_x=0,this.canvas.mouse_drag_y=0,this.canvas.isMulti=!1,this.canvas.oncontextmenu=function(e){return e.preventDefault(),e.stopPropagation(),!1},this.canvas.addEventListener("webglcontextlost",(function(e){x3dom.debug.logError("WebGL context lost"),e.preventDefault()}),!1),this.canvas.addEventListener("webglcontextrestored",(function(e){x3dom.debug.logError("recover WebGL state and resources on context lost NYI"),e.preventDefault()}),!1),this.canvas.addEventListener("mousedown",this.onMouseDown,!1),this.canvas.addEventListener("mouseup",this.onMouseUp,!1),this.canvas.addEventListener("mouseover",this.onMouseOver,!1),this.canvas.addEventListener("mouseout",this.onMouseOut,!1),this.canvas.addEventListener("dblclick",this.onDoubleClick,!1),this.canvas.addEventListener("mousemove",this.onMouseMove,!1),this.canvas.addEventListener("DOMMouseScroll",this.onDOMMouseScroll,!1),this.canvas.addEventListener("mousewheel",this.onMouseWheel,!1),this.canvas.addEventListener("keypress",this.onKeyPress,!0),this.canvas.addEventListener("keyup",this.onKeyUp,!0),this.canvas.addEventListener("keydown",this.onKeyDown,!0);var t={numTouches:0,firstTouchTime:(new Date).getTime(),firstTouchPoint:new x3dom.fields.SFVec2f(0,0),lastPos:new x3dom.fields.SFVec2f,lastDrag:new x3dom.fields.SFVec2f,lastMiddle:new x3dom.fields.SFVec2f,lastSquareDistance:0,lastAngle:0,lastLayer:[],examineNavType:1,calcAngle:function(e){var t=e.normalize().dot(new x3dom.fields.SFVec2f(1,0));return t=Math.acos(t),e.y&lt;0&amp;&amp;(t=Math.PI+(Math.PI-t)),t},disableTouch:this.disableTouch,visMarker:this.showTouchpoints,visMarkerBag:[],visualizeTouches:function(e){if(this.visMarker){for(var t=[],i=null,s=0;s&lt;e.touches.length;s++){var r=e.touches[s].identifier||e.touches[s].streamId;r||(r=0);var o=this.visMarkerBag.indexOf(r);o&gt;=0?((i=document.getElementById("visMarker"+r)).style.left=e.touches[s].pageX+"px",i.style.top=e.touches[s].pageY+"px"):((i=document.createElement("div")).appendChild(document.createTextNode("#"+r)),i.id="visMarker"+r,i.className="x3dom-touch-marker",document.body.appendChild(i),o=this.visMarkerBag.length,this.visMarkerBag[o]=r),t.push(r)}for(var n=this.visMarkerBag.length-1;n&gt;=0;n--){var a=this.visMarkerBag[n];t.indexOf(a)&lt;0&amp;&amp;(this.visMarkerBag.splice(n,1),i=document.getElementById("visMarker"+a),document.body.removeChild(i))}}}};this.disableTouch||(this.canvas.addEventListener("touchstart",(function(i,s){var r,o;switch(this.isMulti=!0,i.preventDefault(),t.visualizeTouches(i),this.focus(),null==s&amp;&amp;(s=this.parent.doc),s._scene.getNavigationInfo().getType()){case"examine":t.examineNavType=1;break;case"turntable":t.examineNavType=2;break;default:t.examineNavType=0}for(t.lastLayer=[],r=0;r&lt;i.touches.length;r++)o=this.parent.mousePosition(i.touches[r]),t.lastLayer.push([i.touches[r].identifier,new x3dom.fields.SFVec2f(o.x,o.y)]);if(t.numTouches&lt;1&amp;&amp;1==i.touches.length)t.numTouches=1,t.lastDrag=new x3dom.fields.SFVec2f(i.touches[0].screenX,i.touches[0].screenY);else if(t.numTouches&lt;2&amp;&amp;i.touches.length&gt;=2){t.numTouches=2;var n=new x3dom.fields.SFVec2f(i.touches[0].screenX,i.touches[0].screenY),a=new x3dom.fields.SFVec2f(i.touches[1].screenX,i.touches[1].screenY).subtract(n),h=a.multiply(.5).add(n),d=a.dot(a);t.lastMiddle=h,t.lastSquareDistance=d,t.lastAngle=t.calcAngle(a),t.lastPos=this.parent.mousePosition(i.touches[0])}if(s._scene.updateVolume(),1==t.examineNavType)for(r=0;r&lt;i.touches.length;r++)o=this.parent.mousePosition(i.touches[r]),s.onPick(e.gl,o.x,o.y),s._viewarea.prepareEvents(o.x,o.y,1,"onmousedown"),s._viewarea._pickingInfo.lastClickObj=s._viewarea._pickingInfo.pickObj;else i.touches.length&amp;&amp;(o=this.parent.mousePosition(i.touches[0]),s.onMousePress(e.gl,o.x,o.y,1));s.needRender=!0}),!0),this.canvas.addEventListener("touchmove",(function(i,s){i.preventDefault(),t.visualizeTouches(i),null==s&amp;&amp;(s=this.parent.doc);var r,o,n,a,h,d,l,u=null,f=null;if(1==t.examineNavType){if(1==i.touches.length){var c=new x3dom.fields.SFVec2f(i.touches[0].screenX,i.touches[0].screenY),m=c.subtract(t.lastDrag);t.lastDrag=c;var _=x3dom.fields.SFMatrix4f.rotationY(m.x/100),p=x3dom.fields.SFMatrix4f.rotationX(m.y/100);f=_.mult(p),s.onMoveView(e.gl,i,t,null,f)}else if(i.touches.length&gt;=2){r=new x3dom.fields.SFVec2f(i.touches[0].screenX,i.touches[0].screenY),n=(o=new x3dom.fields.SFVec2f(i.touches[1].screenX,i.touches[1].screenY).subtract(r)).multiply(.5).add(r),a=o.dot(o),h=n.subtract(t.lastMiddle),d=a-t.lastSquareDistance,l=new x3dom.fields.SFVec3f(h.x/screen.width,-h.y/screen.height,d/(screen.width*screen.height*.2));var x=t.calcAngle(o),g=t.lastAngle-x;t.lastAngle=x,f=x3dom.fields.SFMatrix4f.rotationZ(g),t.lastMiddle=n,t.lastSquareDistance=a,s.onMoveView(e.gl,i,t,l,f)}}else i.touches.length&amp;&amp;(2==t.examineNavType&amp;&amp;i.touches.length&gt;=2?(r=new x3dom.fields.SFVec2f(i.touches[0].screenX,i.touches[0].screenY),d=((a=(o=new x3dom.fields.SFVec2f(i.touches[1].screenX,i.touches[1].screenY).subtract(r)).dot(o))-t.lastSquareDistance)/(.1*(screen.width+screen.height)),t.lastPos.y+=d,t.lastSquareDistance=a,s.onDrag(e.gl,t.lastPos.x,t.lastPos.y,2)):(u=this.parent.mousePosition(i.touches[0]),s.onDrag(e.gl,u.x,u.y,1)));s.needRender=!0}),!0),this.canvas.addEventListener("touchend",(function(i,s){this.isMulti=!1,i.preventDefault(),t.visualizeTouches(i),null==s&amp;&amp;(s=this.parent.doc),s._viewarea._isMoving=!1,2==t.numTouches&amp;&amp;1==i.touches.length&amp;&amp;(t.lastDrag=new x3dom.fields.SFVec2f(i.touches[0].screenX,i.touches[0].screenY));var r=!1;if(i.touches.length&lt;2&amp;&amp;(1==t.numTouches&amp;&amp;(r=!0),t.numTouches=i.touches.length),1==t.examineNavType){for(var o=0;o&lt;t.lastLayer.length;o++){var n=t.lastLayer[o][1];if(s.onPick(e.gl,n.x,n.y),"box"!==s._scene._vf.pickMode.toLowerCase())s._viewarea.prepareEvents(n.x,n.y,1,"onmouseup"),s._viewarea._pickingInfo.lastClickObj=s._viewarea._pickingInfo.pickObj,s._viewarea._pickingInfo.pickObj&amp;&amp;s._viewarea._pickingInfo.pickObj===s._viewarea._pickingInfo.lastClickObj&amp;&amp;s._viewarea.prepareEvents(n.x,n.y,1,"onclick");else{var a=s._viewarea.calcViewRay(n.x,n.y),h=s._scene.doIntersect(a),d=a.hitObject;h&amp;&amp;d&amp;&amp;(s._viewarea._pick.setValues(a.hitPoint),s._viewarea.checkEvents(d,n.x,n.y,1,"onclick"),x3dom.debug.logInfo("Hit '"+d._xmlNode.localName+"/ "+d._DEF+"' at pos "+s._viewarea._pick))}}if(r){var l=(new Date).getTime();t.firstTouchPoint.subtract(t.lastDrag).length()&lt;18&amp;&amp;l-t.firstTouchTime&lt;180&amp;&amp;s.onDoubleClick(e.gl,0,0),t.firstTouchTime=l,t.firstTouchPoint=t.lastDrag}}else t.lastLayer.length&amp;&amp;(n=t.lastLayer[0][1],s.onMouseRelease(e.gl,n.x,n.y,0,1));s.needRender=!0}),!0))}},x3dom.X3DCanvas.prototype._initContext=function(e,t,i,s){x3dom.debug.logInfo("Initializing X3DCanvas for ["+e.id+"]");var r=x3dom.gfx_webgl(e,t,i,s,this.x3dElem);return r?(parseFloat(x3dom.caps.VERSION.match(/\d+\.\d+/)[0])&lt;1&amp;&amp;x3dom.debug.logError("WebGL version "+x3dom.caps.VERSION+" lacks important WebGL/GLSL features needed for shadows, special vertex attribute types, etc.!"),r):(x3dom.debug.logError("No 3D context found..."),this.x3dElem.removeChild(e),null)},x3dom.X3DCanvas.prototype.appendParam=function(e,t,i){var s=document.createElement("param");s.setAttribute("name",t),s.setAttribute("value",i),e.appendChild(s)},x3dom.X3DCanvas.prototype._createInitFailedDiv=function(e){var t=document.createElement("div");t.setAttribute("id","x3dom-create-init-failed"),t.style.width=e.getAttribute("width"),t.style.height=e.getAttribute("height"),t.style.backgroundColor="#C00",t.style.color="#FFF",t.style.fontSize="20px",t.style.fontWidth="bold",t.style.padding="10px 10px 10px 10px",t.style.display="inline-block",t.style.fontFamily="Helvetica",t.style.textAlign="center",t.appendChild(document.createTextNode("Your Browser does not support X3DOM")),t.appendChild(document.createElement("br")),t.appendChild(document.createTextNode("Read more about Browser support on:")),t.appendChild(document.createElement("br"));var i=document.createElement("a");i.setAttribute("href","http://www.x3dom.org/?page_id=9"),i.appendChild(document.createTextNode("X3DOM | Browser Support")),t.appendChild(i);var s=e.getAttribute("altImg")||null;s&amp;&amp;((new Image).src=s,t.style.backgroundImage="url("+s+")",t.style.backgroundRepeat="no-repeat",t.style.backgroundPosition="50% 50%");e.appendChild(t),x3dom.debug.logError("Your Browser does not support X3DOM!")},x3dom.X3DCanvas.prototype._createHTMLCanvas=function(e){x3dom.debug.logInfo("Creating canvas for (X)3D element...");var t=document.createElement("canvas");t.setAttribute("class","x3dom-canvas"),e.getAttribute("style")&amp;&amp;x3dom.debug.logInfo("Inline X3D styles detected");for(var i=["onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onclick","ondblclick","onkeydown","onkeypress","onkeyup","ontouchstart","ontouchmove","ontouchend","ontouchcancel","ontouchleave","ontouchenter","ondragstart","ondrop","ondragover"],s=0;s&lt;i.length;s++){var r=i[s],o=e.getAttribute(r);o&amp;&amp;(x3dom.debug.logInfo(r+", "+o),t.setAttribute(r,o),e.removeAttribute(r))}var n=e.getAttribute("draggable");n&amp;&amp;(x3dom.debug.logInfo("draggable="+n),t.setAttribute("draggable",n)),e.__addEventListener||e.__removeEventListener||(e.__addEventListener=e.addEventListener,e.__removeEventListener=e.removeEventListener,e.addEventListener=function(e,s,r){var o,n=!1;for(o=0;o&lt;i.length&amp;&amp;!n;o++)i[o]===e&amp;&amp;(n=!0);n?(x3dom.debug.logInfo("addEventListener for div.on"+e),t.addEventListener(e,s,r)):(x3dom.debug.logInfo("addEventListener for X3D.on"+e),this.__addEventListener(e,s,r))},e.removeEventListener=function(e,s,r){var o,n=!1;for(o=0;o&lt;i.length&amp;&amp;!n;o++)i[o]===e&amp;&amp;(n=!0);n?(x3dom.debug.logInfo("removeEventListener for div.on"+e),t.removeEventListener(e,s,r)):(x3dom.debug.logInfo("removeEventListener for X3D.on"+e),this.__removeEventListener(e,s,r))}),e.hasAttribute("ondownloadsfinished")&amp;&amp;e.addEventListener("downloadsfinished",(function(){var t={target:e,type:"downloadsfinished"},i=e.getAttribute("ondownloadsfinished");new Function("event",i).call(e,t)}),!0),e.appendChild(t);var a,h,d=e.getAttribute("id");if(null!==d)t.id="x3dom-"+d+"-canvas";else{var l=(new Date).getTime();t.id="x3dom-"+l+"-canvas"}return null!==(a=e.getAttribute("width"))&amp;&amp;(a.indexOf("%")&gt;=0&amp;&amp;x3dom.debug.logWarning("The width attribute is to be specified in pixels not in percent."),t.style.width=a,t.setAttribute("width",a)),null!==(h=e.getAttribute("height"))&amp;&amp;(h.indexOf("%")&gt;=0&amp;&amp;x3dom.debug.logWarning("The height attribute is to be specified in pixels not in percent."),t.style.height=h,t.setAttribute("height",h)),t.setAttribute("tabindex","0"),t},x3dom.X3DCanvas.prototype._watchForResize=function(){var e=[parseInt(x3dom.getStyle(this.canvas,"width")),parseInt(x3dom.getStyle(this.canvas,"height"))];this._current_dim[0]==e[0]&amp;&amp;this._current_dim[1]==e[1]||(this._current_dim=e,this.x3dElem.setAttribute("width",e[0]+"px"),this.x3dElem.setAttribute("height",e[1]+"px"))},x3dom.X3DCanvas.prototype._createProgressDiv=function(){var e=document.createElement("div");e.setAttribute("class","x3dom-progress");var t=document.createElement("strong");t.appendChild(document.createTextNode("Loading...")),e.appendChild(t);var i=document.createElement("span");return i.setAttribute("style","width: 25%;"),i.appendChild(document.createTextNode(" ")),e.appendChild(i),e.oncontextmenu=e.onmousedown=function(e){return e.preventDefault(),e.stopPropagation(),!1},e},x3dom.X3DCanvas.prototype.mousePosition=function(e){var t=e.target.getBoundingClientRect(),i=Math.round(e.clientX-t.left)*this.devicePixelRatio,s=Math.round(e.clientY-t.top)*this.devicePixelRatio;return new x3dom.fields.SFVec2f(i,s)},x3dom.X3DCanvas.prototype.tick=function(e){this._elapsedTime=this._totalTime?e-this._totalTime:0,this._totalTime=e;var t=this.x3dElem.runtime,i=(new Date).getTime(),s=i-this.lastTimeFPSWasTaken;this.fps_t0;this.fps_t0=i,this.doc.advanceTime(i/1e3);var r,o=(new Date).getTime()-i;(this.doc.needRender&amp;&amp;(s&gt;=1e3&amp;&amp;(t.fps=this.framesSinceLastTime/(s/1e3),t.addMeasurement("FPS",t.fps),this.framesSinceLastTime=0,this.lastTimeFPSWasTaken=i),this.framesSinceLastTime++,t.addMeasurement("ANIM",o),0==t.isReady&amp;&amp;(t.ready(),t.isReady=!0),t.enterFrame({total:this._totalTime,elapsed:this._elapsedTime}),this.doc.needRender=!1,this.doc.render(this.gl),this.doc._scene._vf.doPickPass||t.removeMeasurement("PICKING"),t.exitFrame({total:this._totalTime,elapsed:this._elapsedTime})),this.progressDiv&amp;&amp;(this.doc.downloadCount&gt;0?t.addInfo("#LOADS:",this.doc.downloadCount):t.removeInfo("#LOADS:"),"false"!==this.doc.properties.getProperty("showProgress")?this.progressDiv&amp;&amp;(this.progressDiv.childNodes[0].textContent="Loading: "+ +this.doc.downloadCount,this.doc.downloadCount&gt;0?this.progressDiv.style.display="inline":this.progressDiv.style.display="none"):this.progressDiv.style.display="none"),0==this.doc.downloadCount&amp;&amp;this.doc.previousDownloadCount&gt;0)&amp;&amp;(document.createEvent?((r=document.createEvent("Events")).initEvent("downloadsfinished",!0,!0),this.x3dElem.dispatchEvent(r)):document.createEventObject&amp;&amp;(r=document.createEventObject(),this.x3dElem.fireEvent("ondownloadsfinished",r)));this.doc.previousDownloadCount=this.doc.downloadCount},x3dom.X3DCanvas.prototype.load=function(e,t,i){this.doc=new x3dom.X3DDocument(this.canvas,this.gl,i);var s=this;this.doc.onload=function(){s.hasRuntime?function e(t){s.doc&amp;&amp;s.x3dElem.runtime&amp;&amp;(s._watchForResize(),s.tick(t),window.requestAnimFrame(e,s))}():s.tick()},this.x3dElem.render=function(){s.hasRuntime?s.doc.needRender=!0:s.doc.render(s.gl)},this.x3dElem.context=s.gl.ctx3d,this.doc.onerror=function(){alert("Failed to load X3D document")},this.doc.load(e,t)},x3dom.runtime={},x3dom.Runtime=function(e,t){this.doc=e,this.canvas=t,this.config={},this.isReady=!1,this.fps=0,this.states={measurements:[],infos:[]}},x3dom.Runtime.prototype.addMeasurement=function(e,t){this.states.measurements[e]=t},x3dom.Runtime.prototype.removeMeasurement=function(e){this.states.measurements[e]&amp;&amp;delete this.states.measurements[e]},x3dom.Runtime.prototype.addInfo=function(e,t){this.states.infos[e]=t},x3dom.Runtime.prototype.removeInfo=function(e){delete this.states.infos[e]},x3dom.Runtime.prototype.initialize=function(e,t){this.doc=e,this.canvas=t,this.config={},this.isReady=!1,this.fps=0},x3dom.Runtime.prototype.noBackendFound=function(){x3dom.debug.logInfo("No backend found. Unable to render.")},x3dom.Runtime.prototype.ready=function(){x3dom.debug.logInfo("System ready.")},x3dom.Runtime.prototype.enterFrame=function(){},x3dom.Runtime.prototype.exitFrame=function(){},x3dom.Runtime.prototype.triggerRedraw=function(){this.canvas.doc.needRender=!0},x3dom.Runtime.prototype.getActiveBindable=function(e){var t,i,s,r,o;if(t=this.canvas.doc._bindableBag._stacks,r=[],!(o=x3dom.nodeTypesLC[e.toLowerCase()]))return x3dom.debug.logError('No node of type "'+e+'" found.'),null;for(i=0;i&lt;t.length;i++)void 0!==(s=t[i].getActive())._xmlNode&amp;&amp;x3dom.isa(s,o)&amp;&amp;r.push(s);return r[0]?r[0]._xmlNode:null},x3dom.Runtime.prototype.nextView=function(){var e=this.canvas.doc._scene.getViewpoint()._stack;e?e.switchTo("next"):x3dom.debug.logError("No valid ViewBindable stack.")},x3dom.Runtime.prototype.prevView=function(){var e=this.canvas.doc._scene.getViewpoint()._stack;e?e.switchTo("prev"):x3dom.debug.logError("No valid ViewBindable stack.")},x3dom.Runtime.prototype.viewpoint=function(){return this.canvas.doc._scene.getViewpoint()},x3dom.Runtime.prototype.viewMatrix=function(){return this.canvas.doc._viewarea.getViewMatrix()},x3dom.Runtime.prototype.projectionMatrix=function(){return this.canvas.doc._viewarea.getProjectionMatrix()},x3dom.Runtime.prototype.getWorldToCameraCoordinatesMatrix=function(){return this.canvas.doc._viewarea.getWCtoCCMatrix()},x3dom.Runtime.prototype.getCameraToWorldCoordinatesMatrix=function(){return this.canvas.doc._viewarea.getCCtoWCMatrix()},x3dom.Runtime.prototype.getViewingRay=function(e,t){return this.canvas.doc._viewarea.calcViewRay(e,t)},x3dom.Runtime.prototype.shootRay=function(e,t){var i=this.canvas.doc,s=i._viewarea._pickingInfo;return i.onPick(this.canvas.gl,e,t),{pickPosition:s.pickObj?s.pickPos:null,pickNormal:s.pickObj?s.pickNorm:null,pickObject:s.pickObj?s.pickObj._xmlNode:null}},x3dom.Runtime.prototype.getWidth=function(){return this.canvas.doc._viewarea._width},x3dom.Runtime.prototype.getHeight=function(){return this.canvas.doc._viewarea._height},x3dom.Runtime.prototype.mousePosition=function(e){var t=this.canvas.mousePosition(e);return[t.x,t.y]},x3dom.Runtime.prototype.calcCanvasPos=function(e,t,i){var s=new x3dom.fields.SFVec3f(e,t,i),r=this.canvas.doc._viewarea.getWCtoCCMatrix().multFullMatrixPnt(s),o=this.canvas.doc._viewarea._width,n=this.canvas.doc._viewarea._height;return[Math.round((r.x+1)*(o-1)/2),Math.round((n-1)*(1-r.y)/2)]},x3dom.Runtime.prototype.calcPagePos=function(e,t,i){var s=this.canvas.canvas.offsetParent;if(!s)return x3dom.debug.logError("Can't calc page pos without offsetParent."),[0,0];var r=s.getBoundingClientRect(),o=this.calcCanvasPos(e,t,i),n=window.pageXOffset||document.body.scrollLeft,a=window.pageYOffset||document.body.scrollTop,h=document.defaultView.getComputedStyle(s,null),d=parseFloat(h.getPropertyValue("padding-left")),l=parseFloat(h.getPropertyValue("border-left-width")),u=parseFloat(h.getPropertyValue("padding-top")),f=parseFloat(h.getPropertyValue("border-top-width"));return[r.left+d+l+n+o[0],r.top+u+f+a+o[1]]},x3dom.Runtime.prototype.calcClientPos=function(e,t,i){var s=this.canvas.canvas.offsetParent;if(!s)return x3dom.debug.logError("Can't calc client pos without offsetParent."),[0,0];var r=s.getBoundingClientRect(),o=this.calcCanvasPos(e,t,i),n=document.defaultView.getComputedStyle(s,null),a=parseFloat(n.getPropertyValue("padding-left")),h=parseFloat(n.getPropertyValue("border-left-width")),d=parseFloat(n.getPropertyValue("padding-top")),l=parseFloat(n.getPropertyValue("border-top-width"));return[r.left+a+h+o[0],r.top+d+l+o[1]]},x3dom.Runtime.prototype.getScreenshot=function(){var e="",t=this.canvas.backend,i=this.canvas.canvas;if(i)if("flash"==t)e=i.getScreenshot();else{var s=document.createElement("canvas");s.width=i.width,s.height=i.height;var r=s.getContext("2d");r.drawImage(i,0,0,i.width,i.height),r.scale(1,-1),r.translate(0,-i.height),e=s.toDataURL()}return e},x3dom.Runtime.prototype.getCanvas=function(){return this.canvas.canvas},x3dom.Runtime.prototype.lightMatrix=function(){this.canvas.doc._viewarea.getLightMatrix()},x3dom.Runtime.prototype.resetView=function(){this.canvas.doc._viewarea.resetView()},x3dom.Runtime.prototype.lightView=function(){return this.canvas.doc._nodeBag.lights.length&gt;0?(this.canvas.doc._viewarea.animateTo(this.canvas.doc._viewarea.getLightMatrix()[0],this.canvas.doc._scene.getViewpoint()),!0):(x3dom.debug.logInfo("No lights to navigate to."),!1)},x3dom.Runtime.prototype.uprightView=function(){this.canvas.doc._viewarea.uprightView()},x3dom.Runtime.prototype.fitAll=function(e){void 0===e&amp;&amp;(e=!0);var t=this.canvas.doc._scene;t.updateVolume(),this.canvas.doc._viewarea.fit(t._lastMin,t._lastMax,e)},x3dom.Runtime.prototype.fitObject=function(e,t){if(e&amp;&amp;e._x3domNode){void 0===t&amp;&amp;(t=!0);var i=x3dom.fields.SFVec3f.MAX(),s=x3dom.fields.SFVec3f.MIN();e._x3domNode.getVolume().getBounds(i,s);var r=e._x3domNode.getCurrentTransform();if(i=r.multMatrixPnt(i),s=r.multMatrixPnt(s),x3dom.isa(e._x3domNode,x3dom.nodeTypes.X3DTransformNode)){var o=e._x3domNode._trafo.inverse();i=o.multMatrixPnt(i),s=o.multMatrixPnt(s)}this.canvas.doc._viewarea.fit(i,s,t)}},x3dom.Runtime.prototype.showAll=function(e,t){this.canvas.doc._viewarea.showAll(e,t)},x3dom.Runtime.prototype.showObject=function(e,t){if(e&amp;&amp;e._x3domNode){var i=x3dom.fields.SFVec3f.MAX(),s=x3dom.fields.SFVec3f.MIN();e._x3domNode.getVolume().getBounds(i,s);var r=e._x3domNode.getCurrentTransform();i=r.multMatrixPnt(i),s=r.multMatrixPnt(s);var o,n=this.canvas.doc._viewarea,a=n._width&lt;n._height?n._width:n._height;switch(t){case"posX":o=new x3dom.fields.SFVec3f(1,0,0);break;case"negX":o=new x3dom.fields.SFVec3f(-1,0,0);break;case"posY":o=new x3dom.fields.SFVec3f(0,1,0);break;case"negY":o=new x3dom.fields.SFVec3f(1,-1,0);break;case"posZ":o=new x3dom.fields.SFVec3f(0,0,1);break;case"negZ":o=new x3dom.fields.SFVec3f(0,0,-1)}var h=this.canvas.doc._scene.getViewpoint(),d=h.getFieldOfView()/2,l=Math.tan(d);Math.abs(l)&gt;x3dom.fields.Eps&amp;&amp;(a/=l);var u=n._width-1,f=n._height-1,c=.25,m=new x3dom.fields.SFVec2f(c*u,c*f);c=.75;var _=new x3dom.fields.SFVec2f(c*u,c*f),p=s.subtract(i).multiply(.5),x=p.length(),g=i.add(p),v=_.subtract(m).multiply(.5),y=1.5*v.length();v=v.add(m);var b=1;y&gt;x3dom.fields.Eps&amp;&amp;(b=x/y*Math.sqrt(v.x*v.x+v.y*v.y+a*a)),o=(o=r.multMatrixVec(o).normalize()).multiply(b);var T=g.add(o),S=x3dom.fields.Quaternion.rotateFromTo(new x3dom.fields.SFVec3f(0,0,1),o).toMatrix(),w=x3dom.fields.SFMatrix4f.translation(T.negate()),M=x3dom.fields.SFMatrix4f.translation(T),E=(M=M.mult(S).mult(w).mult(M)).inverse();n.animateTo(E,h)}},x3dom.Runtime.prototype.getCenter=function(e){return e&amp;&amp;e._x3domNode&amp;&amp;(this.isA(e,"X3DShapeNode")||this.isA(e,"X3DGeometryNode"))?e._x3domNode.getCenter():null},x3dom.Runtime.prototype.getCurrentTransform=function(e){return e&amp;&amp;e._x3domNode?e._x3domNode.getCurrentTransform():null},x3dom.Runtime.prototype.getBBox=function(e){if(e&amp;&amp;e._x3domNode&amp;&amp;this.isA(e,"X3DBoundedObject")){var t=e._x3domNode.getVolume();return{min:x3dom.fields.SFVec3f.copy(t.min),max:x3dom.fields.SFVec3f.copy(t.max)}}return null},x3dom.Runtime.prototype.getSceneBBox=function(){var e=this.canvas.doc._scene;return e.updateVolume(),{min:x3dom.fields.SFVec3f.copy(e._lastMin),max:x3dom.fields.SFVec3f.copy(e._lastMax)}},x3dom.Runtime.prototype.debug=function(e){var t=this.canvas.doc;return void 0===t._viewarea._visDbgBuf&amp;&amp;(t._viewarea._visDbgBuf="true"===t._x3dElem.getAttribute("showLog")),arguments.length&gt;0?!0===e?(t._viewarea._visDbgBuf=!0,x3dom.debug.logContainer.style.display="block"):(t._viewarea._visDbgBuf=!1,x3dom.debug.logContainer.style.display="none"):(t._viewarea._visDbgBuf=!t._viewarea._visDbgBuf,x3dom.debug.logContainer.style.display=1==t._viewarea._visDbgBuf?"block":"none"),t.needRender=!0,t._viewarea._visDbgBuf},x3dom.Runtime.prototype.navigationType=function(){return this.canvas.doc._scene.getNavigationInfo().getType()},x3dom.Runtime.prototype.noNav=function(){this.canvas.doc._scene.getNavigationInfo().setType("none")},x3dom.Runtime.prototype.examine=function(){this.canvas.doc._scene.getNavigationInfo().setType("examine")},x3dom.Runtime.prototype.turnTable=function(){this.canvas.doc._scene.getNavigationInfo().setType("turntable")},x3dom.Runtime.prototype.fly=function(){this.canvas.doc._scene.getNavigationInfo().setType("fly")},x3dom.Runtime.prototype.freeFly=function(){this.canvas.doc._scene.getNavigationInfo().setType("freefly")},x3dom.Runtime.prototype.lookAt=function(){this.canvas.doc._scene.getNavigationInfo().setType("lookat")},x3dom.Runtime.prototype.lookAround=function(){this.canvas.doc._scene.getNavigationInfo().setType("lookaround")},x3dom.Runtime.prototype.walk=function(){this.canvas.doc._scene.getNavigationInfo().setType("walk")},x3dom.Runtime.prototype.game=function(){this.canvas.doc._scene.getNavigationInfo().setType("game")},x3dom.Runtime.prototype.helicopter=function(){this.canvas.doc._scene.getNavigationInfo().setType("helicopter")},x3dom.Runtime.prototype.resetExamin=function(){var e=this.canvas.doc._viewarea;e._rotMat=x3dom.fields.SFMatrix4f.identity(),e._transMat=x3dom.fields.SFMatrix4f.identity(),e._movement=new x3dom.fields.SFVec3f(0,0,0),e._needNavigationMatrixUpdate=!0,this.canvas.doc.needRender=!0},x3dom.Runtime.prototype.disableKeys=function(){this.canvas.disableKeys=!0},x3dom.Runtime.prototype.enableKeys=function(){this.canvas.disableKeys=!1},x3dom.Runtime.prototype.disableLeftDrag=function(){this.canvas.disableLeftDrag=!0},x3dom.Runtime.prototype.enableLeftDrag=function(){this.canvas.disableLeftDrag=!1},x3dom.Runtime.prototype.disableRightDrag=function(){this.canvas.disableRightDrag=!0},x3dom.Runtime.prototype.enableRightDrag=function(){this.canvas.disableRightDrag=!1},x3dom.Runtime.prototype.disableMiddleDrag=function(){this.canvas.disableMiddleDrag=!0},x3dom.Runtime.prototype.enableMiddleDrag=function(){this.canvas.disableMiddleDrag=!1},x3dom.Runtime.prototype.togglePoints=function(e){var t=this.canvas.doc,i=!0===e?3:2;return t._viewarea._points=++t._viewarea._points%i,t.needRender=!0,t._viewarea._points},x3dom.Runtime.prototype.pickRect=function(e,t,i,s){return this.canvas.doc.onPickRect(this.canvas.gl,e,t,i,s)},x3dom.Runtime.prototype.pickMode=function(e){return e&amp;&amp;!0===e.internal?this.canvas.doc._scene._vf.pickMode:this.canvas.doc._scene._vf.pickMode.toLowerCase()},x3dom.Runtime.prototype.changePickMode=function(e){switch(e=e.toLowerCase()){case"idbuf":e="idBuf";break;case"idbuf24":e="idBuf24";break;case"idbufid":e="idBufId";break;case"texcoord":e="texCoord";break;case"color":e="color";break;case"box":e="box";break;default:x3dom.debug.logWarning("Switch pickMode to "+e+" unknown intersect type"),e=void 0}return void 0!==e&amp;&amp;(this.canvas.doc._scene._vf.pickMode=e,x3dom.debug.logInfo("Switched pickMode to '"+e+"'."),!0)},x3dom.Runtime.prototype.speed=function(e){var t=this.canvas.doc._scene.getNavigationInfo();return e&amp;&amp;(t._vf.speed=e,x3dom.debug.logInfo("Changed navigation speed to "+t._vf.speed)),t._vf.speed},x3dom.Runtime.prototype.zoom=function(e){this.canvas.doc._viewarea.zoom(e),this.canvas.doc.needRender=!0},x3dom.Runtime.prototype.statistics=function(e){var t=this.canvas.stateViewer;return!!t&amp;&amp;(this.canvas.doc.needRender=!0,!0===e?(t.display(e),!0):!1===e?(t.display(e),!1):(t.display(!t.active),t.active))},x3dom.Runtime.prototype.processIndicator=function(e){var t=this.canvas.progressDiv;return!!t&amp;&amp;(!0===e?(t.style.display="inline",!0):!1===e?(t.style.display="none",!1):"none"!=t.style.display)},x3dom.Runtime.prototype.properties=function(){return this.canvas.doc.properties},x3dom.Runtime.prototype.backendName=function(){return this.canvas.backend},x3dom.Runtime.prototype.getFPS=function(){return this.fps},x3dom.Runtime.prototype.isA=function(e,t){var i=!1;return t&amp;&amp;e&amp;&amp;e._x3domNode&amp;&amp;(""===t&amp;&amp;(t="X3DNode"),i=x3dom.isa(e._x3domNode,x3dom.nodeTypesLC[t.toLowerCase()])),i},x3dom.Runtime.prototype.getPixelScale=function(){var e=this.viewpoint();if(!x3dom.isa(e,x3dom.nodeTypes.OrthoViewpoint))return x3dom.debug.logError("getPixelScale is only implemented for orthographic Viewpoints"),null;var t=e.getZoom(),i=t[0],s=t[1],r=t[2],o=t[3]-s,n=(r-i)/this.getWidth(),a=o/this.getHeight();return new x3dom.fields.SFVec3f(n,a,0)},x3dom.Runtime.prototype.toggleProjection=function(e,t){var i,s=document.getElementById("x3d").runtime.canvas.doc._scene.getNavigationInfo(),r=s._vf.transitionTime,o=document.getElementById(e)._x3domNode,n=document.getElementById(t)._x3domNode;if(s._vf.transitionTime=0,n._bindAnimation=!1,o._bindAnimation=!1,o._vf.isActive)n._viewMatrix=o._viewMatrix,document.getElementById(t).setAttribute("set_bind","true"),i=o._viewMatrix.e3().length()/2.2,n.setZoom(i);else if(n._vf.isActive){o._viewMatrix=n._viewMatrix,document.getElementById(e).setAttribute("set_bind","true"),i=2.2*n._fieldOfView[2];var a=n._viewMatrix.e3().normalize().multiply(i);o._viewMatrix.setTranslate(a)}return s._vf.transitionTime=r,n._bindAnimation=!0,o._bindAnimation=!0,o._vf.isActive?0:1},x3dom.userAgentFeature={supportsDOMAttrModified:!1},function(){"use strict";var e=function(){var e,t,i,s=document.getElementsByTagName("X3D"),r=[];for(e=0;e&lt;s.length;e++)void 0===s[e].hasRuntime&amp;&amp;r.push(s[e]);var o,n,a,h,d,l,u,f,c,m=new x3dom.Properties,_=array_to_object(["showLog","showStat","showProgress","PrimitiveQuality","components","loadpath","disableDoubleClick","backend","altImg","flashrenderer","swfpath","runtimeEnabled","keysEnabled","showTouchpoints","disableTouch","maxActiveDownloads"]),p=!1;for(e=0;e&lt;r.length;e++){for(m.setProperty("showLog",r[e].getAttribute("showLog")||"false"),m.setProperty("showStat",r[e].getAttribute("showStat")||"false"),m.setProperty("showProgress",r[e].getAttribute("showProgress")||"true"),m.setProperty("PrimitiveQuality",r[e].getAttribute("PrimitiveQuality")||"High"),i=r[e].getElementsByTagName("PARAM"),t=0;t&lt;i.length;t++)i[t].getAttribute("name")in _&amp;&amp;m.setProperty(i[t].getAttribute("name"),i[t].getAttribute("value"));if("true"===m.getProperty("showLog")&amp;&amp;(p=!0),"undefined"!=typeof X3DOM_SECURITY_OFF&amp;&amp;!0===X3DOM_SECURITY_OFF){if(o=m.getProperty("components",r[e].getAttribute("components")))for(n=m.getProperty("loadpath",r[e].getAttribute("loadpath")),o=o.trim().split(","),t=0;t&lt;o.length;t++)x3dom.loadJS(o[t]+".js",n);if(r[e].getAttribute("src")){var x=document.createElement("scene"),g=document.createElement("Inline");g.setAttribute("url",r[e].getAttribute("src")),x.appendChild(g),r[e].appendChild(x)}}}for(1==p?x3dom.debug.activate(!0):x3dom.debug.activate(!1),r=Array.map(r,(function(e){return e.hasRuntime=!0,e})),void 0!==x3dom.versionInfo&amp;&amp;x3dom.debug.logInfo("X3DOM version "+x3dom.versionInfo.version+", Revison &lt;a href='https://github.com/x3dom/x3dom/tree/"+x3dom.versionInfo.revision+"'&gt;"+x3dom.versionInfo.revision+"&lt;/a&gt;, Date "+x3dom.versionInfo.date),x3dom.debug.logInfo("Found "+r.length+" X3D and nodes..."),e=0;e&lt;r.length;e++)a=r[e],h=new x3dom.X3DCanvas(a,x3dom.canvases.length),x3dom.canvases.push(h),null!==h.gl?(f=(new Date).getTime(),r[e].runtime=new x3dom.Runtime(r[e],h),r[e].runtime.initialize(r[e],h),x3dom.runtime.ready&amp;&amp;(r[e].runtime.ready=x3dom.runtime.ready),""==h.backend&amp;&amp;x3dom.runtime.noBackendFound(),h.load(r[e],e,m),"true"===m.getProperty("showStat")?r[e].runtime.statistics(!0):r[e].runtime.statistics(!1),"true"===m.getProperty("showProgress")?("bar"===m.getProperty("showProgress")&amp;&amp;h.progressDiv.setAttribute("class","x3dom-progress bar"),r[e].runtime.processIndicator(!0)):r[e].runtime.processIndicator(!1),c=(new Date).getTime()-f,x3dom.debug.logInfo("Time for setup and init of GL element no. "+e+": "+c+" ms.")):((d=document.createElement("div")).setAttribute("class","x3dom-nox3d"),d.setAttribute("id","x3dom-nox3d"),(l=document.createElement("p")).appendChild(document.createTextNode("WebGL is not yet supported in your browser. ")),(u=document.createElement("a")).setAttribute("href","http://www.x3dom.org/?page_id=9"),u.appendChild(document.createTextNode("Follow link for a list of supported browsers... ")),d.appendChild(l),d.appendChild(u),h.x3dElem.appendChild(d),h.stateViewer&amp;&amp;a.removeChild(h.stateViewer.viewer));!function(e){var t=null;document.createEvent?((t=document.createEvent("Events")).initEvent("load",!0,!0),document.dispatchEvent(t)):document.createEventObject&amp;&amp;(t=document.createEventObject(),document.body.fireEvent("onload",t))}()},t=function(){if(x3dom.canvases){for(var e=0;e&lt;x3dom.canvases.length;e++)x3dom.canvases[e].doc.shutdown(x3dom.canvases[e].gl);x3dom.canvases=[]}};x3dom.reload=function(){e()},window.addEventListener?(window.addEventListener("load",e,!1),window.addEventListener("unload",t,!1),window.addEventListener("reload",t,!1)):window.attachEvent&amp;&amp;(window.attachEvent("onload",e),window.attachEvent("onunload",t),window.attachEvent("onreload",t)),"complete"===document.readyState&amp;&amp;window.setTimeout((function(){e()}),20)}(),x3dom.Cache=function(){this.textures=[],this.shaders=[]},x3dom.Cache.prototype.getTexture2D=function(e,t,i,s,r,o,n){var a=i;return void 0===this.textures[a]&amp;&amp;(this.textures[a]=x3dom.Utils.createTexture2D(e,t,i,s,r,o,n)),this.textures[a]},x3dom.Cache.prototype.getTexture2DByDEF=function(e,t,i){var s=t.name+"_"+i;return void 0===this.textures[s]&amp;&amp;(this.textures[s]=e.createTexture()),this.textures[s]},x3dom.Cache.prototype.getTextureCube=function(e,t,i,s,r,o,n){for(var a="",h=0;h&lt;i.length;++h)a+=i[h]+"|";return void 0===this.textures[a]&amp;&amp;(this.textures[a]=x3dom.Utils.createTextureCube(e,t,i,s,r,o,n)),this.textures[a]},x3dom.Cache.prototype.getShader=function(e,t){var i=null;if(void 0===this.shaders[t]){switch(t){case x3dom.shader.PICKING:i=new x3dom.shader.PickingShader(e);break;case x3dom.shader.PICKING_24:i=new x3dom.shader.Picking24Shader(e);break;case x3dom.shader.PICKING_ID:i=new x3dom.shader.PickingIdShader(e);break;case x3dom.shader.PICKING_COLOR:i=new x3dom.shader.PickingColorShader(e);break;case x3dom.shader.PICKING_TEXCOORD:i=new x3dom.shader.PickingTexcoordShader(e);break;case x3dom.shader.FRONTGROUND_TEXTURE:i=new x3dom.shader.FrontgroundTextureShader(e);break;case x3dom.shader.BACKGROUND_TEXTURE:i=new x3dom.shader.BackgroundTextureShader(e);break;case x3dom.shader.BACKGROUND_SKYTEXTURE:i=new x3dom.shader.BackgroundSkyTextureShader(e);break;case x3dom.shader.BACKGROUND_CUBETEXTURE:i=new x3dom.shader.BackgroundCubeTextureShader(e);break;case x3dom.shader.SHADOW:i=new x3dom.shader.ShadowShader(e);break;case x3dom.shader.BLUR:i=new x3dom.shader.BlurShader(e);break;case x3dom.shader.DEPTH:break;case x3dom.shader.NORMAL:i=new x3dom.shader.NormalShader(e);break;case x3dom.shader.TEXTURE_REFINEMENT:i=new x3dom.shader.TextureRefinementShader(e)}i?this.shaders[t]=x3dom.Utils.wrapProgram(e,i,t):x3dom.debug.logError("Couldn't create shader: "+t)}return this.shaders[t]},x3dom.Cache.prototype.getDynamicShader=function(e,t,i){var s=x3dom.Utils.generateProperties(t,i),r=s.id;if(void 0===this.shaders[r]){var o=null;o=-1!=s.CSHADER?new x3dom.shader.ComposedShader(e,i):x3dom.caps.MOBILE&amp;&amp;!s.CSSHADER?new x3dom.shader.DynamicMobileShader(e,s):new x3dom.shader.DynamicShader(e,s),this.shaders[r]=x3dom.Utils.wrapProgram(e,o,r)}return this.shaders[r]},x3dom.Cache.prototype.getShaderByProperties=function(e,t,i,s,r){var o=i.id;if(void 0!==s&amp;&amp;null!==s&amp;&amp;(o+=s),void 0!==r&amp;&amp;null!==r&amp;&amp;(o+="S"),void 0===this.shaders[o]){var n=null;if(void 0!==s&amp;&amp;null!==s)n=new x3dom.shader.DynamicShaderPicking(e,i,s);else if(void 0!==r&amp;&amp;null!==r)n=new x3dom.shader.DynamicShadowShader(e,i);else if(-1!=i.CSHADER)n=new x3dom.shader.ComposedShader(e,t);else if(null!=i.KHR_MATERIAL_COMMONS&amp;&amp;0!=i.KHR_MATERIAL_COMMONS)n=new x3dom.shader.KHRMaterialCommonsShader(e,i);else{if(null!=i.EMPTY_SHADER&amp;&amp;0!=i.EMPTY_SHADER)return{shaderID:o};n=x3dom.caps.MOBILE&amp;&amp;!i.CSSHADER?new x3dom.shader.DynamicMobileShader(e,i):new x3dom.shader.DynamicShader(e,i)}this.shaders[o]=x3dom.Utils.wrapProgram(e,n,o)}return this.shaders[o]},x3dom.Cache.prototype.getShadowRenderingShader=function(e,t){for(var i="shadow",s=0;s&lt;t.length;s++)x3dom.isa(t[s],x3dom.nodeTypes.SpotLight)?i+="S":x3dom.isa(t[s],x3dom.nodeTypes.PointLight)?i+="P":i+="D";if(void 0===this.shaders[i]){var r=new x3dom.shader.ShadowRenderingShader(e,t);this.shaders[i]=x3dom.Utils.wrapProgram(e,r,i)}return this.shaders[i]},x3dom.Cache.prototype.Release=function(e){for(var t in this.textures)e.deleteTexture(this.textures[t]);for(var i in this.textures=[],this.shaders){for(var s=this.shaders[i],r=e.getAttachedShaders(s.program),o=0;o&lt;r.length;++o)e.detachShader(s.program,r[o]),e.deleteShader(r[o]);e.deleteProgram(s.program)}this.shaders=[]},x3dom.Texture=function(e,t,i,s){this.gl=e,this.doc=t,this.cache=i,this.node=s,this.samplerName="diffuseMap",this.type=e.TEXTURE_2D,this.format=e.RGBA,this.magFilter=e.LINEAR,this.minFilter=e.LINEAR,this.wrapS=e.REPEAT,this.wrapT=e.REPEAT,this.genMipMaps=!1,this.texture=null,this.ready=!1,this.dashtexture=!1;var r=this.node;if(this.node._x3domTexture=this,x3dom.isa(r,x3dom.nodeTypes.MovieTexture)&amp;&amp;-1!==r._vf.url[0].indexOf("mpd",r._vf.url[0].length-"mpd".length)){this.dashtexture=!0;var o=document.getElementById("AdditionalDashVideoScript");o||((o=document.createElement("script")).setAttribute("type","text/javascript"),o.setAttribute("src",x3dom.Texture.dashVideoScriptFile),o.setAttribute("id","AdditionalDashVideoScript"),o.onload=function(){for(var e;e=x3dom.Texture.loadDashVideos.pop();)x3dom.Texture.textNum++,e.update();o.ready=!0},document.getElementsByTagName("head")[0].appendChild(o)),!0===o.ready?(x3dom.Texture.textNum++,this.update()):x3dom.Texture.loadDashVideos.push(this)}this.dashtexture||this.update()},x3dom.Texture.dashVideoScriptFile="dash.all.js",x3dom.Texture.loadDashVideos=[],x3dom.Texture.textNum=0,x3dom.Texture.clampFontSize=!1,x3dom.Texture.minFontQuality=.5,x3dom.Texture.maxFontQuality=10,x3dom.Texture.prototype.update=function(){x3dom.isa(this.node,x3dom.nodeTypes.Text)?this.updateText():this.updateTexture()},x3dom.Texture.prototype.setPixel=function(e,t,i,s){var r=this.gl,o=new Uint8Array(i);r.bindTexture(this.type,this.texture),r.pixelStorei(r.UNPACK_ALIGNMENT,1),r.texSubImage2D(this.type,0,e,t,1,1,this.format,r.UNSIGNED_BYTE,o),r.bindTexture(this.type,null),s&amp;&amp;(this.doc.needRender=!0)},x3dom.Texture.prototype.updateTexture=function(){var e=this.gl,t=this.doc,i=this.node;if(this.samplerName=i._type,x3dom.isa(i,x3dom.nodeTypes.X3DEnvironmentTextureNode)?this.type=e.TEXTURE_CUBE_MAP:this.type=e.TEXTURE_2D,x3dom.isa(i,x3dom.nodeTypes.PixelTexture))switch(i._vf.image.comp){case 1:this.format=e.LUMINANCE;break;case 2:this.format=e.LUMINANCE_ALPHA;break;case 3:this.format=e.RGB;break;case 4:this.format=e.RGBA}else this.format=e.RGBA;if(null!==i._cf.textureProperties.node){var s=i._cf.textureProperties.node;this.wrapS=x3dom.Utils.boundaryModesDic(e,s._vf.boundaryModeS),this.wrapT=x3dom.Utils.boundaryModesDic(e,s._vf.boundaryModeT),this.minFilter=x3dom.Utils.minFilterDic(e,s._vf.minificationFilter),this.magFilter=x3dom.Utils.magFilterDic(e,s._vf.magnificationFilter),!0===s._vf.generateMipMaps?(this.genMipMaps=!0,this.minFilter==e.NEAREST?this.minFilter=e.NEAREST_MIPMAP_NEAREST:this.minFilter==e.LINEAR&amp;&amp;(this.minFilter=e.LINEAR_MIPMAP_LINEAR),this.texture&amp;&amp;(this.texture.ready||this.texture.textureCubeReady)&amp;&amp;(e.bindTexture(this.type,this.texture),e.generateMipmap(this.type),e.bindTexture(this.type,null))):(this.genMipMaps=!1,this.minFilter==e.LINEAR_MIPMAP_LINEAR||this.minFilter==e.LINEAR_MIPMAP_NEAREST?this.minFilter=e.LINEAR:this.minFilter!=e.NEAREST_MIPMAP_LINEAR&amp;&amp;this.minFilter!=e.NEAREST_MIPMAP_NEAREST||(this.minFilter=e.NEAREST))}else 0==i._vf.repeatS?this.wrapS=e.CLAMP_TO_EDGE:this.wrapS=e.REPEAT,0==i._vf.repeatT?this.wrapT=e.CLAMP_TO_EDGE:this.wrapT=e.REPEAT,"displacementMap"!=this.samplerName&amp;&amp;"multiDiffuseAlphaMap"!=this.samplerName&amp;&amp;"multiVisibilityMap"!=this.samplerName&amp;&amp;"multiEmissiveAmbientMap"!=this.samplerName&amp;&amp;"multiSpecularShininessMap"!=this.samplerName||(this.wrapS=e.CLAMP_TO_EDGE,this.wrapT=e.CLAMP_TO_EDGE,this.minFilter=e.NEAREST,this.magFilter=e.NEAREST);var r=i._video&amp;&amp;!0===i._needPerFrameUpdate;if(i._isCanvas&amp;&amp;i._canvas)null==this.texture&amp;&amp;(this.texture=e.createTexture()),this.texture.width=i._canvas.width,this.texture.height=i._canvas.height,this.texture.ready=!0,e.bindTexture(this.type,this.texture),e.texImage2D(this.type,0,this.format,this.format,e.UNSIGNED_BYTE,i._canvas),this.genMipMaps&amp;&amp;e.generateMipmap(this.type),e.bindTexture(this.type,null);else if(x3dom.isa(i,x3dom.nodeTypes.RenderedTexture))i._webgl&amp;&amp;i._webgl.fbo?i._webgl.fbo.dtex&amp;&amp;i._vf.depthMap?this.texture=i._webgl.fbo.dtex:this.texture=i._webgl.fbo.tex:(this.texture=null,x3dom.debug.logError("Try updating RenderedTexture without FBO initialized!")),this.texture&amp;&amp;(this.texture.ready=!0);else if(x3dom.isa(i,x3dom.nodeTypes.PixelTexture)){null==this.texture&amp;&amp;(this.node._DEF?this.texture=this.cache.getTexture2DByDEF(e,this.node._nameSpace,this.node._DEF):this.texture=e.createTexture()),this.texture.width=i._vf.image.width,this.texture.height=i._vf.image.height,this.texture.ready=!0;var o=i._vf.image.array,n=i._vf.image.width*i._vf.image.height*i._vf.image.comp;if(o.length&lt;n)for(o=i._vf.image.toGL();o.length&lt;n;)o.push(0);var a=new Uint8Array(o);e.bindTexture(this.type,this.texture),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.texImage2D(this.type,0,this.format,i._vf.image.width,i._vf.image.height,0,this.format,e.UNSIGNED_BYTE,a),this.genMipMaps&amp;&amp;e.generateMipmap(this.type),e.bindTexture(this.type,null)}else if(x3dom.isa(i,x3dom.nodeTypes.MovieTexture)||r){var h=this,d=document.getElementsByTagName("body")[0];if(null==this.texture&amp;&amp;(this.texture=e.createTexture()),this.dashtexture){var l=document.createElement("div");l.setAttribute("class","dash-video-player"+x3dom.Texture.textNum),i._video=document.createElement("video"),i._video.setAttribute("preload","auto"),i._video.setAttribute("muted","muted");var u=document.createElement("script");u.setAttribute("type","text/javascript"),u.innerHTML='startDashVideo("'+i._vf.url[0]+'",".dash-video-player'+x3dom.Texture.textNum+' video")',l.appendChild(u),l.appendChild(i._video),d.appendChild(l),i._video.style.visibility="hidden",i._video.style.display="none"}else{r||(i._video=document.createElement("video"),i._video.setAttribute("preload","auto"),i._video.setAttribute("muted","muted"),d.appendChild(i._video),i._video.style.visibility="hidden",i._video.style.display="none");for(var f=0;f&lt;i._vf.url.length;f++){var c=i._nameSpace.getURL(i._vf.url[f]);x3dom.debug.logInfo("Adding video file: "+c);var m=document.createElement("source");m.setAttribute("src",c),i._video.appendChild(m)}}var _=function(){e.bindTexture(h.type,h.texture),e.texImage2D(h.type,0,h.format,h.format,e.UNSIGNED_BYTE,i._video),h.genMipMaps&amp;&amp;e.generateMipmap(h.type),e.bindTexture(h.type,null),h.texture.ready=!0,t.needRender=!0};i._video.addEventListener("canplaythrough",(function(){i._video.play(),i._intervalID=setInterval(_,16)}),!0),i._video.addEventListener("ended",(function(){clearInterval(i._intervalID),!0===i._vf.loop&amp;&amp;(i._video.play(),i._intervalID=setInterval(_,16))}),!0)}else x3dom.isa(i,x3dom.nodeTypes.X3DEnvironmentTextureNode)?this.texture=this.cache.getTextureCube(e,t,i.getTexUrl(),!1,i._vf.crossOrigin,i._vf.scale,this.genMipMaps):this.texture=this.cache.getTexture2D(e,t,i._nameSpace.getURL(i._vf.url[0]),!1,i._vf.crossOrigin,i._vf.scale,this.genMipMaps)},x3dom.Texture.prototype.updateText=function(){var e=this.gl;this.wrapS=e.CLAMP_TO_EDGE,this.wrapT=e.CLAMP_TO_EDGE,this.type=e.TEXTURE_2D,this.format=e.RGBA,this.magFilter=e.LINEAR,this.minFilter=e.LINEAR;var t,i,s=this.node._cf.fontStyle.node,r="serif",o="normal",n="left",a=1,h=1,d=2,l="FIRST";if(null!==s){var u=s._vf.family.toString();switch(u=(u=u.trim().replace(/\'/g,"").replace(/\,/," ")).split(" "),r=Array.map(u,(function(e){return"SANS"==e?"sans-serif":"SERIF"==e?"serif":"TYPEWRITER"==e?"monospace":""+e})).join(","),(o=s._vf.style.toString().replace(/\'/g,"")).toUpperCase()){case"PLAIN":o="normal";break;case"BOLD":o="bold";break;case"ITALIC":o="italic";break;case"BOLDITALIC":o="italic bold";break;default:o="normal"}var f=s._vf.leftToRight?"ltr":"rtl",c=s._vf.topToBottom;switch((n=s._vf.justify[0].toString().replace(/\'/g,"")).toUpperCase()){case"BEGIN":n="left";break;case"END":n="right";break;case"FIRST":n="left";break;case"MIDDLE":n="center";break;default:n="left"}if(void 0===s._vf.justify[1])l="FIRST";else switch((l=s._vf.justify[1].toString().replace(/\'/g,"")).toUpperCase()){case"BEGIN":l="BEGIN";break;case"FIRST":l="FIRST";break;case"MIDDLE":l="MIDDLE";break;case"END":l="END";break;default:l="FIRST"}a=s._vf.size,h=s._vf.spacing,s._vf.horizontal,s._vf.language,d=s._vf.quality,d=Math.max(x3dom.Texture.minFontQuality,d),d=Math.min(x3dom.Texture.maxFontQuality,d),a&lt;.1&amp;&amp;(a=.1),x3dom.Texture.clampFontSize&amp;&amp;a&gt;2.3&amp;&amp;(a=2.3)}var m=this.node._vf.string,_=this.node._vf.maxExtent,p=[],x=document.createElement("canvas");x.dir=f;var g=42*a,v=n;document.body.appendChild(x);var y=x.getContext("2d");y.font=o+" "+g+"px "+r;var b,T,S,w,M=0;for(S=0;S&lt;m.length;S++)(b=y.measureText(m[S]).width)&gt;M&amp;&amp;(M=b),T=0|this.node._vf.length[S],_&gt;0&amp;&amp;(T&gt;_||0==T)&amp;&amp;(T=_),p[S]=T&lt;=0?b:42*T;var E=.1*g,F=M,C=g*h*m.length+E;t=0,i=0;var A=0,R=0,I="top";switch(n){case"center":A=-F/2,t=F/2;break;case"left":A="ltr"==f?0:-F,t=0;break;case"right":A="ltr"==f?-F:0,t=F}switch(l){case"MIDDLE":R=C/2;break;case"BEGIN":R=c?0:C-E,I=c?"top":"bottom",i=c?0:g;break;case"FIRST":R=c?g:C-E,I=c?"alphabetic":"bottom",i=g;break;case"END":R=c?C-E:0,I=c?"bottom":"top",i=c?g:0}var N=F*(1/42),P=C*(1/42);for(A*=1/42,R*=1/42,x.width=F*d,x.height=C*d,x.dir=f,y.scale(d,d),y.fillStyle="rgba(0,0,0,0)",y.fillRect(0,0,y.canvas.width,y.canvas.height),y.fillStyle="white",y.textBaseline=I,y.font=o+" "+g+"px "+r,y.textAlign=v,S=0;S&lt;m.length;S++)w=c?S:m.length-1-S,y.fillText(m[w],t,i,p[w]),i+=g*h;null===this.texture&amp;&amp;(this.texture=e.createTexture()),e.bindTexture(this.type,this.texture),e.texImage2D(this.type,0,this.format,this.format,e.UNSIGNED_BYTE,x),e.bindTexture(this.type,null),document.body.removeChild(x),this.node._mesh._positions[0]=[0+A,-P+R,0,N+A,-P+R,0,N+A,0+R,0,0+A,0+R,0],this.node.invalidateVolume(),Array.forEach(this.node._parentNodes,(function(e){e.setAllDirty()}))},x3dom.X3DDocument=function(e,t,i){this.canvas=e,this.ctx=t,this.properties=i,this.needRender=!0,this._x3dElem=null,this._scene=null,this._viewarea=null,this.downloadCount=0,this.previousDownloadCount=0,this._nodeBag={timer:[],lights:[],clipPlanes:[],followers:[],trans:[],renderTextures:[],viewarea:[],affectedPointingSensors:[]},this.onload=function(){},this.onerror=function(){}},x3dom.X3DDocument.prototype.load=function(e,t){var i={},s=[e],r=this;!function o(){if(0===s.length)return r._setup(i[e],i,t),void r.onload();var n=s.shift();!x3dom.isX3DElement(n)||"x3d"!==n.localName.toLowerCase()&amp;&amp;"websg"!==n.localName.toLowerCase()||(i[n]=n,r._x3dElem=n,o())}()},x3dom.findScene=function(e){for(var t=[],i=0;i&lt;e.childNodes.length;i++){var s=e.childNodes[i];s&amp;&amp;s.localName&amp;&amp;"scene"===s.localName.toLowerCase()&amp;&amp;t.push(s)}return t.length&gt;1?(x3dom.debug.logError("X3D element has more than one Scene child (has "+e.childNodes.length+")."),null):t[0]},x3dom.X3DDocument.prototype._setup=function(e,t,i){var s=this;function r(e,t){for(var i=0,s=e.length;i&lt;s;i++)if(e[i]===t){e.splice(i,1);break}}function o(e){for(var t=e.childNodes,i=0,n=t.length;i&lt;n;i++)o(t[i]);if(e._x3domNode){var a=e._x3domNode,h=a._nameSpace;if(x3dom.isa(a,x3dom.nodeTypes.X3DShapeNode))a._cleanupGLObjects&amp;&amp;a._cleanupGLObjects(!0),x3dom.nodeTypes.Shape.idMap.nodeID[a._objectID]&amp;&amp;delete x3dom.nodeTypes.Shape.idMap.nodeID[a._objectID];else if(x3dom.isa(a,x3dom.nodeTypes.TimeSensor))r(s._nodeBag.timer,a);else if(x3dom.isa(a,x3dom.nodeTypes.X3DLightNode))r(s._nodeBag.lights,a);else if(x3dom.isa(a,x3dom.nodeTypes.X3DFollowerNode))r(s._nodeBag.followers,a);else if(x3dom.isa(a,x3dom.nodeTypes.X3DTransformNode))r(s._nodeBag.trans,a);else if(x3dom.isa(a,x3dom.nodeTypes.RenderedTexture))r(s._nodeBag.renderTextures,a),a._cleanupGLObjects&amp;&amp;a._cleanupGLObjects();else if(x3dom.isa(a,x3dom.nodeTypes.X3DPointingDeviceSensorNode))r(s._nodeBag.affectedPointingSensors,a);else if(x3dom.isa(a,x3dom.nodeTypes.Texture))a.shutdown();else if(x3dom.isa(a,x3dom.nodeTypes.AudioClip))a.shutdown();else if(x3dom.isa(a,x3dom.nodeTypes.X3DBindableNode)){var d=a._stack;d&amp;&amp;(a.bind(!1),r(d._bindBag,a)),a._cleanupGLObjects&amp;&amp;a._cleanupGLObjects()}else x3dom.isa(a,x3dom.nodeTypes.Scene)&amp;&amp;a._webgl&amp;&amp;(a._webgl=null);!h||e.getAttribute("use")||e.getAttribute("USE")||h.removeNode(a._DEF),a._xmlNode=null,delete e._x3domNode}}var n=function(e){if("_x3domNode"in e.target){e.target._x3domNode.updateField(e.attrName,e.newValue),s.needRender=!0}},a=function(e){var t=e.target;if(t)if("_x3domNode"in t.parentNode&amp;&amp;"_x3domNode"in t){var i=t.parentNode._x3domNode,r=t._x3domNode;i&amp;&amp;r&amp;&amp;(i.removeChild(r),i.nodeChanged(),o(t),s._viewarea&amp;&amp;s._viewarea._scene&amp;&amp;(s._viewarea._scene.nodeChanged(),s._viewarea._scene.updateVolume(),s.needRender=!0))}else if(t.localName&amp;&amp;"ROUTE"==t.localName.toUpperCase()&amp;&amp;t._nodeNameSpace){var n=t._nodeNameSpace.defMap[t.getAttribute("fromNode")],a=t._nodeNameSpace.defMap[t.getAttribute("toNode")];n&amp;&amp;a&amp;&amp;n.removeRoute(t.getAttribute("fromField"),a,t.getAttribute("toField"))}else if(t.localName&amp;&amp;"X3D"==t.localName.toUpperCase()){var h=t.runtime;if(h&amp;&amp;h.canvas&amp;&amp;h.canvas.doc&amp;&amp;h.canvas.doc._scene){o(h.canvas.doc._scene._xmlNode);for(var d=0;d&lt;x3dom.canvases.length;d++)if(x3dom.canvases[d]===h.canvas){x3dom.canvases[d].doc.shutdown(x3dom.canvases[d].gl),x3dom.canvases.splice(d,1);break}h.canvas.doc._scene=null,h.canvas.doc._viewarea=null,h.canvas.doc=null,h.canvas=null,h=null,t.context=null,t.runtime=null}}},h=function(e){var t=e.target,i=t.parentNode;if("_x3domNode"in i)if(i.tagName&amp;&amp;"inline"==i.tagName.toLowerCase()||"multipart"==i.tagName.toLowerCase());else{var r=i._x3domNode;if(r&amp;&amp;r._nameSpace&amp;&amp;t instanceof Element){x3dom.caps.DOMNodeInsertedEvent_perSubtree&amp;&amp;o(t);var n=r._nameSpace.setupTree(t);r.addChild(n,t.getAttribute("containerField")),r.nodeChanged();var a=i.parentNode;a&amp;&amp;a._x3domNode&amp;&amp;a._x3domNode.nodeChanged(),s._viewarea&amp;&amp;s._viewarea._scene&amp;&amp;(s._viewarea._scene.nodeChanged(),s._viewarea._scene.updateVolume(),s.needRender=!0)}else x3dom.debug.logWarning("No _nameSpace in onNodeInserted")}};e.addEventListener("DOMNodeRemoved",a,!0),e.addEventListener("DOMNodeInserted",h,!0),!0===x3dom.userAgentFeature.supportsDOMAttrModified&amp;&amp;e.addEventListener("DOMAttrModified",n,!0);var d=x3dom.findScene(e);this._bindableBag=new x3dom.BindableBag(this);var l=new x3dom.NodeNameSpace("scene",s).setupTree(d);this._scene=l,this._bindableBag.setRefNode(l),this._viewarea=new x3dom.Viewarea(this,l),this._viewarea._width=this.canvas.width,this._viewarea._height=this.canvas.height},x3dom.X3DDocument.prototype.advanceTime=function(e){var t=0;if(this._nodeBag.timer.length)for(t=0;t&lt;this._nodeBag.timer.length;t++)this.needRender|=this._nodeBag.timer[t].tick(e);if(this._nodeBag.followers.length)for(t=0;t&lt;this._nodeBag.followers.length;t++)this.needRender|=this._nodeBag.followers[t].tick(e);if(this._nodeBag.trans.length)for(t=0;t&lt;this._nodeBag.trans.length;t++)this.needRender|=this._nodeBag.trans[t].tick(e);if(this._nodeBag.viewarea.length)for(t=0;t&lt;this._nodeBag.viewarea.length;t++)this.needRender|=this._nodeBag.viewarea[t].tick(e)},x3dom.X3DDocument.prototype.render=function(e){e&amp;&amp;this._viewarea&amp;&amp;e.renderScene(this._viewarea)},x3dom.X3DDocument.prototype.onPick=function(e,t,i){e&amp;&amp;this._viewarea&amp;&amp;e.pickValue(this._viewarea,t,i,1)},x3dom.X3DDocument.prototype.onPickRect=function(e,t,i,s,r){return e&amp;&amp;this._viewarea?e.pickRect(this._viewarea,t,i,s,r):[]},x3dom.X3DDocument.prototype.onMove=function(e,t,i,s){e&amp;&amp;this._viewarea&amp;&amp;(this._viewarea._scene._vf.doPickPass&amp;&amp;e.pickValue(this._viewarea,t,i,s),this._viewarea.onMove(t,i,s))},x3dom.X3DDocument.prototype.onMoveView=function(e,t,i,s,r){e&amp;&amp;this._viewarea&amp;&amp;this._scene.getNavigationInfo()._impl.onTouchDrag(this._viewarea,t,i,s,r)},x3dom.X3DDocument.prototype.onDrag=function(e,t,i,s){e&amp;&amp;this._viewarea&amp;&amp;(this._viewarea._scene._vf.doPickPass&amp;&amp;e.pickValue(this._viewarea,t,i,s),this._viewarea.onDrag(t,i,s))},x3dom.X3DDocument.prototype.onWheel=function(e,t,i,s){e&amp;&amp;this._viewarea&amp;&amp;(this._viewarea._scene._vf.doPickPass&amp;&amp;e.pickValue(this._viewarea,t,s,0),this._viewarea.onDrag(t,i,2))},x3dom.X3DDocument.prototype.onMousePress=function(e,t,i,s){e&amp;&amp;this._viewarea&amp;&amp;(this._viewarea._scene.updateVolume(),e.pickValue(this._viewarea,t,i,s),this._viewarea.onMousePress(t,i,s))},x3dom.X3DDocument.prototype.onMouseRelease=function(e,t,i,s,r){if(e&amp;&amp;this._viewarea){var o=r&lt;&lt;8|s;e.pickValue(this._viewarea,t,i,o),this._viewarea.onMouseRelease(t,i,s,r)}},x3dom.X3DDocument.prototype.onMouseOver=function(e,t,i,s){e&amp;&amp;this._viewarea&amp;&amp;(e.pickValue(this._viewarea,t,i,s),this._viewarea.onMouseOver(t,i,s))},x3dom.X3DDocument.prototype.onMouseOut=function(e,t,i,s){e&amp;&amp;this._viewarea&amp;&amp;(e.pickValue(this._viewarea,t,i,s),this._viewarea.onMouseOut(t,i,s))},x3dom.X3DDocument.prototype.onDoubleClick=function(e,t,i){e&amp;&amp;this._viewarea&amp;&amp;this._viewarea.onDoubleClick(t,i)},x3dom.X3DDocument.prototype.onKeyDown=function(e){switch(e){case 37:this._viewarea.strafeLeft();break;case 38:this._viewarea.moveFwd();break;case 39:this._viewarea.strafeRight();break;case 40:this._viewarea.moveBwd()}},x3dom.X3DDocument.prototype.onKeyUp=function(e){var t=null;switch(e){case 13:x3dom.toggleFullScreen();break;case 33:(t=this._scene.getViewpoint()._stack)?t.switchTo("next"):x3dom.debug.logError("No valid ViewBindable stack.");break;case 34:(t=this._scene.getViewpoint()._stack)?t.switchTo("prev"):x3dom.debug.logError("No valid ViewBindable stack.")}},x3dom.X3DDocument.prototype.onKeyPress=function(e){var t=this._scene.getNavigationInfo(),i=this._scene.getEnvironment();switch(e){case 32:var s=this.canvas.parent.stateViewer;s&amp;&amp;s.display(),x3dom.debug.logInfo("a: show all | d: show helper buffers | s: small feature culling | t: light view | m: toggle render mode | c: frustum culling | p: intersect type | r: reset view | \ne: examine mode | f: fly mode | y: freefly mode | w: walk mode | h: helicopter mode | l: lookAt mode | o: lookaround | g: game mode | n: turntable | u: upright position | \nv: print viewpoint info | pageUp: next view | pageDown: prev. view | +: increase speed | -: decrease speed ");break;case 43:t._vf.speed=2*t._vf.speed,x3dom.debug.logInfo("Changed navigation speed to "+t._vf.speed);break;case 45:t._vf.speed=.5*t._vf.speed,x3dom.debug.logInfo("Changed navigation speed to "+t._vf.speed);break;case 51:x3dom.nodeTypes.PopGeometry.ErrorToleranceFactor+=.5,x3dom.debug.logInfo("Changed POP error tolerance to "+x3dom.nodeTypes.PopGeometry.ErrorToleranceFactor);break;case 52:x3dom.nodeTypes.PopGeometry.ErrorToleranceFactor-=.5,x3dom.debug.logInfo("Changed POP error tolerance to "+x3dom.nodeTypes.PopGeometry.ErrorToleranceFactor);break;case 54:t._vf.typeParams[1]+=1,t._heliUpdated=!1,x3dom.debug.logInfo("Changed helicopter height to "+t._vf.typeParams[1]);break;case 55:t._vf.typeParams[1]-=1,t._heliUpdated=!1,x3dom.debug.logInfo("Changed helicopter height to "+t._vf.typeParams[1]);break;case 56:t._vf.typeParams[0]-=.02,t._heliUpdated=!1,x3dom.debug.logInfo("Changed helicopter angle to "+t._vf.typeParams[0]);break;case 57:t._vf.typeParams[0]+=.02,t._heliUpdated=!1,x3dom.debug.logInfo("Changed helicopter angle to "+t._vf.typeParams[0]);break;case 97:this._viewarea.showAll();break;case 99:i._vf.frustumCulling=!i._vf.frustumCulling,x3dom.debug.logInfo("Viewfrustum culling "+(i._vf.frustumCulling?"on":"off"));break;case 100:void 0===this._viewarea._visDbgBuf&amp;&amp;(this._viewarea._visDbgBuf="true"===this._x3dElem.getAttribute("showLog")),this._viewarea._visDbgBuf=!this._viewarea._visDbgBuf,x3dom.debug.logContainer.style.display=1==this._viewarea._visDbgBuf?"block":"none";break;case 101:t.setType("examine",this._viewarea);break;case 102:t.setType("fly",this._viewarea);break;case 103:t.setType("game",this._viewarea);break;case 104:t.setType("helicopter",this._viewarea);break;case 105:this._viewarea.fit(this._scene._lastMin,this._scene._lastMax);break;case 108:t.setType("lookat",this._viewarea);break;case 109:this._viewarea._points=++this._viewarea._points%2;break;case 110:t.setType("turntable",this._viewarea);break;case 111:t.setType("lookaround",this._viewarea);break;case 112:switch(this._scene._vf.pickMode.toLowerCase()){case"idbuf":this._scene._vf.pickMode="color";break;case"color":this._scene._vf.pickMode="texCoord";break;case"texcoord":this._scene._vf.pickMode="box";break;default:this._scene._vf.pickMode="idBuf"}x3dom.debug.logInfo("Switch pickMode to '"+this._scene._vf.pickMode+"'.");break;case 114:this._viewarea.resetView();break;case 115:i._vf.smallFeatureCulling=!i._vf.smallFeatureCulling,x3dom.debug.logInfo("Small feature culling "+(i._vf.smallFeatureCulling?"on":"off"));break;case 116:this._nodeBag.lights.length&gt;0&amp;&amp;this._viewarea.animateTo(this._viewarea.getLightMatrix()[0],this._scene.getViewpoint());break;case 117:this._viewarea.uprightView();break;case 118:var r=this;!function(){var e=r._viewarea._scene.getViewpoint(),t=r._viewarea.getViewMatrix().inverse(),i=new x3dom.fields.Quaternion(0,0,1,0);i.setValue(t);var s=i.toAxisAngle(),o=t.e3();x3dom.debug.logInfo('\n&amp;lt;Viewpoint position="'+o.x.toFixed(5)+" "+o.y.toFixed(5)+" "+o.z.toFixed(5)+'" orientation="'+s[0].x.toFixed(5)+" "+s[0].y.toFixed(5)+" "+s[0].z.toFixed(5)+" "+s[1].toFixed(5)+'" \n\tzNear="'+e.getNear().toFixed(5)+'" zFar="'+e.getFar().toFixed(5)+'" description="'+e._vf.description+'"&amp;gt;&amp;lt;/Viewpoint&amp;gt;')}();break;case 119:t.setType("walk",this._viewarea);break;case 121:t.setType("freefly",this._viewarea)}},x3dom.X3DDocument.prototype.shutdown=function(e){e&amp;&amp;e.shutdown(this._viewarea)},x3dom.MatrixMixer=function(e,t){this.beginTime=e||0,this.endTime=t||1,this.isMixing=!1,this._beginMat=x3dom.fields.SFMatrix4f.identity(),this._beginInvMat=x3dom.fields.SFMatrix4f.identity(),this._beginLogMat=x3dom.fields.SFMatrix4f.identity(),this._endMat=x3dom.fields.SFMatrix4f.identity(),this._endLogMat=x3dom.fields.SFMatrix4f.identity(),this._beginRot=new x3dom.fields.Quaternion,this._endRot=new x3dom.fields.Quaternion,this._beginPos=new x3dom.fields.SFVec3f,this._endPos=new x3dom.fields.SFVec3f,this._result=x3dom.fields.SFMatrix4f.identity(),this._useQuaternion=!1},x3dom.MatrixMixer.prototype._calcFraction=function(e){var t=(e-this.beginTime)/(this.endTime-this.beginTime);return(Math.sin(t*Math.PI-Math.PI/2)+1)/2},x3dom.MatrixMixer.prototype._isValid=function(){var e=this._beginMat.inverse().mult(this._endMat).getEulerAngles();return Math.abs(e[0])!=Math.PI&amp;&amp;Math.abs(e[1])!=Math.PI&amp;&amp;Math.abs(e[2])!=Math.PI},x3dom.MatrixMixer.prototype._prepareQuaternionAnimation=function(){this._beginRot.setValue(this._beginMat),this._endRot.setValue(this._endMat),this._beginPos=this._beginMat.e3(),this._endPos=this._endMat.e3(),this._useQuaternion=!0},x3dom.MatrixMixer.prototype._reset=function(){this.beginTime=0,this.endTime=0,this._useQuaternion=!1,this.isMixing=!1},x3dom.MatrixMixer.prototype.isActive=function(){return this.beginTime&gt;0},x3dom.MatrixMixer.prototype.setBeginMatrix=function(e){this._beginMat.setValues(e),this._beginInvMat=e.inverse(),this._beginLogMat=x3dom.fields.SFMatrix4f.zeroMatrix()},x3dom.MatrixMixer.prototype.setEndMatrix=function(e){this._endMat.setValues(e),this._isValid()||this._prepareQuaternionAnimation(),this._endLogMat=this._endMat.mult(this._beginInvMat).log(),this._logDiffMat=this._endLogMat.addScaled(this._beginLogMat,-1)},x3dom.MatrixMixer.prototype._mixQuaternion=function(e){var t=this._beginRot.slerp(this._endRot,e),i=this._beginPos.addScaled(this._endPos.subtract(this._beginPos),e);return this._result.setRotate(t),this._result.setTranslate(i),this._result.copy()},x3dom.MatrixMixer.prototype._mixMatrix=function(e){return this._logDiffMat.multiply(e).add(this._beginLogMat).exp().mult(this._beginMat)},x3dom.MatrixMixer.prototype.mix=function(e){if(e&lt;=this.beginTime)return this._beginMat;if(e&gt;=this.endTime)return this._reset(),this._endMat;this.isMixing=!0;var t=this._calcFraction(e);return this._useQuaternion?this._mixQuaternion(t):this._mixMatrix(t)},x3dom.InputTypes={NAVIGATION:1,INTERACTION:2},x3dom.Viewarea=function(e,t){this._doc=e,this._scene=t,e._nodeBag.viewarea.push(this),this._pickingInfo={pickPos:new x3dom.fields.SFVec3f(0,0,0),pickNorm:new x3dom.fields.SFVec3f(0,0,1),pickObj:null,firstObj:null,lastObj:null,lastClickObj:null,shadowObjectId:-1},this._currentInputType=x3dom.InputTypes.NAVIGATION,this._rotMat=x3dom.fields.SFMatrix4f.identity(),this._transMat=x3dom.fields.SFMatrix4f.identity(),this._movement=new x3dom.fields.SFVec3f(0,0,0),this._needNavigationMatrixUpdate=!0,this._deltaT=0,this._flyMat=null,this._pitch=0,this._yaw=0,this._eyePos=new x3dom.fields.SFVec3f(0,0,0),this._width=400,this._height=300,this._dx=0,this._dy=0,this._lastX=-1,this._lastY=-1,this._pressX=-1,this._pressY=-1,this._lastButton=0,this._points=0,this._numRenderedNodes=0,this._pick=new x3dom.fields.SFVec3f(0,0,0),this._pickNorm=new x3dom.fields.SFVec3f(0,0,1),this._isAnimating=!1,this._isMoving=!1,this._lastTS=0,this._mixer=new x3dom.MatrixMixer,this._interpolator=new x3dom.FieldInterpolator,this.arc=null},x3dom.Viewarea.prototype.tick=function(e){if(this._scene.getEnvironment()._vf.enableARC&amp;&amp;null==this.arc&amp;&amp;(this.arc=new x3dom.arc.AdaptiveRenderControl(this._scene)),this._mixer.isActive()){var t=this._mixer.mix(e);this._scene.getViewpoint().setView(t)}if(this._interpolator.isActive()){var i=this._interpolator.interpolate(e);this._scene.getViewpoint().setZoom(i)}var s=this.navigateTo(e),r=this._isAnimating;return this._lastTS=e,this._isAnimating=this._mixer.isMixing||this._interpolator.isInterpolating||s,null!=this.arc&amp;&amp;this.arc.update(this.isMovingOrAnimating()?1:0,this._doc._x3dElem.runtime.getFPS()),this._isAnimating||r},x3dom.Viewarea.prototype.isMoving=function(){return this._isMoving},x3dom.Viewarea.prototype.isAnimating=function(){return this._isAnimating},x3dom.Viewarea.prototype.isMovingOrAnimating=function(){return this._isMoving||this._isAnimating},x3dom.Viewarea.prototype.navigateTo=function(e){return this._scene.getNavigationInfo()._impl.navigateTo(this,e)},x3dom.Viewarea.prototype.moveFwd=function(){this._scene.getNavigationInfo()._impl.moveForward(this)},x3dom.Viewarea.prototype.moveBwd=function(){this._scene.getNavigationInfo()._impl.moveBackwards(this)},x3dom.Viewarea.prototype.strafeRight=function(){this._scene.getNavigationInfo()._impl.strafeRight(this)},x3dom.Viewarea.prototype.strafeLeft=function(){this._scene.getNavigationInfo()._impl.strafeLeft(this)},x3dom.Viewarea.prototype.animateTo=function(e,t,i){this._scene.getNavigationInfo()._impl.animateTo(this,e,t,i)},x3dom.Viewarea.prototype.orthoAnimateTo=function(e,t,i){this._scene.getNavigationInfo()._impl.orthoAnimateTo(this,e,t,i)},x3dom.Viewarea.prototype.zoom=function(e){this._scene.getNavigationInfo()._impl.zoom(this,e)},x3dom.Viewarea.prototype.getLights=function(){for(var e=[],t=0;t&lt;this._doc._nodeBag.lights.length;t++)1==this._doc._nodeBag.lights[t]._vf.on&amp;&amp;e.push(this._doc._nodeBag.lights[t]);return e},x3dom.Viewarea.prototype.getLightsShadow=function(){for(var e=this._doc._nodeBag.lights,t=0;t&lt;e.length;t++)if(e[t]._vf.shadowIntensity&gt;0)return!0;return!1},x3dom.Viewarea.prototype.updateSpecialNavigation=function(e,t){var i=this._scene.getNavigationInfo();if("helicopter"==i.getType()&amp;&amp;!i._heliUpdated){var s=i.getTypeParams(),r=s[0],o=e.getViewMatrix().mult(t.inverse()).inverse();this._from=o.e3(),this._at=this._from.subtract(o.e2()),this._up=new x3dom.fields.SFVec3f(0,1,0),this._from.y=s[1],this._at.y=this._from.y;var n=o.e0(),a=x3dom.fields.Quaternion.axisAngle(n,r).toMatrix(),h=x3dom.fields.SFMatrix4f.translation(this._from);h=h.mult(a),a=x3dom.fields.SFMatrix4f.translation(this._from.negate()),h=h.mult(a),this._at=h.multMatrixPnt(this._at),this._flyMat=x3dom.fields.SFMatrix4f.lookAt(this._from,this._at,this._up),this._scene.getViewpoint().setView(this._flyMat.inverse()),i._heliUpdated=!0}},x3dom.Viewarea.prototype.getViewpointMatrix=function(){var e=this._scene.getViewpoint(),t=e.getCurrentTransform();return this.updateSpecialNavigation(e,t),e.getViewMatrix().mult(t.inverse())},x3dom.Viewarea.prototype.getViewMatrix=function(){return this.getViewpointMatrix().mult(this._transMat).mult(this._rotMat)},x3dom.Viewarea.prototype.getLightMatrix=function(){var e,t=this._doc._nodeBag.lights,i=t.length;if(i&gt;0){var s=this._scene.getVolume();if(s.isValid()){var r=x3dom.fields.SFVec3f.MAX(),o=x3dom.fields.SFVec3f.MIN();s.getBounds(r,o);var n=[],a=this._scene.getViewpoint().getFieldOfView(),h=o.subtract(r),d=h.y/2/Math.tan(a/2)+h.z/2,l=h.x/2/Math.tan(a/2)+h.z/2;for(h=r.add(h.multiply(.5)),e=0;e&lt;i;e++){if(x3dom.isa(t[e],x3dom.nodeTypes.PointLight)){var u=t[e].getCurrentTransform().multMatrixPnt(t[e]._vf.location);h=h.subtract(u).normalize()}else{var f=t[e].getCurrentTransform().multMatrixVec(t[e]._vf.direction);f=f.normalize().negate(),h=h.add(f.multiply(1.2*(d&gt;l?d:l)))}n[e]=t[e].getViewMatrix(h)}return n}}return[this.getViewMatrix()]},x3dom.Viewarea.prototype.getWCtoLCMatrix=function(e){var t,i=this.getProjectionMatrix();return t=0===arguments.length?this.getLightMatrix()[0]:e,i.mult(t)},x3dom.Viewarea.prototype.getWCtoLCMatricesPointLight=function(e,t,i){var s=t._vf.zNear,r=t._vf.zFar,o=this.getLightProjectionMatrix(e,s,r,!1,i);o._00=1,o._11=1;var n,a=[];a[0]=o.mult(e);for(var h=1;h&lt;=3;h++)n=x3dom.fields.SFMatrix4f.rotationY(h*Math.PI/2),a[h]=o.mult(n.mult(e));return n=x3dom.fields.SFMatrix4f.rotationX(Math.PI/2),a[4]=o.mult(n.mult(e)),n=x3dom.fields.SFMatrix4f.rotationX(3*Math.PI/2),a[5]=o.mult(n.mult(e)),a},x3dom.Viewarea.prototype.getWCtoLCMatricesCascaded=function(e,t,i){var s=Math.max(1,Math.min(t._vf.shadowCascades,6)),r=Math.max(0,Math.min(t._vf.shadowSplitFactor,1)),o=Math.max(0,Math.min(t._vf.shadowSplitOffset,1)),n=x3dom.isa(t,x3dom.nodeTypes.SpotLight),a=t._vf.zNear,h=t._vf.zFar,d=this.getLightProjectionMatrix(e,a,h,!0,i);n&amp;&amp;(d._00=1,d._11=1);var l=d.mult(e),u=[];if(1==s)return u[0]=l,u;for(var f=this.getShadowSplitDepths(s,r,o,!0,i),c=0;c&lt;s;c++){var m=this.getLightFittingMatrix(l,f[c],f[c+1],i);u[c]=m.mult(l)}return u},x3dom.Viewarea.prototype.getLightProjectionMatrix=function(e,t,i,s,r){var o=x3dom.fields.SFMatrix4f.copy(r);if(!s||t&gt;0||i&gt;0){var n,a,h=e.inverse().e3(),d=x3dom.fields.SFVec3f.copy(this._scene._lastMin),l=x3dom.fields.SFVec3f.copy(this._scene._lastMax).subtract(d),u=l.length()/2,f=d.add(l.multiply(.5)),c=h.subtract(f).length();return u&amp;&amp;(n=c&gt;u?.8*(c-u):1,a=1.2*(c+u)),t&gt;0&amp;&amp;(n=t),i&gt;0&amp;&amp;(a=i),o._22=-(a+n)/(a-n),o._23=-2*a*n/(a-n),o}return this.getLightCropMatrix(o.mult(e)).mult(o)},x3dom.Viewarea.prototype.getProjectionMatrix=function(){return this._scene.getViewpoint().getProjectionMatrix(this._width/this._height)},x3dom.Viewarea.prototype.getViewfrustum=function(e){var t=this._scene.getEnvironment();if(1==t._vf.frustumCulling){if(0==arguments.length){var i=this.getProjectionMatrix(),s=this.getViewMatrix();return new x3dom.fields.FrustumVolume(i.mult(s))}return new x3dom.fields.FrustumVolume(e)}return null},x3dom.Viewarea.prototype.getWCtoCCMatrix=function(){var e=this.getViewMatrix();return this.getProjectionMatrix().mult(e)},x3dom.Viewarea.prototype.getCCtoWCMatrix=function(){return this.getWCtoCCMatrix().inverse()},x3dom.Viewarea.prototype.calcViewRay=function(e,t,i){var s=i||this.getCCtoWCMatrix(),r=e/(this._width-1)*2-1,o=(this._height-1-t)/(this._height-1)*2-1,n=s.multFullMatrixPnt(new x3dom.fields.SFVec3f(r,o,-1)),a=s.multFullMatrixPnt(new x3dom.fields.SFVec3f(r,o,1)).subtract(n);return new x3dom.fields.Ray(n,a)},x3dom.Viewarea.prototype.showAll=function(e,t){void 0===e&amp;&amp;(e="negZ"),void 0===t&amp;&amp;(t=!1);var i=this._scene;i.updateVolume();var s,r=x3dom.fields.SFVec3f.copy(i._lastMin),o=x3dom.fields.SFVec3f.copy(i._lastMax),n="x",a="y",h="z",d=1,l=new x3dom.fields.SFVec3f(0,0,-1);switch(e){case"posX":d=-1;case"negX":h="x",n="y",a="z",s=new x3dom.fields.SFVec3f(d,0,0);break;case"posY":d=-1;case"negY":h="y",n="z",a="x",s=new x3dom.fields.SFVec3f(0,d,0);break;case"posZ":d=-1;case"negZ":default:s=new x3dom.fields.SFVec3f(0,0,-d)}var u=i.getViewpoint(),f=u.getFieldOfView(),c=x3dom.isa(u,x3dom.nodeTypes.OrthoViewpoint),m=o.subtract(r),_=m.multiply(.5),p=r.add(_);t&amp;&amp;u.setCenterOfRotation(p);var x=m[h]/2,g=Math.tan(f/2),v=m[a]/2/g+x,y=m[n]/2/g+x;(m=r.add(m.multiply(.5)))[h]+=c?d*(v&gt;y?v:y)*3.01:d*(v&gt;y?v:y)*1.01;var b=x3dom.fields.Quaternion.rotateFromTo(l,s).toMatrix();b=b.mult(x3dom.fields.SFMatrix4f.translation(m.negate())),c?(this.orthoAnimateTo(v,Math.abs(u._fieldOfView[0])),this.animateTo(b,u)):this.animateTo(b,u)},x3dom.Viewarea.prototype.fit=function(e,t,i){void 0===i&amp;&amp;(i=!0);var s=t.subtract(e).multiply(.5),r=e.add(s),o=s.length(),n=this._scene.getViewpoint(),a=n.getFieldOfView(),h=x3dom.fields.SFMatrix4f.copy(this.getViewMatrix()),d=new x3dom.fields.SFVec3f(h._00,h._01,h._02),l=new x3dom.fields.SFVec3f(h._10,h._11,h._12),u=new x3dom.fields.SFVec3f(h._20,h._21,h._22),f=o/Math.tan(a/2),c=r.add(u.multiply(f));h._03=-d.dot(c),h._13=-l.dot(c),h._23=-u.dot(c),i&amp;&amp;n.setCenterOfRotation(r),x3dom.isa(n,x3dom.nodeTypes.OrthoViewpoint)?(this.orthoAnimateTo(f/2.01,Math.abs(n._fieldOfView[0])),this.animateTo(h,n)):this.animateTo(h,n)},x3dom.Viewarea.prototype.resetView=function(){this._scene.getNavigationInfo()._impl.resetView(this)},x3dom.Viewarea.prototype.resetNavHelpers=function(){this._rotMat=x3dom.fields.SFMatrix4f.identity(),this._transMat=x3dom.fields.SFMatrix4f.identity(),this._movement=new x3dom.fields.SFVec3f(0,0,0),this._needNavigationMatrixUpdate=!0},x3dom.Viewarea.prototype.uprightView=function(){var e=this.getViewMatrix().inverse(),t=e.e3(),i=t.subtract(e.e2()),s=new x3dom.fields.SFVec3f(0,1,0),r=e.e2().cross(s).normalize().cross(s).normalize();i=t.add(r),e=(e=x3dom.fields.SFMatrix4f.lookAt(t,i,s)).inverse(),this.animateTo(e,this._scene.getViewpoint())},x3dom.Viewarea.prototype.callEvtHandler=function(e,t,i){if(!e||!e._xmlNode)return null;try{var s=e._xmlNode[t];if("function"===typeof s)s.call(e._xmlNode,i);else{var r=e._xmlNode.getAttribute(t);new Function("event",r).call(e._xmlNode,i)}var o=e._listeners[i.type];if(o)for(var n=0;n&lt;o.length;n++)o[n].call(e._xmlNode,i)}catch(a){x3dom.debug.logException(a)}return i.cancelBubble},x3dom.Viewarea.prototype.checkEvents=function(e,t,i,s,r){var o,n,a,h=this,d=!0,l=e&amp;&amp;e._xmlNode?e._xmlNode:{},u=this._doc._nodeBag.affectedPointingSensors,f={viewarea:h,target:l,type:r.substr(2,r.length-2),button:s,layerX:t,layerY:i,worldX:h._pick.x,worldY:h._pick.y,worldZ:h._pick.z,normalX:h._pickNorm.x,normalY:h._pickNorm.y,normalZ:h._pickNorm.z,hitPnt:h._pick.toGL(),hitObject:l,shadowObjectId:h._pickingInfo.shadowObjectId,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}};try{var c=e;c&amp;&amp;c._xmlNode&amp;&amp;c._cf.geometry&amp;&amp;!c._xmlNode[r]&amp;&amp;!c._xmlNode.hasAttribute(r)&amp;&amp;!c._listeners[f.type]&amp;&amp;(c=c._cf.geometry.node),c&amp;&amp;!0===h.callEvtHandler(c,r,f)&amp;&amp;(d=!1)}catch(m){x3dom.debug.logException(m)}return d&amp;&amp;e&amp;&amp;function e(t){Array.forEach(t._parentNodes,(function(t){if(t._xmlNode&amp;&amp;(t._xmlNode[r]||t._xmlNode.hasAttribute(r)||t._listeners[f.type])&amp;&amp;!0===h.callEvtHandler(t,r,f)&amp;&amp;(d=!1),0==s&amp;&amp;0==u.length&amp;&amp;("onmousemove"==r||"onmouseover"==r||"onmouseout"==r))for(a=t._childNodes.length,n=0;n&lt;a;++n)o=t._childNodes[n],x3dom.isa(o,x3dom.nodeTypes.X3DPointingDeviceSensorNode)&amp;&amp;o._vf.enabled&amp;&amp;u.push(o);x3dom.isa(t,x3dom.nodeTypes.Anchor)&amp;&amp;"onclick"===r?(t.handleTouch(),d=!1):d&amp;&amp;e(t)}))}(e),d},x3dom.Viewarea.prototype._notifyAffectedPointingSensors=function(e){var t,i={mousedown:"pointerPressedOverSibling",mousemove:"pointerMoved",mouseover:"pointerMovedOver",mouseout:"pointerMovedOut"}[e.type],s=this._doc._nodeBag.affectedPointingSensors,r=s.length;if(r&gt;0&amp;&amp;void 0!==i)for(t=0;t&lt;r;t++)s[t][i](e)},x3dom.Viewarea.prototype.initMouseState=function(){this._deltaT=0,this._dx=0,this._dy=0,this._lastX=-1,this._lastY=-1,this._pressX=-1,this._pressY=-1,this._lastButton=0,this._isMoving=!1,this._needNavigationMatrixUpdate=!0},x3dom.Viewarea.prototype.onMousePress=function(e,t,i){(this._needNavigationMatrixUpdate=!0,this.prepareEvents(e,t,i,"onmousedown"),this._pickingInfo.lastClickObj=this._pickingInfo.pickObj,this._pickingInfo.firstObj=this._pickingInfo.pickObj,this._dx=0,this._dy=0,this._lastX=e,this._lastY=t,this._pressX=e,this._pressY=t,this._lastButton=i,this._isMoving=!1,this._currentInputType==x3dom.InputTypes.NAVIGATION)&amp;&amp;this._scene.getNavigationInfo()._impl.onMousePress(this,e,t,i)},x3dom.Viewarea.prototype.onMouseRelease=function(e,t,i,s){var r,o=this._doc._nodeBag.affectedPointingSensors;for(r=0;r&lt;o.length;++r)o[r].pointerReleased();this._doc._nodeBag.affectedPointingSensors=[];var n,a=this._scene.getNavigationInfo(),h=a.getType();if("box"!==this._scene._vf.pickMode.toLowerCase()){if(this.prepareEvents(e,t,s,"onmouseup"),this._pickingInfo.pickObj&amp;&amp;this._pickingInfo.pickObj===this._pickingInfo.lastClickObj)this.prepareEvents(e,t,s,"onclick");else if(!this._pickingInfo.pickObj&amp;&amp;!this._pickingInfo.lastClickObj&amp;&amp;!this._pickingInfo.firstObj){var d="backgroundClicked";try{if(this._scene._xmlNode&amp;&amp;(this._scene._xmlNode["on"+d]||this._scene._xmlNode.hasAttribute("on"+d)||this._scene._listeners[d])){var l={target:this._scene._xmlNode,type:d,button:s,layerX:e,layerY:t,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}};this._scene.callEvtHandler("on"+d,l)}}catch(F){x3dom.debug.logException("backgroundClicked: "+F)}}}else{var u=(new Date).getTime(),f=this.calcViewRay(e,t),c=this._scene.doIntersect(f),m=f.hitObject;c&amp;&amp;m&amp;&amp;(this._pick.setValues(f.hitPoint),this.checkEvents(m,e,t,i,"onclick"),x3dom.debug.logInfo("Hit '"+m._xmlNode.localName+"/ "+m._DEF+"' at dist="+f.dist.toFixed(4)),x3dom.debug.logInfo("Ray hit at position "+this._pick));var _=(new Date).getTime()-u;if(x3dom.debug.logInfo("Picking time (box): "+_+"ms"),!c){var p=(n=this.getViewMatrix().e2().negate()).dot(f.pos.negate())/n.dot(f.dir);this._pick=f.pos.add(f.dir.multiply(p))}}if(this._pickingInfo.firstObj=null,this._currentInputType==x3dom.InputTypes.NAVIGATION&amp;&amp;(this._pickingInfo.pickObj||this._pickingInfo.shadowObjectId&gt;=0)&amp;&amp;"lookat"===h&amp;&amp;this._pressX===e&amp;&amp;this._pressY===t){var x=2&amp;this._lastButton?-1:1,g=this._pickingInfo.pickPos.subtract(this._from).length()/3,v=new x3dom.fields.SFMatrix4f;v.setValues(this.getViewMatrix());var y=(v=v.inverse()).e3(),b=(y.subtract(v.e2()),v.e1()),T=(n=this._pickingInfo.pickPos.subtract(y)).length();n=n.normalize();var S=y.addScaled(n,T),w=n.cross(b).normalize();n=w.cross(b).normalize(),x&lt;0&amp;&amp;(g=2*(.5+T+g));var M=S.addScaled(n,g);v=(v=x3dom.fields.SFMatrix4f.lookAt(M,S,b)).inverse(),g=M.subtract(y).length();var E=Math.max(.5,Math.log((1+g)/a._vf.speed));this.animateTo(v,this._scene.getViewpoint(),E)}this._dx=0,this._dy=0,this._lastX=e,this._lastY=t,this._lastButton=i,this._isMoving=!1},x3dom.Viewarea.prototype.onMouseOver=function(e,t,i){this._dx=0,this._dy=0,this._lastButton=0,this._isMoving=!1,this._lastX=e,this._lastY=t,this._deltaT=0},x3dom.Viewarea.prototype.onMouseOut=function(e,t,i){var s;this._dx=0,this._dy=0,this._lastButton=0,this._isMoving=!1,this._lastX=e,this._lastY=t,this._deltaT=0;var r=this._doc._nodeBag.affectedPointingSensors;for(s=0;s&lt;r.length;++s)r[s].pointerReleased();this._doc._nodeBag.affectedPointingSensors=[]},x3dom.Viewarea.prototype.onDoubleClick=function(e,t){this._doc._x3dElem.hasAttribute("disableDoubleClick")&amp;&amp;"true"===this._doc._x3dElem.getAttribute("disableDoubleClick")||this._scene.getNavigationInfo()._impl.onDoubleClick(this,e,t)},x3dom.Viewarea.prototype.handleMoveEvt=function(e,t,i){if(0==i&amp;&amp;(this._doc._nodeBag.affectedPointingSensors=[]),this.prepareEvents(e,t,i,"onmousemove"),this._pickingInfo.pickObj!==this._pickingInfo.lastObj){if(this._pickingInfo.lastObj){var s=this._pickingInfo.pickObj;this._pickingInfo.pickObj=this._pickingInfo.lastObj,this.prepareEvents(e,t,i,"onmouseout"),this._pickingInfo.pickObj=s}this._pickingInfo.pickObj&amp;&amp;this.prepareEvents(e,t,i,"onmouseover"),this._pickingInfo.lastObj=this._pickingInfo.pickObj}},x3dom.Viewarea.prototype.onMove=function(e,t,i){this.handleMoveEvt(e,t,i),(this._lastX&lt;0||this._lastY&lt;0)&amp;&amp;(this._lastX=e,this._lastY=t),this._dx=e-this._lastX,this._dy=t-this._lastY,this._lastX=e,this._lastY=t},x3dom.Viewarea.prototype.onMoveView=function(e,t){if(this._currentInputType==x3dom.InputTypes.NAVIGATION){var i=this._scene.getNavigationInfo(),s=this._scene.getViewpoint();if("examine"===i.getType()){if(e){var r=this._scene._lastMax.subtract(this._scene._lastMin).length();r=(r&lt;x3dom.fields.Eps?1:r)*i._vf.speed,e=e.multiply(r),this._movement=this._movement.add(e),this._transMat=s.getViewMatrix().inverse().mult(x3dom.fields.SFMatrix4f.translation(this._movement)).mult(s.getViewMatrix())}if(t){var o=s.getCenterOfRotation(),n=this.getViewMatrix();n.setTranslate(new x3dom.fields.SFVec3f(0,0,0)),this._rotMat=this._rotMat.mult(x3dom.fields.SFMatrix4f.translation(o)).mult(n.inverse()).mult(t).mult(n).mult(x3dom.fields.SFMatrix4f.translation(o.negate()))}this._isMoving=!0}}},x3dom.Viewarea.prototype.onDrag=function(e,t,i){this.handleMoveEvt(e,t,i),this._currentInputType==x3dom.InputTypes.NAVIGATION&amp;&amp;this._scene.getNavigationInfo()._impl.onDrag(this,e,t,i)},x3dom.Viewarea.prototype.prepareEvents=function(e,t,i,s){var r=this._doc._nodeBag.affectedPointingSensors,o=this._scene._vf.pickMode.toLowerCase(),n=null;(0==o.indexOf("idbuf")||"color"==o||"texcoord"==o)&amp;&amp;(n=this._pickingInfo.pickObj)&amp;&amp;(this._pick.setValues(this._pickingInfo.pickPos),this._pickNorm.setValues(this._pickingInfo.pickNorm),this.checkEvents(n,e,t,i,s),"onclick"===s&amp;&amp;(n._xmlNode&amp;&amp;x3dom.debug.logInfo('Hit "'+n._xmlNode.localName+"/ "+n._DEF+'"'),x3dom.debug.logInfo("Ray hit at position "+this._pick)));var a={viewarea:this,target:{},type:s.substr(2,s.length-2),button:i,layerX:e,layerY:t,worldX:this._pick.x,worldY:this._pick.y,worldZ:this._pick.z,normalX:this._pickNorm.x,normalY:this._pickNorm.y,normalZ:this._pickNorm.z,hitPnt:this._pick.toGL(),hitObject:n&amp;&amp;n._xmlNode?n._xmlNode:null,shadowObjectId:this._pickingInfo.shadowObjectId,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}};this._notifyAffectedPointingSensors(a),r.length&gt;0?this._currentInputType=x3dom.InputTypes.INTERACTION:this._currentInputType=x3dom.InputTypes.NAVIGATION},x3dom.Viewarea.prototype.getRenderMode=function(){return this._points},x3dom.Viewarea.prototype.getShadowedLights=function(){for(var e=[],t=0,i=this.getLights(),s=0;s&lt;i.length;s++)i[s]._vf.shadowIntensity&gt;0&amp;&amp;(e[t]=i[s],t++);return e},x3dom.Viewarea.prototype.getShadowSplitDepths=function(e,t,i,s,r){var o,n=[],a=this._scene.getViewpoint(),h=a.getNear(),d=a.getFar();n[0]=h,h+=i*(d-h)/10;for(var l=1;l&lt;e;l++)o=h*Math.pow(d/h,l/e),n[l]=t*o+(1-t)*(h+l/(e*(h-d)));if(n[e]=d,!s)return n;for(var u=[],f=0;f&lt;=e;f++)u[f]=r.multFullMatrixPnt(new x3dom.fields.SFVec3f(0,0,-n[f])).z;return u},x3dom.Viewarea.prototype.getLightCropMatrix=function(e){var t,i=x3dom.fields.SFVec3f.copy(this._scene._lastMin),s=x3dom.fields.SFVec3f.copy(this._scene._lastMax),r=[];for(r[0]=new x3dom.fields.SFVec3f(i.x,i.y,i.z),r[1]=new x3dom.fields.SFVec3f(i.x,i.y,s.z),r[2]=new x3dom.fields.SFVec3f(i.x,s.y,i.z),r[3]=new x3dom.fields.SFVec3f(i.x,s.y,s.z),r[4]=new x3dom.fields.SFVec3f(s.x,i.y,i.z),r[5]=new x3dom.fields.SFVec3f(s.x,i.y,s.z),r[6]=new x3dom.fields.SFVec3f(s.x,s.y,i.z),r[7]=new x3dom.fields.SFVec3f(s.x,s.y,s.z),t=0;t&lt;8;t++)r[t]=e.multFullMatrixPnt(r[t]);var o=x3dom.fields.SFVec3f.copy(r[0]),n=x3dom.fields.SFVec3f.copy(r[0]);for(t=1;t&lt;8;t++)o.z=Math.min(r[t].z,o.z),n.z=Math.max(r[t].z,n.z);var a=2/(n.z-o.z),h=-a*(n.z+o.z)/2,d=x3dom.fields.SFMatrix4f.identity();return d._22=a,d._23=h,d},x3dom.Viewarea.prototype.getLightFittingMatrix=function(e,t,i,s){var r,o=this.getViewMatrix(),n=s.mult(o).inverse(),a=[];for(a[0]=new x3dom.fields.SFVec3f(-1,-1,i),a[1]=new x3dom.fields.SFVec3f(-1,-1,t),a[2]=new x3dom.fields.SFVec3f(-1,1,i),a[3]=new x3dom.fields.SFVec3f(-1,1,t),a[4]=new x3dom.fields.SFVec3f(1,-1,i),a[5]=new x3dom.fields.SFVec3f(1,-1,t),a[6]=new x3dom.fields.SFVec3f(1,1,i),a[7]=new x3dom.fields.SFVec3f(1,1,t),r=0;r&lt;8;r++)a[r]=n.multFullMatrixPnt(a[r]),a[r]=e.multFullMatrixPnt(a[r]);var h=x3dom.fields.SFVec3f.copy(a[0]),d=x3dom.fields.SFVec3f.copy(a[0]);for(r=1;r&lt;8;r++)h.x=Math.min(a[r].x,h.x),h.y=Math.min(a[r].y,h.y),h.z=Math.min(a[r].z,h.z),d.x=Math.max(a[r].x,d.x),d.y=Math.max(a[r].y,d.y),d.z=Math.max(a[r].z,d.z);var l=function(e,t){var i=e.x,s=e.y,r=e.z,o=t.x,n=t.y,a=t.z;i&gt;1||o&lt;-1?(i=-1,o=1):(i=Math.max(i,-1),o=Math.min(o,1)),s&gt;1||n&lt;-1?(s=-1,n=1):(s=Math.max(s,-1),n=Math.min(n,1)),r&gt;1||a&lt;-1?(r=-1,a=1):(r=Math.max(r,-1),a=Math.min(a,1));var h=new x3dom.fields.SFVec3f(i,s,r),d=new x3dom.fields.SFVec3f(o,n,a);return new x3dom.fields.BoxVolume(h,d)}(h,d),u=2/(l.max.x-l.min.x),f=2/(l.max.y-l.min.y),c=-u*(l.max.x+l.min.x)/2,m=-f*(l.max.y+l.min.y)/2,_=x3dom.fields.SFMatrix4f.identity();return _._00=u,_._11=f,_._03=c,_._13=m,_},x3dom.Mesh=function(e){this._parent=e,this._vol=new x3dom.fields.BoxVolume,this._invalidate=!0,this._numFaces=0,this._numCoords=0,this._primType="TRIANGLES",this._positions=[],this._normals=[],this._texCoords=[],this._colors=[],this._indices=[],this._positions[0]=[],this._normals[0]=[],this._texCoords[0]=[],this._colors[0]=[],this._indices[0]=[]},x3dom.Mesh.prototype._dynamicFields={},x3dom.Mesh.prototype._numPosComponents=3,x3dom.Mesh.prototype._numTexComponents=2,x3dom.Mesh.prototype._numColComponents=3,x3dom.Mesh.prototype._numNormComponents=3,x3dom.Mesh.prototype._lit=!0,x3dom.Mesh.prototype._vol=null,x3dom.Mesh.prototype._invalidate=!0,x3dom.Mesh.prototype._numFaces=0,x3dom.Mesh.prototype._numCoords=0,x3dom.Mesh.prototype.setMeshData=function(e,t,i,s,r){this._positions[0]=e,this._normals[0]=t,this._texCoords[0]=i,this._colors[0]=s,this._indices[0]=r,this._invalidate=!0,this._numFaces=this._indices[0].length/3,this._numCoords=this._positions[0].length/3},x3dom.Mesh.prototype.getVolume=function(){if(1==this._invalidate&amp;&amp;!this._vol.isValid()){var e=this._positions[0],t=e.length;if(t&gt;3){var i=new x3dom.fields.SFVec3f(e[0],e[1],e[2]);this._vol.setBounds(i,i);for(var s=3;s&lt;t;s+=3)this._vol.min.x&gt;e[s]&amp;&amp;(this._vol.min.x=e[s]),this._vol.min.y&gt;e[s+1]&amp;&amp;(this._vol.min.y=e[s+1]),this._vol.min.z&gt;e[s+2]&amp;&amp;(this._vol.min.z=e[s+2]),this._vol.max.x&lt;e[s]&amp;&amp;(this._vol.max.x=e[s]),this._vol.max.y&lt;e[s+1]&amp;&amp;(this._vol.max.y=e[s+1]),this._vol.max.z&lt;e[s+2]&amp;&amp;(this._vol.max.z=e[s+2]);this._invalidate=!1}}return this._vol},x3dom.Mesh.prototype.invalidate=function(){this._invalidate=!0,this._vol.invalidate()},x3dom.Mesh.prototype.isValid=function(){return this._vol.isValid()},x3dom.Mesh.prototype.getCenter=function(){return this.getVolume().getCenter()},x3dom.Mesh.prototype.getDiameter=function(){return this.getVolume().getDiameter()},x3dom.Mesh.prototype.doIntersect=function(e){var t=this.getVolume(),i=e.intersect(t.min,t.max);return i&amp;&amp;e.enter&lt;e.dist&amp;&amp;(e.dist=e.enter,e.hitObject=this._parent,e.hitPoint=e.pos.add(e.dir.multiply(e.enter))),i},x3dom.Mesh.prototype.calcNormals=function(e,t){void 0===t&amp;&amp;(t=!0);var i,s,r,o,n=this._multiIndIndices&amp;&amp;this._multiIndIndices.length,a=n?this._multiIndIndices:this._indices[0],h=this._positions[0],d=[],l=[],u=h.length,f=null,c=void 0!==this._posSize&amp;&amp;this._posSize&gt;u?this._posSize/3:u/3;for(c=3*(c-Math.floor(c)&gt;0?Math.floor(c+1):c),i=0;i&lt;c;++i)l[i]=[];for(c=a.length,i=0;i&lt;c;i+=3){var m,_,p,x;n?(m=3*i,_=3*(i+1),p=3*(i+2),x=new x3dom.fields.SFVec3f(h[_],h[_+1],h[_+2]),r=new x3dom.fields.SFVec3f(h[m],h[m+1],h[m+2]).subtract(x),o=x.subtract(new x3dom.fields.SFVec3f(h[p],h[p+1],h[p+2]))):(m=3*a[i],_=3*a[i+1],p=3*a[i+2],x=new x3dom.fields.SFVec3f(h[_],h[_+1],h[_+2]),r=new x3dom.fields.SFVec3f(h[m],h[m+1],h[m+2]).subtract(x),o=x.subtract(new x3dom.fields.SFVec3f(h[p],h[p+1],h[p+2])),m=3*i,_=3*(i+1),p=3*(i+2)),f=r.cross(o).normalize(),t||(f=f.negate()),e&lt;=x3dom.fields.Eps?(d[m]=d[_]=d[p]=f.x,d[m+1]=d[_+1]=d[p+1]=f.y,d[m+2]=d[_+2]=d[p+2]=f.z):(l[a[i]].push(f),l[a[i+1]].push(f),l[a[i+2]].push(f))}if(e&gt;x3dom.fields.Eps)for(i=0;i&lt;u;i+=3){var g,v=i/3;for(c=(g=n?l[a[v]]:l[v]).length,f=new x3dom.fields.SFVec3f(0,0,0),s=0;s&lt;c;++s)f=f.add(g[s]);f=f.normalize(),d[i]=f.x,d[i+1]=f.y,d[i+2]=f.z}this._normals[0]=d},x3dom.Mesh.prototype.splitMesh=function(e,t){var i,s;i=void 0===typeof e?3:e,void 0===typeof t&amp;&amp;(t=!1);var r=x3dom.Utils.maxIndexableCoords;if(r=Math.floor(r/i)*i,!(this._positions[0].length/3&lt;=r)||t){s=!!t&amp;&amp;(this._multiIndIndices&amp;&amp;this._multiIndIndices.length);var o=this._positions[0],n=this._normals[0],a=this._texCoords[0],h=this._colors[0],d=s?this._multiIndIndices:this._indices[0],l=0;do{this._positions[l]=[],this._normals[l]=[],this._texCoords[l]=[],this._colors[l]=[],this._indices[l]=[];var u=d.length-(l+1)*r&gt;=0;if(this._indices[l]=u?d.slice(l*r,(l+1)*r):d.slice(l*r),s)for(c=0,m=this._indices[l].length;c&lt;m;c++)this._indices[l][c]=c;else if(l)for(var f=l*r,c=0,m=this._indices[l].length;c&lt;m;c++)this._indices[l][c]-=f;this._positions[l]=u?o.slice(l*r*3,3*(l+1)*r):o.slice(l*r*3),n.length&amp;&amp;(this._normals[l]=u?n.slice(l*r*3,3*(l+1)*r):n.slice(l*r*3)),a.length&amp;&amp;(this._texCoords[l]=u?a.slice(l*r*this._numTexComponents,this._numTexComponents*(l+1)*r):a.slice(l*r*this._numTexComponents)),h.length&amp;&amp;(this._colors[l]=u?h.slice(l*r*this._numColComponents,this._numColComponents*(l+1)*r):h.slice(l*r*this._numColComponents))}while(o.length&gt;++l*r*3)}},x3dom.Mesh.prototype.calcTexCoords=function(e){if(this._texCoords[0]=[],"sphere-local"===e.toLowerCase())for(var t=0,i=0,s=this._normals[0].length;t&lt;s;t+=3)this._texCoords[0][i++]=.5+this._normals[0][t]/2,this._texCoords[0][i++]=.5+this._normals[0][t+1]/2;else{var r=new x3dom.fields.SFVec3f(0,0,0),o=new x3dom.fields.SFVec3f(0,0,0);this.getVolume().getBounds(r,o);var n=o.subtract(r),a=0,h=1;n.x&gt;=n.y?n.x&gt;=n.z?(a=0,h=n.y&gt;=n.z?1:2):(a=2,h=0):n.y&gt;=n.z?(a=1,h=n.x&gt;=n.z?0:2):(a=2,h=1);var d=1,l=1,u=0,f=0;switch(a){case 0:d=n.x,u=r.x;break;case 1:d=n.y,u=r.y;break;case 2:d=n.z,u=r.z}switch(h){case 0:l=n.x,f=r.x;break;case 1:l=n.y,f=r.y;break;case 2:l=n.z,f=r.z}for(var c=0,m=0,_=this._positions[0].length;c&lt;_;c+=3)this._texCoords[0][m++]=(this._positions[0][c+a]-u)/d,this._texCoords[0][m++]=(this._positions[0][c+h]-f)/l}},"undefined"===typeof x3dom&amp;&amp;(x3dom={extend:function(e){function t(){}return t.prototype=e.prototype||e,new t},debug:{logInfo:function(e){console.log(e)},logWarning:function(e){console.warn(e)},logError:function(e){console.error(e)}}},Array.map||(Array.map=function(e,t,i){for(var s=e.length,r=[],o=0;o&lt;s;o++)o in e&amp;&amp;(r[o]=t.call(i,e[o],o,e));return r}),console.log("Using x3dom fields.js as standalone math and/or base types library.")),x3dom.fields={};var VecMath=x3dom.fields;function setNamespace(e,t,i){t instanceof Element&amp;&amp;void 0!==t.__setAttribute&amp;&amp;(t.hasAttribute("id")?t.__setAttribute("id",e.toString().replace(" ","")+"__"+t.getAttribute("id")):t.hasAttribute("DEF")&amp;&amp;i&amp;&amp;(t.__setAttribute("id",e.toString().replace(" ","")+"__"+t.getAttribute("DEF")),t.id||(t.id=t.__getAttribute("id")))),t.hasChildNodes()&amp;&amp;Array.forEach(t.childNodes,(function(t){setNamespace(e,t,i)}))}x3dom.fields.Eps=1e-6,x3dom.fields.SFMatrix4f=function(e,t,i,s,r,o,n,a,h,d,l,u,f,c,m,_){0===arguments.length?(this._00=1,this._01=0,this._02=0,this._03=0,this._10=0,this._11=1,this._12=0,this._13=0,this._20=0,this._21=0,this._22=1,this._23=0,this._30=0,this._31=0,this._32=0,this._33=1):(this._00=e,this._01=t,this._02=i,this._03=s,this._10=r,this._11=o,this._12=n,this._13=a,this._20=h,this._21=d,this._22=l,this._23=u,this._30=f,this._31=c,this._32=m,this._33=_)},x3dom.fields.SFMatrix4f.prototype.e0=function(){return new x3dom.fields.SFVec3f(this._00,this._10,this._20).normalize()},x3dom.fields.SFMatrix4f.prototype.e1=function(){return new x3dom.fields.SFVec3f(this._01,this._11,this._21).normalize()},x3dom.fields.SFMatrix4f.prototype.e2=function(){return new x3dom.fields.SFVec3f(this._02,this._12,this._22).normalize()},x3dom.fields.SFMatrix4f.prototype.e3=function(){return new x3dom.fields.SFVec3f(this._03,this._13,this._23)},x3dom.fields.SFMatrix4f.copy=function(e){return new x3dom.fields.SFMatrix4f(e._00,e._01,e._02,e._03,e._10,e._11,e._12,e._13,e._20,e._21,e._22,e._23,e._30,e._31,e._32,e._33)},x3dom.fields.SFMatrix4f.prototype.copy=function(){return x3dom.fields.SFMatrix4f.copy(this)},x3dom.fields.SFMatrix4f.identity=function(){return new x3dom.fields.SFMatrix4f(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},x3dom.fields.SFMatrix4f.zeroMatrix=function(){return new x3dom.fields.SFMatrix4f(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},x3dom.fields.SFMatrix4f.translation=function(e){return new x3dom.fields.SFMatrix4f(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1)},x3dom.fields.SFMatrix4f.rotationX=function(e){var t=Math.cos(e),i=Math.sin(e);return new x3dom.fields.SFMatrix4f(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1)},x3dom.fields.SFMatrix4f.rotationY=function(e){var t=Math.cos(e),i=Math.sin(e);return new x3dom.fields.SFMatrix4f(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1)},x3dom.fields.SFMatrix4f.rotationZ=function(e){var t=Math.cos(e),i=Math.sin(e);return new x3dom.fields.SFMatrix4f(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1)},x3dom.fields.SFMatrix4f.scale=function(e){return new x3dom.fields.SFMatrix4f(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)},x3dom.fields.SFMatrix4f.lookAt=function(e,t,i){var s=e.subtract(t).normalize(),r=i.normalize().cross(s).normalize();if(r.dot(r)&lt;x3dom.fields.Eps)return x3dom.debug.logWarning("View matrix is linearly dependent."),x3dom.fields.SFMatrix4f.translation(e);var o=s.cross(r).normalize(),n=x3dom.fields.SFMatrix4f.identity();return n.setValue(r,o,s,e),n},x3dom.fields.SFMatrix4f.perspectiveFrustum=function(e,t,i,s,r,o){return new x3dom.fields.SFMatrix4f(2*r/(t-e),0,(t+e)/(t-e),0,0,2*r/(s-i),(s+i)/(s-i),0,0,0,-(o+r)/(o-r),-2*o*r/(o-r),0,0,-1,0)},x3dom.fields.SFMatrix4f.perspective=function(e,t,i,s){var r=1/Math.tan(e/2);return new x3dom.fields.SFMatrix4f(r/t,0,0,0,0,r,0,0,0,0,(i+s)/(i-s),2*i*s/(i-s),0,0,-1,0)},x3dom.fields.SFMatrix4f.ortho=function(e,t,i,s,r,o,n){var a=(t-e)/2,h=(s-i)/2,d=o-r;return void 0===n&amp;&amp;(n=1),n&lt;a/h?h=a/n:a=h*n,e=-a,t=a,i=-h,s=h,a*=2,h*=2,new x3dom.fields.SFMatrix4f(2/a,0,0,-(t+e)/a,0,2/h,0,-(s+i)/h,0,0,-2/d,-(o+r)/d,0,0,0,1)},x3dom.fields.SFMatrix4f.prototype.setTranslate=function(e){this._03=e.x,this._13=e.y,this._23=e.z},x3dom.fields.SFMatrix4f.prototype.setScale=function(e){this._00=e.x,this._11=e.y,this._22=e.z},x3dom.fields.SFMatrix4f.prototype.setRotate=function(e){var t=e.x*e.x,i=e.x*e.y,s=e.x*e.z,r=e.y*e.y,o=e.y*e.z,n=e.z*e.z,a=e.w*e.x,h=e.w*e.y,d=e.w*e.z;this._00=1-2*(r+n),this._01=2*(i-d),this._02=2*(s+h),this._10=2*(i+d),this._11=1-2*(t+n),this._12=2*(o-a),this._20=2*(s-h),this._21=2*(o+a),this._22=1-2*(t+r)},x3dom.fields.SFMatrix4f.parseRotation=function(e){var t=/^([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)$/.exec(e),i=+t[1],s=+t[2],r=+t[3],o=+t[4],n=Math.sqrt(i*i+s*s+r*r);0===n?(i=1,s=r=0):(i/=n,s/=n,r/=n);var a=Math.cos(o),h=Math.sin(o),d=1-a;return new x3dom.fields.SFMatrix4f(d*i*i+a,d*i*s+h*r,d*i*r-h*s,0,d*i*s-h*r,d*s*s+a,d*s*r+h*i,0,d*i*r+h*s,d*s*r-h*i,d*r*r+a,0,0,0,0,1).transpose()},x3dom.fields.SFMatrix4f.parse=function(e){var t=!1;/matrix.*\((.+)\)/.exec(e)&amp;&amp;(e=RegExp.$1,t=!0);var i=Array.map(e.split(/[,\s]+/),(function(e){return+e}));return i.length&gt;=16?t?new x3dom.fields.SFMatrix4f(i[0],i[4],i[8],i[12],i[1],i[5],i[9],i[13],i[2],i[6],i[10],i[14],i[3],i[7],i[11],i[15]):new x3dom.fields.SFMatrix4f(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9],i[10],i[11],i[12],i[13],i[14],i[15]):6===i.length?new x3dom.fields.SFMatrix4f(i[0],i[1],0,i[4],i[2],i[3],0,i[5],0,0,1,0,0,0,0,1):(x3dom.debug.logWarning("SFMatrix4f - can't parse string: "+e),x3dom.fields.SFMatrix4f.identity())},x3dom.fields.SFMatrix4f.prototype.mult=function(e){return new x3dom.fields.SFMatrix4f(this._00*e._00+this._01*e._10+this._02*e._20+this._03*e._30,this._00*e._01+this._01*e._11+this._02*e._21+this._03*e._31,this._00*e._02+this._01*e._12+this._02*e._22+this._03*e._32,this._00*e._03+this._01*e._13+this._02*e._23+this._03*e._33,this._10*e._00+this._11*e._10+this._12*e._20+this._13*e._30,this._10*e._01+this._11*e._11+this._12*e._21+this._13*e._31,this._10*e._02+this._11*e._12+this._12*e._22+this._13*e._32,this._10*e._03+this._11*e._13+this._12*e._23+this._13*e._33,this._20*e._00+this._21*e._10+this._22*e._20+this._23*e._30,this._20*e._01+this._21*e._11+this._22*e._21+this._23*e._31,this._20*e._02+this._21*e._12+this._22*e._22+this._23*e._32,this._20*e._03+this._21*e._13+this._22*e._23+this._23*e._33,this._30*e._00+this._31*e._10+this._32*e._20+this._33*e._30,this._30*e._01+this._31*e._11+this._32*e._21+this._33*e._31,this._30*e._02+this._31*e._12+this._32*e._22+this._33*e._32,this._30*e._03+this._31*e._13+this._32*e._23+this._33*e._33)},x3dom.fields.SFMatrix4f.prototype.multMatrixPnt=function(e){return new x3dom.fields.SFVec3f(this._00*e.x+this._01*e.y+this._02*e.z+this._03,this._10*e.x+this._11*e.y+this._12*e.z+this._13,this._20*e.x+this._21*e.y+this._22*e.z+this._23)},x3dom.fields.SFMatrix4f.prototype.multMatrixVec=function(e){return new x3dom.fields.SFVec3f(this._00*e.x+this._01*e.y+this._02*e.z,this._10*e.x+this._11*e.y+this._12*e.z,this._20*e.x+this._21*e.y+this._22*e.z)},x3dom.fields.SFMatrix4f.prototype.multFullMatrixPnt=function(e){var t=this._30*e.x+this._31*e.y+this._32*e.z+this._33;return t&amp;&amp;(t=1/t),new x3dom.fields.SFVec3f((this._00*e.x+this._01*e.y+this._02*e.z+this._03)*t,(this._10*e.x+this._11*e.y+this._12*e.z+this._13)*t,(this._20*e.x+this._21*e.y+this._22*e.z+this._23)*t)},x3dom.fields.SFMatrix4f.prototype.multMatrixPlane=function(e){var t=new x3dom.fields.SFVec3f(e.x,e.y,e.z),i=t.multiply(-e.w);i=this.multMatrixPnt(i);var s=-(t=this.inverse().transpose().multMatrixVec(t)).dot(i);return new x3dom.fields.SFVec4f(t.x,t.y,t.z,s)},x3dom.fields.SFMatrix4f.prototype.transpose=function(){return new x3dom.fields.SFMatrix4f(this._00,this._10,this._20,this._30,this._01,this._11,this._21,this._31,this._02,this._12,this._22,this._32,this._03,this._13,this._23,this._33)},x3dom.fields.SFMatrix4f.prototype.negate=function(){return new x3dom.fields.SFMatrix4f(-this._00,-this._01,-this._02,-this._03,-this._10,-this._11,-this._12,-this._13,-this._20,-this._21,-this._22,-this._23,-this._30,-this._31,-this._32,-this._33)},x3dom.fields.SFMatrix4f.prototype.multiply=function(e){return new x3dom.fields.SFMatrix4f(e*this._00,e*this._01,e*this._02,e*this._03,e*this._10,e*this._11,e*this._12,e*this._13,e*this._20,e*this._21,e*this._22,e*this._23,e*this._30,e*this._31,e*this._32,e*this._33)},x3dom.fields.SFMatrix4f.prototype.add=function(e){return new x3dom.fields.SFMatrix4f(this._00+e._00,this._01+e._01,this._02+e._02,this._03+e._03,this._10+e._10,this._11+e._11,this._12+e._12,this._13+e._13,this._20+e._20,this._21+e._21,this._22+e._22,this._23+e._23,this._30+e._30,this._31+e._31,this._32+e._32,this._33+e._33)},x3dom.fields.SFMatrix4f.prototype.addScaled=function(e,t){return new x3dom.fields.SFMatrix4f(this._00+t*e._00,this._01+t*e._01,this._02+t*e._02,this._03+t*e._03,this._10+t*e._10,this._11+t*e._11,this._12+t*e._12,this._13+t*e._13,this._20+t*e._20,this._21+t*e._21,this._22+t*e._22,this._23+t*e._23,this._30+t*e._30,this._31+t*e._31,this._32+t*e._32,this._33+t*e._33)},x3dom.fields.SFMatrix4f.prototype.setValues=function(e){this._00=e._00,this._01=e._01,this._02=e._02,this._03=e._03,this._10=e._10,this._11=e._11,this._12=e._12,this._13=e._13,this._20=e._20,this._21=e._21,this._22=e._22,this._23=e._23,this._30=e._30,this._31=e._31,this._32=e._32,this._33=e._33},x3dom.fields.SFMatrix4f.prototype.setValue=function(e,t,i,s){this._00=e.x,this._01=t.x,this._02=i.x,this._10=e.y,this._11=t.y,this._12=i.y,this._20=e.z,this._21=t.z,this._22=i.z,this._30=0,this._31=0,this._32=0,arguments.length&gt;3&amp;&amp;(this._03=s.x,this._13=s.y,this._23=s.z,this._33=1)},x3dom.fields.SFMatrix4f.prototype.setFromArray=function(e){this._00=e[0],this._01=e[4],this._02=e[8],this._03=e[12],this._10=e[1],this._11=e[5],this._12=e[9],this._13=e[13],this._20=e[2],this._21=e[6],this._22=e[10],this._23=e[14],this._30=e[3],this._31=e[7],this._32=e[11],this._33=e[15]},x3dom.fields.SFMatrix4f.prototype.toGL=function(){return[this._00,this._10,this._20,this._30,this._01,this._11,this._21,this._31,this._02,this._12,this._22,this._32,this._03,this._13,this._23,this._33]},x3dom.fields.SFMatrix4f.prototype.at=function(e,t){return this["_"+e+t]},x3dom.fields.SFMatrix4f.prototype.sqrt=function(){for(var e=x3dom.fields.SFMatrix4f.identity(),t=x3dom.fields.SFMatrix4f.copy(this),i=0;i&lt;6;i++){var s=t.inverse(),r=0==i?x3dom.fields.SFMatrix4f.identity():e.inverse(),o=t.det(),n=e.det(),a=Math.abs(Math.pow(o*n,-.125)),h=1/a;t=(t=(t=t.multiply(a)).addScaled(r,h)).multiply(.5),e=(e=(e=e.multiply(a)).addScaled(s,h)).multiply(.5)}return t},x3dom.fields.SFMatrix4f.prototype.normInfinity=function(){var e=0,t=0;return(e=Math.abs(this._00))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._01))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._02))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._03))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._10))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._11))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._12))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._13))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._20))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._21))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._22))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._23))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._30))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._31))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._32))&gt;t&amp;&amp;(t=e),(e=Math.abs(this._33))&gt;t&amp;&amp;(t=e),t},x3dom.fields.SFMatrix4f.prototype.norm1_3x3=function(){var e=Math.abs(this._00)+Math.abs(this._10)+Math.abs(this._20),t=0;return(t=Math.abs(this._01)+Math.abs(this._11)+Math.abs(this._21))&gt;e&amp;&amp;(e=t),(t=Math.abs(this._02)+Math.abs(this._12)+Math.abs(this._22))&gt;e&amp;&amp;(e=t),e},x3dom.fields.SFMatrix4f.prototype.normInf_3x3=function(){var e=Math.abs(this._00)+Math.abs(this._01)+Math.abs(this._02),t=0;return(t=Math.abs(this._10)+Math.abs(this._11)+Math.abs(this._12))&gt;e&amp;&amp;(e=t),(t=Math.abs(this._20)+Math.abs(this._21)+Math.abs(this._22))&gt;e&amp;&amp;(e=t),e},x3dom.fields.SFMatrix4f.prototype.adjointT_3x3=function(){var e=x3dom.fields.SFMatrix4f.identity();return e._00=this._11*this._22-this._12*this._21,e._01=this._12*this._20-this._10*this._22,e._02=this._10*this._21-this._11*this._20,e._10=this._21*this._02-this._22*this._01,e._11=this._22*this._00-this._20*this._02,e._12=this._20*this._01-this._21*this._00,e._20=this._01*this._12-this._02*this._11,e._21=this._02*this._10-this._00*this._12,e._22=this._00*this._11-this._01*this._10,e},x3dom.fields.SFMatrix4f.prototype.equals=function(e){var t=1e-12;return Math.abs(this._00-e._00)&lt;t&amp;&amp;Math.abs(this._01-e._01)&lt;t&amp;&amp;Math.abs(this._02-e._02)&lt;t&amp;&amp;Math.abs(this._03-e._03)&lt;t&amp;&amp;Math.abs(this._10-e._10)&lt;t&amp;&amp;Math.abs(this._11-e._11)&lt;t&amp;&amp;Math.abs(this._12-e._12)&lt;t&amp;&amp;Math.abs(this._13-e._13)&lt;t&amp;&amp;Math.abs(this._20-e._20)&lt;t&amp;&amp;Math.abs(this._21-e._21)&lt;t&amp;&amp;Math.abs(this._22-e._22)&lt;t&amp;&amp;Math.abs(this._23-e._23)&lt;t&amp;&amp;Math.abs(this._30-e._30)&lt;t&amp;&amp;Math.abs(this._31-e._31)&lt;t&amp;&amp;Math.abs(this._32-e._32)&lt;t&amp;&amp;Math.abs(this._33-e._33)&lt;t},x3dom.fields.SFMatrix4f.prototype.getTransform=function(e,t,i,s,r){var o=null;if(arguments.length&gt;4){o=(o=x3dom.fields.SFMatrix4f.translation(r.negate())).mult(this);var n=x3dom.fields.SFMatrix4f.translation(r);o=o.mult(n)}else o=x3dom.fields.SFMatrix4f.copy(this);var a=o.decompose(e,t,i,s);i.setValues(i.multiply(a))},x3dom.fields.SFMatrix4f.prototype.decompose=function(e,t,i,s){var r=x3dom.fields.SFMatrix4f.copy(this),o=x3dom.fields.SFMatrix4f.identity(),n=x3dom.fields.SFMatrix4f.identity(),a=x3dom.fields.SFMatrix4f.identity();e.x=r._03,e.y=r._13,e.z=r._23,r._03=0,r._13=0,r._23=0,r._30=0,r._31=0,r._32=0;var h=1;return r.polarDecompose(o,n)&lt;0&amp;&amp;(o=o.negate(),h=-1),t.setValue(o),n.spectralDecompose(a,i),s.setValue(a),h},x3dom.fields.SFMatrix4f.prototype.polarDecompose=function(e,t){var i,s,r,o,n,a=this.transpose(),h=x3dom.fields.SFMatrix4f.identity(),d=a.norm1_3x3(),l=a.normInf_3x3();do{if(i=a.adjointT_3x3(),0==(n=a._00*i._00+a._01*i._01+a._02*i._02)){x3dom.debug.logWarning("polarDecompose: Mk_det == 0.0");break}s=i.norm1_3x3(),r=i.normInf_3x3();var u=Math.sqrt(Math.sqrt(s*r/(d*l))/Math.abs(n)),f=.5*u,c=.5/(u*n);h.setValues(a),a=(a=a.multiply(f)).addScaled(i,c),o=(h=h.addScaled(a,-1)).norm1_3x3(),d=a.norm1_3x3(),l=a.normInf_3x3()}while(o&gt;1e-12*d);e.setValues(a.transpose()),t.setValues(a.mult(this));for(var m=0;m&lt;3;++m)for(var _=m;_&lt;3;++_)t["_"+_+m]=.5*(t["_"+_+m]+t["_"+m+_]),t["_"+m+_]=.5*(t["_"+_+m]+t["_"+m+_]);return n},x3dom.fields.SFMatrix4f.prototype.spectralDecompose=function(e,t){for(var i=[1,2,0],s=[this._00,this._11,this._22],r=[this._12,this._20,this._01],o=0;o&lt;20;++o){if(0==Math.abs(r[0])+Math.abs(r[1])+Math.abs(r[2]))break;for(var n=2;n&gt;=0;--n){var a=i[n],h=i[a],d=Math.abs(r[n]),l=100*d;if(d&gt;0){var u=0,f=s[h]-s[a],c=Math.abs(f);if(c+l==c)u=r[n]/f;else{var m=.5*f/r[n];u=1/(Math.abs(m)+Math.sqrt(m*m+1)),u=m&lt;0?-u:u}var _=1/Math.sqrt(u*u+1),p=u*_,x=p/(_+1),g=u*r[n];r[n]=0,s[a]-=g,s[h]+=g;var v=r[h];r[h]-=p*(r[a]+x*v),r[a]+=p*(v-x*r[a]);for(var y=2;y&gt;=0;--y){var b=e["_"+y+a],T=e["_"+y+h];e["_"+y+a]-=p*(T+x*b),e["_"+y+h]+=p*(b-x*T)}}}}t.x=s[0],t.y=s[1],t.z=s[2]},x3dom.fields.SFMatrix4f.prototype.log=function(){var e=x3dom.fields.SFMatrix4f.copy(this),t=x3dom.fields.SFMatrix4f.copy(this);t._00-=1,t._11-=1,t._22-=1,t._33-=1;for(var i=0;t.normInfinity()&gt;.5;)e=e.sqrt(),t.setValues(e),t._00-=1,t._11-=1,t._22-=1,t._33-=1,i++;e._00-=1,e._11-=1,e._22-=1,e._33-=1,e=e.negate(),t.setValues(e);for(var s=x3dom.fields.SFMatrix4f.copy(e),r=1;t.normInfinity()&gt;1e-12&amp;&amp;r&lt;12;)t=t.mult(e),r++,s=s.addScaled(t,1/r);return s.multiply(-(1&lt;&lt;i))},x3dom.fields.SFMatrix4f.prototype.exp=function(){var e=x3dom.fields.SFMatrix4f.copy(this),t=x3dom.fields.SFMatrix4f.identity(),i=x3dom.fields.SFMatrix4f.identity(),s=x3dom.fields.SFMatrix4f.identity(),r=0,o=1,n=1+parseInt(Math.log(e.normInfinity()/.693));for(n&lt;0&amp;&amp;(n=0),e=e.multiply(1/(1&lt;&lt;n)),r=1;r&lt;=6;r++)o*=(6-r+1)/(r*(12-r+1)),s=e.mult(s),i=i.addScaled(s,o),t=r%2?t.addScaled(s,-o):t.addScaled(s,o);for(s=t.inverse().mult(i),r=0;r&lt;n;r++)s=s.mult(s);return s},x3dom.fields.SFMatrix4f.prototype.det3=function(e,t,i,s,r,o,n,a,h){return e*r*h+t*o*n+i*s*a-e*o*a-t*s*h-i*r*n},x3dom.fields.SFMatrix4f.prototype.det=function(){var e=this._00,t=this._10,i=this._20,s=this._30,r=this._01,o=this._11,n=this._21,a=this._31,h=this._02,d=this._12,l=this._22,u=this._32,f=this._03,c=this._13,m=this._23,_=this._33;return e*this.det3(o,d,c,n,l,m,a,u,_)-t*this.det3(r,h,f,n,l,m,a,u,_)+i*this.det3(r,h,f,o,d,c,a,u,_)-s*this.det3(r,h,f,o,d,c,n,l,m)},x3dom.fields.SFMatrix4f.prototype.inverse=function(){var e=this._00,t=this._10,i=this._20,s=this._30,r=this._01,o=this._11,n=this._21,a=this._31,h=this._02,d=this._12,l=this._22,u=this._32,f=this._03,c=this._13,m=this._23,_=this._33,p=this.det();return 0==p?(x3dom.debug.logWarning("Invert matrix: singular matrix, no inverse!"),x3dom.fields.SFMatrix4f.identity()):(p=1/p,new x3dom.fields.SFMatrix4f(+this.det3(o,d,c,n,l,m,a,u,_)*p,-this.det3(r,h,f,n,l,m,a,u,_)*p,+this.det3(r,h,f,o,d,c,a,u,_)*p,-this.det3(r,h,f,o,d,c,n,l,m)*p,-this.det3(t,d,c,i,l,m,s,u,_)*p,+this.det3(e,h,f,i,l,m,s,u,_)*p,-this.det3(e,h,f,t,d,c,s,u,_)*p,+this.det3(e,h,f,t,d,c,i,l,m)*p,+this.det3(t,o,c,i,n,m,s,a,_)*p,-this.det3(e,r,f,i,n,m,s,a,_)*p,+this.det3(e,r,f,t,o,c,s,a,_)*p,-this.det3(e,r,f,t,o,c,i,n,m)*p,-this.det3(t,o,d,i,n,l,s,a,u)*p,+this.det3(e,r,h,i,n,l,s,a,u)*p,-this.det3(e,r,h,t,o,d,s,a,u)*p,+this.det3(e,r,h,t,o,d,i,n,l)*p))},x3dom.fields.SFMatrix4f.prototype.getEulerAngles=function(){var e,t,i,s,r,o,n,a;return Math.abs(Math.abs(this._20)-1)&gt;1e-4?(e=-Math.asin(this._20),t=Math.PI-e,n=Math.cos(e),a=Math.cos(t),s=Math.atan2(this._21/n,this._22/n),r=Math.atan2(this._21/a,this._22/a),[s,e,Math.atan2(this._10/n,this._00/n),r,t,Math.atan2(this._10/a,this._00/a)]):(0,-1==this._20?(i=Math.PI/2,o=0+Math.atan2(this._01,this._02)):(i=-Math.PI/2,o=-0+Math.atan2(-this._01,-this._02)),[o,i,0,o,i,0])},x3dom.fields.SFMatrix4f.prototype.toString=function(){return"\n"+this._00.toFixed(6)+", "+this._01.toFixed(6)+", "+this._02.toFixed(6)+", "+this._03.toFixed(6)+", \n"+this._10.toFixed(6)+", "+this._11.toFixed(6)+", "+this._12.toFixed(6)+", "+this._13.toFixed(6)+", \n"+this._20.toFixed(6)+", "+this._21.toFixed(6)+", "+this._22.toFixed(6)+", "+this._23.toFixed(6)+", \n"+this._30.toFixed(6)+", "+this._31.toFixed(6)+", "+this._32.toFixed(6)+", "+this._33.toFixed(6)},x3dom.fields.SFMatrix4f.prototype.setValueByStr=function(e){var t=!1;/matrix.*\((.+)\)/.exec(e)&amp;&amp;(e=RegExp.$1,t=!0);var i=Array.map(e.split(/[,\s]+/),(function(e){return+e}));return i.length&gt;=16?t?(this._00=i[0],this._01=i[4],this._02=i[8],this._03=i[12],this._10=i[1],this._11=i[5],this._12=i[9],this._13=i[13],this._20=i[2],this._21=i[6],this._22=i[10],this._23=i[14],this._30=i[3],this._31=i[7],this._32=i[11],this._33=i[15]):(this._00=i[0],this._01=i[1],this._02=i[2],this._03=i[3],this._10=i[4],this._11=i[5],this._12=i[6],this._13=i[7],this._20=i[8],this._21=i[9],this._22=i[10],this._23=i[11],this._30=i[12],this._31=i[13],this._32=i[14],this._33=i[15]):6===i.length?(this._00=i[0],this._01=i[1],this._02=0,this._03=i[4],this._10=i[2],this._11=i[3],this._12=0,this._13=i[5],this._20=0,this._21=0,this._22=1,this._23=0,this._30=0,this._31=0,this._32=0,this._33=1):x3dom.debug.logWarning("SFMatrix4f - can't parse string: "+e),this},x3dom.fields.SFVec2f=function(e,t){0===arguments.length?(this.x=0,this.y=0):(this.x=e,this.y=t)},x3dom.fields.SFVec2f.copy=function(e){return new x3dom.fields.SFVec2f(e.x,e.y)},x3dom.fields.SFVec2f.parse=function(e){var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);return new x3dom.fields.SFVec2f(+t[1],+t[2])},x3dom.fields.SFVec2f.prototype.copy=function(){return x3dom.fields.SFVec2f.copy(this)},x3dom.fields.SFVec2f.prototype.setValues=function(e){this.x=e.x,this.y=e.y},x3dom.fields.SFVec2f.prototype.at=function(e){switch(e){case 0:return this.x;case 1:return this.y;default:return this.x}},x3dom.fields.SFVec2f.prototype.add=function(e){return new x3dom.fields.SFVec2f(this.x+e.x,this.y+e.y)},x3dom.fields.SFVec2f.prototype.subtract=function(e){return new x3dom.fields.SFVec2f(this.x-e.x,this.y-e.y)},x3dom.fields.SFVec2f.prototype.negate=function(){return new x3dom.fields.SFVec2f(-this.x,-this.y)},x3dom.fields.SFVec2f.prototype.dot=function(e){return this.x*e.x+this.y*e.y},x3dom.fields.SFVec2f.prototype.reflect=function(e){var t=2*this.dot(e);return new x3dom.fields.SFVec2f(this.x-t*e.x,this.y-t*e.y)},x3dom.fields.SFVec2f.prototype.normalize=function(){var e=this.length();return e&amp;&amp;(e=1/e),new x3dom.fields.SFVec2f(this.x*e,this.y*e)},x3dom.fields.SFVec2f.prototype.multComponents=function(e){return new x3dom.fields.SFVec2f(this.x*e.x,this.y*e.y)},x3dom.fields.SFVec2f.prototype.multiply=function(e){return new x3dom.fields.SFVec2f(this.x*e,this.y*e)},x3dom.fields.SFVec2f.prototype.divideComponents=function(e){return new x3dom.fields.SFVec2f(this.x/e.x,this.y/e.y)},x3dom.fields.SFVec2f.prototype.divide=function(e){var t=e?1/e:1;return new x3dom.fields.SFVec2f(this.x*t,this.y*t)},x3dom.fields.SFVec2f.prototype.equals=function(e,t){return Math.abs(this.x-e.x)&lt;t&amp;&amp;Math.abs(this.y-e.y)&lt;t},x3dom.fields.SFVec2f.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},x3dom.fields.SFVec2f.prototype.toGL=function(){return[this.x,this.y]},x3dom.fields.SFVec2f.prototype.toString=function(){return this.x+" "+this.y},x3dom.fields.SFVec2f.prototype.setValueByStr=function(e){var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);return this.x=+t[1],this.y=+t[2],this},x3dom.fields.SFVec3f=function(e,t,i){0===arguments.length?(this.x=0,this.y=0,this.z=0):(this.x=e,this.y=t,this.z=i)},x3dom.fields.SFVec3f.NullVector=new x3dom.fields.SFVec3f(0,0,0),x3dom.fields.SFVec3f.OneVector=new x3dom.fields.SFVec3f(1,1,1),x3dom.fields.SFVec3f.copy=function(e){return new x3dom.fields.SFVec3f(e.x,e.y,e.z)},x3dom.fields.SFVec3f.MIN=function(){return new x3dom.fields.SFVec3f(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)},x3dom.fields.SFVec3f.MAX=function(){return new x3dom.fields.SFVec3f(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},x3dom.fields.SFVec3f.parse=function(e){try{var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);return new x3dom.fields.SFVec3f(+t[1],+t[2],+t[3])}catch(s){var i=x3dom.fields.SFColor.colorParse(e);return new x3dom.fields.SFVec3f(i.r,i.g,i.b)}},x3dom.fields.SFVec3f.prototype.copy=function(){return x3dom.fields.SFVec3f.copy(this)},x3dom.fields.SFVec3f.prototype.setValues=function(e){this.x=e.x,this.y=e.y,this.z=e.z},x3dom.fields.SFVec3f.prototype.at=function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:return this.x}},x3dom.fields.SFVec3f.prototype.add=function(e){return new x3dom.fields.SFVec3f(this.x+e.x,this.y+e.y,this.z+e.z)},x3dom.fields.SFVec3f.prototype.addScaled=function(e,t){return new x3dom.fields.SFVec3f(this.x+t*e.x,this.y+t*e.y,this.z+t*e.z)},x3dom.fields.SFVec3f.prototype.subtract=function(e){return new x3dom.fields.SFVec3f(this.x-e.x,this.y-e.y,this.z-e.z)},x3dom.fields.SFVec3f.prototype.negate=function(){return new x3dom.fields.SFVec3f(-this.x,-this.y,-this.z)},x3dom.fields.SFVec3f.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},x3dom.fields.SFVec3f.prototype.cross=function(e){return new x3dom.fields.SFVec3f(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)},x3dom.fields.SFVec3f.prototype.reflect=function(e){var t=2*this.dot(e);return new x3dom.fields.SFVec3f(this.x-t*e.x,this.y-t*e.y,this.z-t*e.z)},x3dom.fields.SFVec3f.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},x3dom.fields.SFVec3f.prototype.normalize=function(){var e=this.length();return e&amp;&amp;(e=1/e),new x3dom.fields.SFVec3f(this.x*e,this.y*e,this.z*e)},x3dom.fields.SFVec3f.prototype.multComponents=function(e){return new x3dom.fields.SFVec3f(this.x*e.x,this.y*e.y,this.z*e.z)},x3dom.fields.SFVec3f.prototype.multiply=function(e){return new x3dom.fields.SFVec3f(this.x*e,this.y*e,this.z*e)},x3dom.fields.SFVec3f.prototype.divide=function(e){var t=e?1/e:1;return new x3dom.fields.SFVec3f(this.x*t,this.y*t,this.z*t)},x3dom.fields.SFVec3f.prototype.equals=function(e,t){return Math.abs(this.x-e.x)&lt;t&amp;&amp;Math.abs(this.y-e.y)&lt;t&amp;&amp;Math.abs(this.z-e.z)&lt;t},x3dom.fields.SFVec3f.prototype.toGL=function(){return[this.x,this.y,this.z]},x3dom.fields.SFVec3f.prototype.toString=function(){return this.x+" "+this.y+" "+this.z},x3dom.fields.SFVec3f.prototype.setValueByStr=function(e){try{var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);this.x=+t[1],this.y=+t[2],this.z=+t[3]}catch(s){var i=x3dom.fields.SFColor.colorParse(e);this.x=i.r,this.y=i.g,this.z=i.b}return this},x3dom.fields.SFVec4f=function(e,t,i,s){0===arguments.length?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x=e,this.y=t,this.z=i,this.w=s)},x3dom.fields.SFVec4f.copy=function(e){return new x3dom.fields.SFVec4f(e.x,e.y,e.z,e.w)},x3dom.fields.SFVec4f.prototype.copy=function(){return x3dom.fields.SFVec4f(this)},x3dom.fields.SFVec4f.parse=function(e){var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);return new x3dom.fields.SFVec4f(+t[1],+t[2],+t[3],+t[4])},x3dom.fields.SFVec4f.prototype.setValueByStr=function(e){var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);return this.x=+t[1],this.y=+t[2],this.z=+t[3],this.w=+t[4],this},x3dom.fields.SFVec4f.prototype.toGL=function(){return[this.x,this.y,this.z,this.w]},x3dom.fields.SFVec4f.prototype.toString=function(){return this.x+" "+this.y+" "+this.z+" "+this.w},x3dom.fields.Quaternion=function(e,t,i,s){0===arguments.length?(this.x=0,this.y=0,this.z=0,this.w=1):(this.x=e,this.y=t,this.z=i,this.w=s)},x3dom.fields.Quaternion.copy=function(e){return new x3dom.fields.Quaternion(e.x,e.y,e.z,e.w)},x3dom.fields.Quaternion.prototype.multiply=function(e){return new x3dom.fields.Quaternion(this.w*e.x+this.x*e.w+this.y*e.z-this.z*e.y,this.w*e.y+this.y*e.w+this.z*e.x-this.x*e.z,this.w*e.z+this.z*e.w+this.x*e.y-this.y*e.x,this.w*e.w-this.x*e.x-this.y*e.y-this.z*e.z)},x3dom.fields.Quaternion.parseAxisAngle=function(e){var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);return x3dom.fields.Quaternion.axisAngle(new x3dom.fields.SFVec3f(+t[1],+t[2],+t[3]),+t[4])},x3dom.fields.Quaternion.axisAngle=function(e,t){var i=e.length();if(i&gt;x3dom.fields.Eps){var s=Math.sin(t/2)/i,r=Math.cos(t/2);return new x3dom.fields.Quaternion(e.x*s,e.y*s,e.z*s,r)}return new x3dom.fields.Quaternion(0,0,0,1)},x3dom.fields.Quaternion.prototype.copy=function(){return x3dom.fields.Quaternion.copy(this)},x3dom.fields.Quaternion.prototype.toMatrix=function(){var e=this.x*this.x,t=this.x*this.y,i=this.x*this.z,s=this.y*this.y,r=this.y*this.z,o=this.z*this.z,n=this.w*this.x,a=this.w*this.y,h=this.w*this.z;return new x3dom.fields.SFMatrix4f(1-2*(s+o),2*(t-h),2*(i+a),0,2*(t+h),1-2*(e+o),2*(r-n),0,2*(i-a),2*(r+n),1-2*(e+s),0,0,0,0,1)},x3dom.fields.Quaternion.prototype.toAxisAngle=function(){var e,t,i=0,s=0,r=0,o=this;return this.w&gt;1&amp;&amp;(o=x3dom.fields.Quaternion.normalize(this)),t=2*Math.acos(o.w),0==(e=Math.sqrt(1-o.w*o.w))?(i=o.x,s=o.y,r=o.z):(i=o.x/e,s=o.y/e,r=o.z/e),[new x3dom.fields.SFVec3f(i,s,r),t]},x3dom.fields.Quaternion.prototype.angle=function(){return 2*Math.acos(this.w)},x3dom.fields.Quaternion.prototype.setValue=function(e){var t,i=1,s=[0,0,0],r=0,o=0,n=0,a=[1,2,0];if((t=e._00+e._11+e._22)&gt;0?(i=Math.sqrt(t+1),this.w=.5*i,i=.5/i,this.x=(e._21-e._12)*i,this.y=(e._02-e._20)*i,this.z=(e._10-e._01)*i):(r=e._11&gt;e._00?1:0,e._22&gt;e.at(r,r)&amp;&amp;(r=2),n=a[o=a[r]],i=Math.sqrt(e.at(r,r)-(e.at(o,o)+e.at(n,n))+1),s[r]=.5*i,i=.5/i,this.w=(e.at(n,o)-e.at(o,n))*i,s[o]=(e.at(o,r)+e.at(r,o))*i,s[n]=(e.at(n,r)+e.at(r,n))*i,this.x=s[0],this.y=s[1],this.z=s[2]),this.w&gt;1||this.w&lt;-1){var h=1+100*x3dom.fields.Eps;(this.w&gt;h||this.w&lt;-h)&amp;&amp;x3dom.debug.logInfo("MatToQuat: BUG: |quat[4]| ("+this.w+") &gt;&gt; 1.0 !"),this.w&gt;1?this.w=1:this.w=-1}},x3dom.fields.Quaternion.prototype.setFromEuler=function(e,t,i){var s=Math.sin(.5*e),r=Math.cos(.5*e),o=Math.sin(.5*t),n=Math.cos(.5*t),a=Math.sin(.5*i),h=Math.cos(.5*i);this.x=s*n*h-r*o*a,this.y=r*o*h+s*n*a,this.z=r*n*a-s*o*h,this.w=r*n*h+s*o*a},x3dom.fields.Quaternion.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},x3dom.fields.Quaternion.prototype.add=function(e){return new x3dom.fields.Quaternion(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)},x3dom.fields.Quaternion.prototype.subtract=function(e){return new x3dom.fields.Quaternion(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)},x3dom.fields.Quaternion.prototype.setValues=function(e){this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w},x3dom.fields.Quaternion.prototype.equals=function(e,t){return this.dot(e)&gt;=1-t},x3dom.fields.Quaternion.prototype.multScalar=function(e){return new x3dom.fields.Quaternion(this.x*e,this.y*e,this.z*e,this.w*e)},x3dom.fields.Quaternion.prototype.normalize=function(e){var t=this.dot(e),i=1;return t&amp;&amp;(i=1/Math.sqrt(t)),new x3dom.fields.Quaternion(this.x*i,this.y*i,this.z*i,this.w*i)},x3dom.fields.Quaternion.prototype.negate=function(){return new x3dom.fields.Quaternion(-this.x,-this.y,-this.z,-this.w)},x3dom.fields.Quaternion.prototype.inverse=function(){return new x3dom.fields.Quaternion(-this.x,-this.y,-this.z,this.w)},x3dom.fields.Quaternion.prototype.slerp=function(e,t){var i,s,r,o=this.dot(e);if(o&lt;0?(o=-o,i=e.negate()):i=new x3dom.fields.Quaternion(e.x,e.y,e.z,e.w),1-o&gt;1e-5){var n=Math.acos(o),a=Math.sin(n);s=Math.sin((1-t)*n)/a,r=Math.sin(t*n)/a}else s=1-t,r=t;return this.multScalar(s).add(i.multScalar(r))},x3dom.fields.Quaternion.rotateFromTo=function(e,t){var i=e.normalize(),s=t.normalize(),r=i.dot(s);if(r&gt;.99999)return new x3dom.fields.Quaternion(0,0,0,1);if(r&lt;-.99999){var o=new x3dom.fields.SFVec3f(1,0,0),n=i.cross(o);return n.length()&lt;1e-5&amp;&amp;(o.x=0,o.y=1,o.z=0,n=i.cross(o)),n=n.normalize(),x3dom.fields.Quaternion.axisAngle(n,Math.PI)}var a=e.cross(t);a=a.normalize();var h=Math.sqrt(.5*(1-r));return a=a.multiply(h),h=Math.sqrt(.5*(1+r)),new x3dom.fields.Quaternion(a.x,a.y,a.z,h)},x3dom.fields.Quaternion.prototype.toGL=function(){var e=this.toAxisAngle();return[e[0].x,e[0].y,e[0].z,e[1]]},x3dom.fields.Quaternion.prototype.toString=function(){return this.x+" "+this.y+" "+this.z+", "+this.w},x3dom.fields.Quaternion.prototype.setValueByStr=function(e){var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e),i=x3dom.fields.Quaternion.axisAngle(new x3dom.fields.SFVec3f(+t[1],+t[2],+t[3]),+t[4]);return this.x=i.x,this.y=i.y,this.z=i.z,this.w=i.w,this},x3dom.fields.SFColor=function(e,t,i){0===arguments.length?(this.r=0,this.g=0,this.b=0):(this.r=e,this.g=t,this.b=i)},x3dom.fields.SFColor.parse=function(e){try{var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);return new x3dom.fields.SFColor(+t[1],+t[2],+t[3])}catch(i){return x3dom.fields.SFColor.colorParse(e)}},x3dom.fields.SFColor.copy=function(e){return new x3dom.fields.SFColor(e.r,e.g,e.b)},x3dom.fields.SFColor.prototype.copy=function(){return x3dom.fields.SFColor.copy(this)},x3dom.fields.SFColor.prototype.setHSV=function(e,t,i){x3dom.debug.logWarning("SFColor.setHSV() NYI")},x3dom.fields.SFColor.prototype.getHSV=function(){return x3dom.debug.logWarning("SFColor.getHSV() NYI"),[0,0,0]},x3dom.fields.SFColor.prototype.setValues=function(e){this.r=e.r,this.g=e.g,this.b=e.b},x3dom.fields.SFColor.prototype.equals=function(e,t){return Math.abs(this.r-e.r)&lt;t&amp;&amp;Math.abs(this.g-e.g)&lt;t&amp;&amp;Math.abs(this.b-e.b)&lt;t},x3dom.fields.SFColor.prototype.add=function(e){return new x3dom.fields.SFColor(this.r+e.r,this.g+e.g,this.b+e.b)},x3dom.fields.SFColor.prototype.subtract=function(e){return new x3dom.fields.SFColor(this.r-e.r,this.g-e.g,this.b-e.b)},x3dom.fields.SFColor.prototype.multiply=function(e){return new x3dom.fields.SFColor(this.r*e,this.g*e,this.b*e)},x3dom.fields.SFColor.prototype.toGL=function(){return[this.r,this.g,this.b]},x3dom.fields.SFColor.prototype.toString=function(){return this.r+" "+this.g+" "+this.b},x3dom.fields.SFColor.prototype.setValueByStr=function(e){try{var t=/^\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*$/.exec(e);this.r=+t[1],this.g=+t[2],this.b=+t[3]}catch(s){var i=x3dom.fields.SFColor.colorParse(e);this.r=i.r,this.g=i.g,this.b=i.b}return this},x3dom.fields.SFColor.colorParse=function(e){var t=0,i=0,s=0,r={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};if(r[e]&amp;&amp;(e="#"+r[e]),e.substr&amp;&amp;"#"===e.substr(0,1)){var o=(e=e.substr(1)).length;6===o?(t=parseInt("0x"+e.substr(0,2),16)/255,i=parseInt("0x"+e.substr(2,2),16)/255,s=parseInt("0x"+e.substr(4,2),16)/255):3===o&amp;&amp;(t=parseInt("0x"+e.substr(0,1),16)/15,i=parseInt("0x"+e.substr(1,1),16)/15,s=parseInt("0x"+e.substr(2,1),16)/15)}return new x3dom.fields.SFColor(t,i,s)},x3dom.fields.SFColorRGBA=function(e,t,i,s){0===arguments.length?(this.r=0,this.g=0,this.b=0,this.a=1):(this.r=e,this.g=t,this.b=i,this.a=s)},x3dom.fields.SFColorRGBA.parse=function(e){try{var t=/^([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)$/.exec(e);return new x3dom.fields.SFColorRGBA(+t[1],+t[2],+t[3],+t[4])}catch(i){return x3dom.fields.SFColorRGBA.colorParse(e)}},x3dom.fields.SFColorRGBA.copy=function(e){return new x3dom.fields.SFColorRGBA(e.r,e.g,e.b,e.a)},x3dom.fields.SFColorRGBA.prototype.copy=function(){return x3dom.fields.SFColorRGBA.copy(this)},x3dom.fields.SFColorRGBA.prototype.setValues=function(e){this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a},x3dom.fields.SFColorRGBA.prototype.equals=function(e,t){return Math.abs(this.r-e.r)&lt;t&amp;&amp;Math.abs(this.g-e.g)&lt;t&amp;&amp;Math.abs(this.b-e.b)&lt;t&amp;&amp;Math.abs(this.a-e.a)&lt;t},x3dom.fields.SFColorRGBA.prototype.toGL=function(){return[this.r,this.g,this.b,this.a]},x3dom.fields.SFColorRGBA.prototype.toString=function(){return this.r+" "+this.g+" "+this.b+" "+this.a},x3dom.fields.SFColorRGBA.prototype.setValueByStr=function(e){try{var t=/^([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)\s*,?\s*([+\-]?\d*\.*\d*[eE]?[+\-]?\d*?)$/.exec(e);this.r=+t[1],this.g=+t[2],this.b=+t[3],this.a=+t[4]}catch(s){var i=x3dom.fields.SFColorRGBA.colorParse(e);this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a}return this},x3dom.fields.SFColorRGBA.prototype.toUint=function(){return(Math.round(255*this.r)&lt;&lt;24|Math.round(255*this.g)&lt;&lt;16|Math.round(255*this.b)&lt;&lt;8|Math.round(255*this.a))&gt;&gt;&gt;0},x3dom.fields.SFColorRGBA.colorParse=function(e){var t=0,i=0,s=0,r=0,o={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};if(o[e]&amp;&amp;(e="#"+o[e]+"ff"),e.substr&amp;&amp;"#"===e.substr(0,1)){var n=(e=e.substr(1)).length;8===n?(t=parseInt("0x"+e.substr(0,2),16)/255,i=parseInt("0x"+e.substr(2,2),16)/255,s=parseInt("0x"+e.substr(4,2),16)/255,r=parseInt("0x"+e.substr(6,2),16)/255):6===n?(t=parseInt("0x"+e.substr(0,2),16)/255,i=parseInt("0x"+e.substr(2,2),16)/255,s=parseInt("0x"+e.substr(4,2),16)/255,r=1):4===n?(t=parseInt("0x"+e.substr(0,1),16)/15,i=parseInt("0x"+e.substr(1,1),16)/15,s=parseInt("0x"+e.substr(2,1),16)/15,r=parseInt("0x"+e.substr(3,1),16)/15):3===n&amp;&amp;(t=parseInt("0x"+e.substr(0,1),16)/15,i=parseInt("0x"+e.substr(1,1),16)/15,s=parseInt("0x"+e.substr(2,1),16)/15,r=1)}return new x3dom.fields.SFColorRGBA(t,i,s,r)},x3dom.fields.SFImage=function(e,t,i,s){if(0!==arguments.length&amp;&amp;s&amp;&amp;s.map){this.width=e,this.height=t,this.comp=i;var r=this.array;s.map((function(e){r.push(e)}),this.array)}else this.width=0,this.height=0,this.comp=0,this.array=[]},x3dom.fields.SFImage.parse=function(e){var t=new x3dom.fields.SFImage;return t.setValueByStr(e),t},x3dom.fields.SFImage.copy=function(e){var t=new x3dom.fields.SFImage;return t.width=e.width,t.height=e.height,t.comp=e.comp,t.setPixels(e.getPixels()),t},x3dom.fields.SFImage.prototype.copy=function(){return x3dom.fields.SFImage.copy(this)},x3dom.fields.SFImage.prototype.setValueByStr=function(e){var t,i=e.match(/(\w+)/g),s=i.length,r=0;if(this.array=[],!(s&gt;2))return this.width=0,this.height=0,void(this.comp=0);for(this.width=+i[0],this.height=+i[1],this.comp=+i[2],r=2*this.comp,t=3;t&lt;s;t++){var o,n,a,h;if(i[t].substr)if("x"!==i[t].substr(1,1).toLowerCase()){var d=parseInt(i[t],10);1===this.comp?(o=d,this.array.push(o)):2===this.comp?(o=d&gt;&gt;8&amp;255,n=255&amp;d,this.array.push(o,n)):3===this.comp?(o=d&gt;&gt;16&amp;255,n=d&gt;&gt;8&amp;255,a=255&amp;d,this.array.push(o,n,a)):4===this.comp&amp;&amp;(o=d&gt;&gt;24&amp;255,n=d&gt;&gt;16&amp;255,a=d&gt;&gt;8&amp;255,h=255&amp;d,this.array.push(o,n,a,h))}else"x"===i[t].substr(1,1).toLowerCase()&amp;&amp;(i[t]=i[t].substr(2),i[t].length===r&amp;&amp;(1===this.comp?(o=parseInt("0x"+i[t].substr(0,2),16),this.array.push(o)):2===this.comp?(o=parseInt("0x"+i[t].substr(0,2),16),n=parseInt("0x"+i[t].substr(2,2),16),this.array.push(o,n)):3===this.comp?(o=parseInt("0x"+i[t].substr(0,2),16),n=parseInt("0x"+i[t].substr(2,2),16),a=parseInt("0x"+i[t].substr(4,2),16),this.array.push(o,n,a)):4===this.comp&amp;&amp;(o=parseInt("0x"+i[t].substr(0,2),16),n=parseInt("0x"+i[t].substr(2,2),16),a=parseInt("0x"+i[t].substr(4,2),16),h=parseInt("0x"+i[t].substr(6,2),16),this.array.push(o,n,a,h))))}},x3dom.fields.SFImage.prototype.setPixel=function(e,t,i){var s=(t*this.width+e)*this.comp;1===this.comp&amp;&amp;s&lt;this.array.length?this.array[s]=255*i.r:2===this.comp&amp;&amp;s+1&lt;this.array.length?(this.array[s]=255*i.r,this.array[s+1]=255*i.g):3===this.comp&amp;&amp;s+2&lt;this.array.length?(this.array[s]=255*i.r,this.array[s+1]=255*i.g,this.array[s+2]=255*i.b):4===this.comp&amp;&amp;s+3&lt;this.array.length&amp;&amp;(this.array[s]=255*i.r,this.array[s+1]=255*i.g,this.array[s+2]=255*i.b,this.array[s+3]=255*i.a)},x3dom.fields.SFImage.prototype.getPixel=function(e,t){var i=(t*this.width+e)*this.comp;return 1===this.comp&amp;&amp;i&lt;this.array.length?new x3dom.fields.SFColorRGBA(this.array[i]/255,0,0,1):2===this.comp&amp;&amp;i+1&lt;this.array.length?new x3dom.fields.SFColorRGBA(this.array[i]/255,this.array[i+1]/255,0,1):3===this.comp&amp;&amp;i+2&lt;this.array.length?new x3dom.fields.SFColorRGBA(this.array[i]/255,this.array[i+1]/255,this.array[i+2]/255,1):4===this.comp&amp;&amp;i+3&lt;this.array.length?new x3dom.fields.SFColorRGBA(this.array[i]/255,this.array[i+1]/255,this.array[i+2]/255,this.array[i+3]/255):void 0},x3dom.fields.SFImage.prototype.setPixels=function(e){var t,i=0;if(1===this.comp)for(t=0;t&lt;e.length;t++)this.array[i++]=255*e[t].r;else if(2===this.comp)for(t=0;t&lt;e.length;t++)this.array[i++]=255*e[t].r,this.array[i++]=255*e[t].g;else if(3===this.comp)for(t=0;t&lt;e.length;t++)this.array[i++]=255*e[t].r,this.array[i++]=255*e[t].g,this.array[i++]=255*e[t].b;else if(4===this.comp)for(t=0;t&lt;e.length;t++)this.array[i++]=255*e[t].r,this.array[i++]=255*e[t].g,this.array[i++]=255*e[t].b,this.array[i++]=255*e[t].a},x3dom.fields.SFImage.prototype.getPixels=function(){var e,t=[];if(1===this.comp)for(e=0;e&lt;this.array.length;e+=this.comp)t.push(new x3dom.fields.SFColorRGBA(this.array[e]/255,0,0,1));else if(2===this.comp)for(e=0;e&lt;this.array.length;e+=this.comp)t.push(new x3dom.fields.SFColorRGBA(this.array[e]/255,this.array[e+1]/255,0,1));else if(3===this.comp)for(e=0;e&lt;this.array.length;e+=this.comp)t.push(new x3dom.fields.SFColorRGBA(this.array[e]/255,this.array[e+1]/255,this.array[e+2]/255,1));else if(4===this.comp)for(e=0;e&lt;this.array.length;e+=this.comp)t.push(new x3dom.fields.SFColorRGBA(this.array[e]/255,this.array[e+1]/255,this.array[e+2]/255,this.array[e+3]/255));return t},x3dom.fields.SFImage.prototype.toGL=function(){var e=[];return Array.map(this.array,(function(t){e.push(t)})),e},x3dom.fields.MFColor=function(e){if(e){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFColor.copy=function(e){var t=new x3dom.fields.MFColor;return e.map((function(e){t.push(e.copy())}),this),t},x3dom.fields.MFColor.prototype=x3dom.extend([]),x3dom.fields.MFColor.parse=function(e){for(var t=e.match(/([+\-0-9eE\.]+)/g),i=[],s=0,r=t?t.length:0;s&lt;r;s+=3)i.push(new x3dom.fields.SFColor(+t[s+0],+t[s+1],+t[s+2]));return new x3dom.fields.MFColor(i)},x3dom.fields.MFColor.prototype.copy=function(){return x3dom.fields.MFColor.copy(this)},x3dom.fields.MFColor.prototype.setValueByStr=function(e){this.length=0;for(var t=e.match(/([+\-0-9eE\.]+)/g),i=0,s=t?t.length:0;i&lt;s;i+=3)this.push(new x3dom.fields.SFColor(+t[i+0],+t[i+1],+t[i+2]))},x3dom.fields.MFColor.prototype.toGL=function(){var e=[];return Array.map(this,(function(t){e.push(t.r),e.push(t.g),e.push(t.b)})),e},x3dom.fields.MFColorRGBA=function(e){if(e){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFColorRGBA.copy=function(e){var t=new x3dom.fields.MFColorRGBA;return e.map((function(e){t.push(e.copy())}),this),t},x3dom.fields.MFColorRGBA.prototype=x3dom.extend([]),x3dom.fields.MFColorRGBA.parse=function(e){for(var t=e.match(/([+\-0-9eE\.]+)/g),i=[],s=0,r=t?t.length:0;s&lt;r;s+=4)i.push(new x3dom.fields.SFColorRGBA(+t[s+0],+t[s+1],+t[s+2],+t[s+3]));return new x3dom.fields.MFColorRGBA(i)},x3dom.fields.MFColorRGBA.prototype.copy=function(){return x3dom.fields.MFColorRGBA.copy(this)},x3dom.fields.MFColorRGBA.prototype.setValueByStr=function(e){this.length=0;for(var t=e.match(/([+\-0-9eE\.]+)/g),i=0,s=t?t.length:0;i&lt;s;i+=4)this.push(new x3dom.fields.SFColorRGBA(+t[i+0],+t[i+1],+t[i+2],+t[i+3]))},x3dom.fields.MFColorRGBA.prototype.toGL=function(){var e=[];return Array.map(this,(function(t){e.push(t.r),e.push(t.g),e.push(t.b),e.push(t.a)})),e},x3dom.fields.MFRotation=function(e){if(e){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFRotation.prototype=x3dom.extend([]),x3dom.fields.MFRotation.copy=function(e){var t=new x3dom.fields.MFRotation;return e.map((function(e){t.push(e.copy())}),this),t},x3dom.fields.MFRotation.prototype.copy=function(){return x3dom.fields.MFRotation.copy(this)},x3dom.fields.MFRotation.parse=function(e){for(var t=e.match(/([+\-0-9eE\.]+)/g),i=[],s=0,r=t?t.length:0;s&lt;r;s+=4)i.push(x3dom.fields.Quaternion.axisAngle(new x3dom.fields.SFVec3f(+t[s+0],+t[s+1],+t[s+2]),+t[s+3]));return new x3dom.fields.MFRotation(i)},x3dom.fields.MFRotation.prototype.setValueByStr=function(e){this.length=0;for(var t=e.match(/([+\-0-9eE\.]+)/g),i=0,s=t?t.length:0;i&lt;s;i+=4)this.push(x3dom.fields.Quaternion.axisAngle(new x3dom.fields.SFVec3f(+t[i+0],+t[i+1],+t[i+2]),+t[i+3]))},x3dom.fields.MFRotation.prototype.toGL=function(){var e=[];return Array.map(this,(function(t){var i=t.toAxisAngle();e.push(i[0].x),e.push(i[0].y),e.push(i[0].z),e.push(i[1])})),e},x3dom.fields.MFVec3f=function(e){if(e){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFVec3f.prototype=x3dom.extend(Array),x3dom.fields.MFVec3f.copy=function(e){var t=new x3dom.fields.MFVec3f;return e.map((function(e){t.push(e.copy())}),this),t},x3dom.fields.MFVec3f.parse=function(e){for(var t=e.match(/([+\-0-9eE\.]+)/g),i=[],s=0,r=t?t.length:0;s&lt;r;s+=3)i.push(new x3dom.fields.SFVec3f(+t[s+0],+t[s+1],+t[s+2]));return new x3dom.fields.MFVec3f(i)},x3dom.fields.MFVec3f.prototype.copy=function(){x3dom.fields.MFVec3f.copy(this)},x3dom.fields.MFVec3f.prototype.setValueByStr=function(e){this.length=0;for(var t=e.match(/([+\-0-9eE\.]+)/g),i=0,s=t?t.length:0;i&lt;s;i+=3)this.push(new x3dom.fields.SFVec3f(+t[i+0],+t[i+1],+t[i+2]))},x3dom.fields.MFVec3f.prototype.toGL=function(){var e=[];return Array.map(this,(function(t){e.push(t.x),e.push(t.y),e.push(t.z)})),e},x3dom.fields.MFVec2f=function(e){if(e){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFVec2f.prototype=x3dom.extend([]),x3dom.fields.MFVec2f.copy=function(e){var t=new x3dom.fields.MFVec2f;return e.map((function(e){t.push(e.copy())}),this),t},x3dom.fields.MFVec2f.parse=function(e){for(var t=e.match(/([+\-0-9eE\.]+)/g),i=[],s=0,r=t?t.length:0;s&lt;r;s+=2)i.push(new x3dom.fields.SFVec2f(+t[s+0],+t[s+1]));return new x3dom.fields.MFVec2f(i)},x3dom.fields.MFVec2f.prototype.copy=function(){return x3dom.fields.MFVec2f.copy(this)},x3dom.fields.MFVec2f.prototype.setValueByStr=function(e){this.length=0;for(var t=e.match(/([+\-0-9eE\.]+)/g),i=0,s=t?t.length:0;i&lt;s;i+=2)this.push(new x3dom.fields.SFVec2f(+t[i+0],+t[i+1]))},x3dom.fields.MFVec2f.prototype.toGL=function(){var e=[];return Array.map(this,(function(t){e.push(t.x),e.push(t.y)})),e},x3dom.fields.MFInt32=function(e){if(e){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFInt32.prototype=x3dom.extend([]),x3dom.fields.MFInt32.copy=function(e){var t=new x3dom.fields.MFInt32;return e.map((function(e){t.push(e)}),this),t},x3dom.fields.MFInt32.parse=function(e){for(var t=e.match(/([+\-]?\d+\s*){1},?\s*/g),i=[],s=0,r=t?t.length:0;s&lt;r;++s)i.push(parseInt(t[s],10));return new x3dom.fields.MFInt32(i)},x3dom.fields.MFInt32.prototype.copy=function(){return x3dom.fields.MFInt32.copy(this)},x3dom.fields.MFInt32.prototype.setValueByStr=function(e){this.length=0;for(var t=e.match(/([+\-]?\d+\s*){1},?\s*/g),i=0,s=t?t.length:0;i&lt;s;++i)this.push(parseInt(t[i],10))},x3dom.fields.MFInt32.prototype.toGL=function(){var e=[];return Array.map(this,(function(t){e.push(t)})),e},x3dom.fields.MFFloat=function(e){if(e){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFFloat.prototype=x3dom.extend([]),x3dom.fields.MFFloat.copy=function(e){var t=new x3dom.fields.MFFloat;return e.map((function(e){t.push(e)}),this),t},x3dom.fields.MFFloat.parse=function(e){for(var t=e.match(/([+\-0-9eE\.]+)/g),i=[],s=0,r=t?t.length:0;s&lt;r;s++)i.push(+t[s]);return new x3dom.fields.MFFloat(i)},x3dom.fields.MFFloat.prototype.copy=function(){return x3dom.fields.MFFloat.copy(this)},x3dom.fields.MFFloat.prototype.setValueByStr=function(e){this.length=0;for(var t=e.match(/([+\-0-9eE\.]+)/g),i=0,s=t?t.length:0;i&lt;s;i++)this.push(+t[i])},x3dom.fields.MFFloat.prototype.toGL=function(){var e=[];return Array.map(this,(function(t){e.push(t)})),e},x3dom.fields.MFBoolean=function(e){if(e){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFBoolean.prototype=x3dom.extend([]),x3dom.fields.MFBoolean.copy=function(e){var t=new x3dom.fields.MFBoolean;return e.map((function(e){t.push(e)}),this),t},x3dom.fields.MFBoolean.parse=function(e){for(var t=e.match(/(true|false|1|0)/gi),i=[],s=0,r=t?t.length:0;s&lt;r;s++)i.push("1"==t[s]||"true"==t[s].toLowerCase());return new x3dom.fields.MFBoolean(i)},x3dom.fields.MFBoolean.prototype.copy=function(){return x3dom.fields.MFBoolean.copy(this)},x3dom.fields.MFBoolean.prototype.setValueByStr=function(e){this.length=0;for(var t=e.match(/(true|false|1|0)/gi),i=0,s=t?t.length:0;i&lt;s;i++)this.push("1"==t[i]||"true"==t[i].toLowerCase())},x3dom.fields.MFBoolean.prototype.toGL=function(){var e=[];return Array.map(this,(function(t){e.push(t?1:0)})),e},x3dom.fields.MFString=function(e){if(e&amp;&amp;e.map){var t=this;e.map((function(e){t.push(e)}),this)}},x3dom.fields.MFString.prototype=x3dom.extend([]),x3dom.fields.MFString.copy=function(e){var t=new x3dom.fields.MFString;return e.map((function(e){t.push(e)}),this),t},x3dom.fields.MFString.parse=function(e){var t=[];if(e.length&amp;&amp;'"'==e[0])for(var i,s=/"((?:[^\\"]|\\\\|\\")*)"/g;i=s.exec(e);){var r=i[1].replace(/\\([\\"])/g,"$1");void 0!==r&amp;&amp;t.push(r)}else t.push(e);return new x3dom.fields.MFString(t)},x3dom.fields.MFString.prototype.copy=function(){return x3dom.fields.MFString.copy(this)},x3dom.fields.MFString.prototype.setValueByStr=function(e){if(this.length=0,e.length&amp;&amp;'"'==e[0])for(var t,i=/"((?:[^\\"]|\\\\|\\")*)"/g;t=i.exec(e);){var s=t[1].replace(/\\([\\"])/,"$1");void 0!==s&amp;&amp;this.push(s)}else this.push(e);return this},x3dom.fields.MFString.prototype.toString=function(){for(var e="",t=0,i=this.length;t&lt;i;t++)e=e+this[t]+" ";return e},x3dom.fields.SFNode=function(e){this.type=e,this.node=null},x3dom.fields.SFNode.prototype.hasLink=function(e){return e?this.node===e:this.node},x3dom.fields.SFNode.prototype.addLink=function(e){return this.node=e,!0},x3dom.fields.SFNode.prototype.rmLink=function(e){return this.node===e&amp;&amp;(this.node=null,!0)},x3dom.fields.MFNode=function(e){this.type=e,this.nodes=[]},x3dom.fields.MFNode.prototype.hasLink=function(e){if(!e)return this.length&gt;0;for(var t=0,i=this.nodes.length;t&lt;i;t++)if(this.nodes[t]===e)return!0;return!1},x3dom.fields.MFNode.prototype.addLink=function(e){return this.nodes.push(e),!0},x3dom.fields.MFNode.prototype.rmLink=function(e){for(var t=0,i=this.nodes.length;t&lt;i;t++)if(this.nodes[t]===e)return this.nodes.splice(t,1),!0;return!1},x3dom.fields.MFNode.prototype.length=function(){return this.nodes.length},x3dom.fields.Line=function(e,t){0===arguments.length&amp;&amp;(this.pos=new x3dom.fields.SFVec3f(0,0,0),this.dir=new x3dom.fields.SFVec3f(0,0,1)),this.pos=x3dom.fields.SFVec3f.copy(e),this.dir=x3dom.fields.SFVec3f.copy(t)},x3dom.fields.Line.prototype.closestPoint=function(e){var t=e.subtract(this.pos).dot(this.dir);return this.pos.add(this.dir.multiply(t))},x3dom.fields.Line.prototype.shortestDistance=function(e){var t=e.subtract(this.pos),i=t.dot(this.dir);return t.subtract(this.dir.multiply(i)).length()},x3dom.fields.Ray=function(e,t){if(0===arguments.length)this.pos=new x3dom.fields.SFVec3f(0,0,0),this.dir=new x3dom.fields.SFVec3f(0,0,1);else{this.pos=new x3dom.fields.SFVec3f(e.x,e.y,e.z);var i=t.length();i&amp;&amp;(i=1/i),this.dir=new x3dom.fields.SFVec3f(t.x*i,t.y*i,t.z*i)}this.enter=0,this.exit=0,this.hitObject=null,this.hitPoint={},this.dist=Number.MAX_VALUE},x3dom.fields.Ray.prototype.toString=function(){return"Ray: ["+this.pos.toString()+"; "+this.dir.toString()+"]"},x3dom.fields.Ray.prototype.intersectPlane=function(e,t){var i,s=null,r=t.dot(this.dir);return r&lt;0&amp;&amp;(i=(e.dot(t)-this.pos.dot(t))/r,s=this.pos.addScaled(this.dir,i)),s},x3dom.fields.Ray.prototype.intersect=function(e,t){var i,s,r,o=0,n=Number.MAX_VALUE;if(this.dir.x&gt;x3dom.fields.Eps)i=1/this.dir.x,s=(e.x-this.pos.x)*i,(r=(t.x-this.pos.x)*i)&lt;n&amp;&amp;(n=r),s&gt;o&amp;&amp;(o=s);else if(this.dir.x&lt;-x3dom.fields.Eps)i=1/this.dir.x,s=(t.x-this.pos.x)*i,(r=(e.x-this.pos.x)*i)&lt;n&amp;&amp;(n=r),s&gt;o&amp;&amp;(o=s);else if(this.pos.x&lt;e.x||this.pos.x&gt;t.x)return!1;if(this.dir.y&gt;x3dom.fields.Eps){if(i=1/this.dir.y,s=(e.y-this.pos.y)*i,(r=(t.y-this.pos.y)*i)&lt;n&amp;&amp;(n=r),s&gt;o&amp;&amp;(o=s),o-n&gt;=x3dom.fields.Eps)return!1}else if(this.dir.y&lt;-x3dom.fields.Eps){if(i=1/this.dir.y,s=(t.y-this.pos.y)*i,(r=(e.y-this.pos.y)*i)&lt;n&amp;&amp;(n=r),s&gt;o&amp;&amp;(o=s),o-n&gt;=x3dom.fields.Eps)return!1}else if(this.pos.y&lt;e.y||this.pos.y&gt;t.y)return!1;if(this.dir.z&gt;x3dom.fields.Eps)i=1/this.dir.z,s=(e.z-this.pos.z)*i,(r=(t.z-this.pos.z)*i)&lt;n&amp;&amp;(n=r),s&gt;o&amp;&amp;(o=s);else if(this.dir.z&lt;-x3dom.fields.Eps)i=1/this.dir.z,s=(t.z-this.pos.z)*i,(r=(e.z-this.pos.z)*i)&lt;n&amp;&amp;(n=r),s&gt;o&amp;&amp;(o=s);else if(this.pos.z&lt;e.z||this.pos.z&gt;t.z)return!1;return this.enter=o,this.exit=n,o-n&lt;x3dom.fields.Eps},x3dom.fields.BoxVolume=function(e,t){arguments.length&lt;2?(this.min=new x3dom.fields.SFVec3f(0,0,0),this.max=new x3dom.fields.SFVec3f(0,0,0),this.valid=!1):(this.min=x3dom.fields.SFVec3f.copy(e),this.max=x3dom.fields.SFVec3f.copy(t),this.valid=!0),this.updateInternals()},x3dom.fields.BoxVolume.prototype.getScalarValue=function(){var e=this.max.subtract(this.min);return e.x*e.y*e.z},x3dom.fields.BoxVolume.copy=function(e){var t=new x3dom.fields.BoxVolume(e.min,e.max);return t.valid=e.valid,t},x3dom.fields.BoxVolume.prototype.equals=function(e){return this.min.equals(e.min,1e-12)&amp;&amp;this.max.equals(e.max,1e-12)},x3dom.fields.BoxVolume.prototype.updateInternals=function(){this.radialVec=this.max.subtract(this.min).multiply(.5),this.center=this.min.add(this.radialVec),this.diameter=2*this.radialVec.length()},x3dom.fields.BoxVolume.prototype.setBounds=function(e,t){this.min.setValues(e),this.max.setValues(t),this.updateInternals(),this.valid=!0},x3dom.fields.BoxVolume.prototype.setBoundsByCenterSize=function(e,t){var i=t.multiply(.5);this.min=e.subtract(i),this.max=e.add(i),this.updateInternals(),this.valid=!0},x3dom.fields.BoxVolume.prototype.extendBounds=function(e,t){this.valid?(this.min.x&gt;e.x&amp;&amp;(this.min.x=e.x),this.min.y&gt;e.y&amp;&amp;(this.min.y=e.y),this.min.z&gt;e.z&amp;&amp;(this.min.z=e.z),this.max.x&lt;t.x&amp;&amp;(this.max.x=t.x),this.max.y&lt;t.y&amp;&amp;(this.max.y=t.y),this.max.z&lt;t.z&amp;&amp;(this.max.z=t.z),this.updateInternals()):this.setBounds(e,t)},x3dom.fields.BoxVolume.prototype.getBounds=function(e,t){e.setValues(this.min),t.setValues(this.max)},x3dom.fields.BoxVolume.prototype.getRadialVec=function(){return this.radialVec},x3dom.fields.BoxVolume.prototype.invalidate=function(){this.valid=!1,this.min=new x3dom.fields.SFVec3f(0,0,0),this.max=new x3dom.fields.SFVec3f(0,0,0),this.updateInternals()},x3dom.fields.BoxVolume.prototype.isValid=function(){return this.valid},x3dom.fields.BoxVolume.prototype.getCenter=function(){return this.center},x3dom.fields.BoxVolume.prototype.getDiameter=function(){return this.diameter},x3dom.fields.BoxVolume.prototype.transform=function(e){var t,i,s,r,o,n;t=r=e._03,i=o=e._13,s=n=e._23;var a=this.max.x*e._00,h=this.min.x*e._00;a&gt;=h?(r+=a,t+=h):(r+=h,t+=a),(a=this.max.y*e._01)&gt;=(h=this.min.y*e._01)?(r+=a,t+=h):(r+=h,t+=a),(a=this.max.z*e._02)&gt;=(h=this.min.z*e._02)?(r+=a,t+=h):(r+=h,t+=a),(a=this.max.x*e._10)&gt;=(h=this.min.x*e._10)?(o+=a,i+=h):(o+=h,i+=a),(a=this.max.y*e._11)&gt;=(h=this.min.y*e._11)?(o+=a,i+=h):(o+=h,i+=a),(a=this.max.z*e._12)&gt;=(h=this.min.z*e._12)?(o+=a,i+=h):(o+=h,i+=a),(a=this.max.x*e._20)&gt;=(h=this.min.x*e._20)?(n+=a,s+=h):(n+=h,s+=a),(a=this.max.y*e._21)&gt;=(h=this.min.y*e._21)?(n+=a,s+=h):(n+=h,s+=a),(a=this.max.z*e._22)&gt;=(h=this.min.z*e._22)?(n+=a,s+=h):(n+=h,s+=a),this.min.x=t,this.min.y=i,this.min.z=s,this.max.x=r,this.max.y=o,this.max.z=n,this.updateInternals()},x3dom.fields.BoxVolume.prototype.transformFrom=function(e,t){var i,s,r,o,n,a;i=o=e._03,s=n=e._13,r=a=e._23;var h=t.max.x*e._00,d=t.min.x*e._00;h&gt;=d?(o+=h,i+=d):(o+=d,i+=h),(h=t.max.y*e._01)&gt;=(d=t.min.y*e._01)?(o+=h,i+=d):(o+=d,i+=h),(h=t.max.z*e._02)&gt;=(d=t.min.z*e._02)?(o+=h,i+=d):(o+=d,i+=h),(h=t.max.x*e._10)&gt;=(d=t.min.x*e._10)?(n+=h,s+=d):(n+=d,s+=h),(h=t.max.y*e._11)&gt;=(d=t.min.y*e._11)?(n+=h,s+=d):(n+=d,s+=h),(h=t.max.z*e._12)&gt;=(d=t.min.z*e._12)?(n+=h,s+=d):(n+=d,s+=h),(h=t.max.x*e._20)&gt;=(d=t.min.x*e._20)?(a+=h,r+=d):(a+=d,r+=h),(h=t.max.y*e._21)&gt;=(d=t.min.y*e._21)?(a+=h,r+=d):(a+=d,r+=h),(h=t.max.z*e._22)&gt;=(d=t.min.z*e._22)?(a+=h,r+=d):(a+=d,r+=h),this.min.x=i,this.min.y=s,this.min.z=r,this.max.x=o,this.max.y=n,this.max.z=a,this.updateInternals(),this.valid=!0},x3dom.fields.FrustumVolume=function(e){if(this.planeNormals=[],this.planeDistances=[],this.directionIndex=[],0!==arguments.length){for(var t=[],i=0;i&lt;6;i++)this.planeNormals[i]=new x3dom.fields.SFVec3f(0,0,0),this.planeDistances[i]=0,this.directionIndex[i]=0,t[i]=new x3dom.fields.SFVec4f(0,0,0,0);for(t[0].x=e._30-e._00,t[0].y=e._31-e._01,t[0].z=e._32-e._02,t[0].w=e._33-e._03,t[1].x=e._30+e._00,t[1].y=e._31+e._01,t[1].z=e._32+e._02,t[1].w=e._33+e._03,t[2].x=e._30+e._10,t[2].y=e._31+e._11,t[2].z=e._32+e._12,t[2].w=e._33+e._13,t[3].x=e._30-e._10,t[3].y=e._31-e._11,t[3].z=e._32-e._12,t[3].w=e._33-e._13,t[4].x=e._30+e._20,t[4].y=e._31+e._21,t[4].z=e._32+e._22,t[4].w=e._33+e._23,t[5].x=e._30-e._20,t[5].y=e._31-e._21,t[5].z=e._32-e._22,t[5].w=e._33-e._23,i=0;i&lt;6;i++){var s=Math.sqrt(t[i].x*t[i].x+t[i].y*t[i].y+t[i].z*t[i].z);t[i].x/=s,t[i].y/=s,t[i].z/=s,t[i].w/=-s}var r=function(e){var t=0;return e.x&gt;0&amp;&amp;(t|=1),e.y&gt;0&amp;&amp;(t|=2),e.z&gt;0&amp;&amp;(t|=4),t};this.planeNormals[3].setValues(t[0]),this.planeDistances[3]=t[0].w,this.directionIndex[3]=r(this.planeNormals[3]),this.planeNormals[2].setValues(t[1]),this.planeDistances[2]=t[1].w,this.directionIndex[2]=r(this.planeNormals[2]),this.planeNormals[5].setValues(t[2]),this.planeDistances[5]=t[2].w,this.directionIndex[5]=r(this.planeNormals[5]),this.planeNormals[4].setValues(t[3]),this.planeDistances[4]=t[3].w,this.directionIndex[4]=r(this.planeNormals[4]),this.planeNormals[0].setValues(t[4]),this.planeDistances[0]=t[4].w,this.directionIndex[0]=r(this.planeNormals[0]),this.planeNormals[1].setValues(t[5]),this.planeDistances[1]=t[5].w,this.directionIndex[1]=r(this.planeNormals[1])}},x3dom.fields.FrustumVolume.prototype.intersect=function(e,t){if(this.planeNormals.length&lt;6)return x3dom.debug.logWarning("FrustumVolume not initialized!"),!1;var i=this,s=e.min,r=e.max,o=function(e){var t=new x3dom.fields.SFVec3f(0,0,0);return t.x=1&amp;e?s.x:r.x,t.y=2&amp;e?s.y:r.y,t.z=4&amp;e?s.z:r.z,t},n=function(e,t){return i.planeNormals[e].dot(t)-i.planeDistances[e]&gt;=0},a=function(e){var t=o(i.directionIndex[e]);return n(e,t)},h=function(e){var t=o(7^i.directionIndex[e]);return!n(e,t)},d=1;t&lt;0&amp;&amp;(t=0);for(var l=0;l&lt;6;l++,d&lt;&lt;=1)if(0==(t&amp;d)){if(h(l))return-1;a(l)&amp;&amp;(t|=d)}return t},x3dom.docs={},x3dom.docs.specURLMap={CADGeometry:"CADGeometry.html",Core:"core.html",DIS:"dis.html",CubeMapTexturing:"env_texture.html",EnvironmentalEffects:"enveffects.html",EnvironmentalSensor:"envsensor.html",Followers:"followers.html",Geospatial:"geodata.html",Geometry2D:"geometry2D.html",Geometry3D:"geometry3D.html",Grouping:"group.html","H-Anim":"hanim.html",Interpolation:"interp.html",KeyDeviceSensor:"keyboard.html",Layering:"layering.html",Layout:"layout.html",Lighting:"lighting.html",Navigation:"navigation.html",Networking:"networking.html",NURBS:"nurbs.html",ParticleSystems:"particle_systems.html",Picking:"picking.html",PointingDeviceSensor:"pointingsensor.html",Rendering:"rendering.html",RigidBodyPhysics:"rigid_physics.html",Scripting:"scripting.html",Shaders:"shaders.html",Shape:"shape.html",Sound:"sound.html",Text:"text.html",Texturing3D:"texture3D.html",Texturing:"texturing.html",Time:"time.html",EventUtilities:"utils.html",VolumeRendering:"volume.html"},x3dom.docs.specBaseURL="http://www.web3d.org/x3d/specifications/ISO-IEC-19775-1.2-X3D-AbstractSpecification/Part01/components/",x3dom.docs.getNodeTreeInfo=function(){var e,t="",i=function(e,t){for(var i=0;i&lt;e.length;i++)if(e[i]===t)return!0;return!1};for(e in x3dom.nodeTypes){var s;for(void 0===(s=x3dom.nodeTypes[e]).childTypes&amp;&amp;(s.childTypes={});s.superClass;)void 0===s.superClass.childTypes[s.superClass._typeName]&amp;&amp;(s.superClass.childTypes[s.superClass._typeName]=[]),i(s.superClass.childTypes[s.superClass._typeName],s._typeName)||s.superClass.childTypes[s.superClass._typeName].push(s._typeName),s=s.superClass}return function e(i,s){for(var r=0;r&lt;s;r++)t+="&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;";for(var r in t+="&lt;a href='"+x3dom.docs.specBaseURL+x3dom.docs.specURLMap[x3dom.nodeTypes[i]._compName]+"#"+i+"' style='color:black; text-decoration:none; font-weight:bold;'&gt;"+i+"&lt;/a&gt; &amp;nbsp; &lt;a href='"+x3dom.docs.specBaseURL+x3dom.docs.specURLMap[x3dom.nodeTypes[i]._compName]+"' style='color:black; text-decoration:none; font-style:italic;'&gt;"+x3dom.nodeTypes[i]._compName+"&lt;/a&gt;&lt;br/&gt;",x3dom.nodeTypes[i].childTypes[i])e(x3dom.nodeTypes[i].childTypes[i][r],s+1)}("X3DNode",0),"&lt;div class='x3dom-doc-nodes-tree'&gt;"+t+"&lt;/div&gt;"},x3dom.docs.getComponentInfo=function(){var e,t,i,s=[],r="";for(t in x3dom.components)s.push(t);for(i in s.sort(),s){for(var o in t=s[i],e=x3dom.components[t],r+="&lt;h2&gt;&lt;a href='"+x3dom.docs.specBaseURL+x3dom.docs.specURLMap[t]+"' style='color:black; text-decoration:none; font-style:italic;'&gt;"+t+"&lt;/a&gt;&lt;/h2&gt;",r+="&lt;ul style='list-style-type:circle;'&gt;",e)r+="&lt;li&gt;&lt;a href='"+x3dom.docs.specBaseURL+x3dom.docs.specURLMap[t]+"#"+o+"' style='color:black; text-decoration:none; font-weight:bold;'&gt;"+o+"&lt;/a&gt;&lt;/li&gt;";r+="&lt;/ul&gt;"}return r},x3dom.shader={},x3dom.shader.PICKING="picking",x3dom.shader.PICKING_24="picking24",x3dom.shader.PICKING_ID="pickingId",x3dom.shader.PICKING_COLOR="pickingColor",x3dom.shader.PICKING_TEXCOORD="pickingTexCoord",x3dom.shader.FRONTGROUND_TEXTURE="frontgroundTexture",x3dom.shader.BACKGROUND_TEXTURE="backgroundTexture",x3dom.shader.BACKGROUND_SKYTEXTURE="backgroundSkyTexture",x3dom.shader.BACKGROUND_CUBETEXTURE="backgroundCubeTexture",x3dom.shader.BLUR="blur",x3dom.shader.DEPTH="depth",x3dom.shader.NORMAL="normal",x3dom.shader.TEXTURE_REFINEMENT="textureRefinement",x3dom.shader.SSAO="ssao",x3dom.shader.material=function(){return"uniform vec3  diffuseColor;\nuniform vec3  specularColor;\nuniform vec3  emissiveColor;\nuniform float shininess;\nuniform float transparency;\nuniform float ambientIntensity;\n"},x3dom.shader.twoSidedMaterial=function(){return"uniform vec3  backDiffuseColor;\nuniform vec3  backSpecularColor;\nuniform vec3  backEmissiveColor;\nuniform float backShininess;\nuniform float backTransparency;\nuniform float backAmbientIntensity;\n"},x3dom.shader.fog=function(){return"uniform vec3  fogColor;\nuniform float fogType;\nuniform float fogRange;\nvarying vec3 fragEyePosition;\nfloat calcFog(in vec3 eye) {\n   float f0 = 0.0;\n   if(fogType == 0.0) {\n       if(length(eye) &lt; fogRange){\n           f0 = (fogRange-length(eye)) / fogRange;\n       }\n   }else{\n       if(length(eye) &lt; fogRange){\n           f0 = exp(-length(eye) / (fogRange-length(eye) ) );\n       }\n   }\n   f0 = clamp(f0, 0.0, 1.0);\n   return f0;\n}\n"},x3dom.shader.clipPlanes=function(e){var t,i="";for(t=0;t&lt;e;t++)i+="uniform vec4 clipPlane"+t+"_Plane;\n",i+="uniform float clipPlane"+t+"_CappingStrength;\n",i+="uniform vec3 clipPlane"+t+"_CappingColor;\n";for(i+="vec3 calculateClipPlanes() {\n",t=0;t&lt;e;t++)i+="    vec4 clipPlane"+t+" = clipPlane"+t+"_Plane * viewMatrixInverse;\n",i+="    float dist"+t+" = dot(fragPosition, clipPlane"+t+");\n";for(i+="    if( ",t=0;t&lt;e;t++)0!=t&amp;&amp;(i+=" || "),i+="dist"+t+" &lt; 0.0";for(i+=" ) ",i+="{ discard; }\n",t=0;t&lt;e;t++)i+="    if( abs(dist"+t+") &lt; clipPlane"+t+"_CappingStrength ) ",i+="{ return clipPlane"+t+"_CappingColor; }\n";return i+="    return vec3(-1.0, -1.0, -1.0);\n",i+="}\n"},x3dom.shader.gammaCorrectionDecl=function(e){var t="";return"none"===e.GAMMACORRECTION||("fastlinear"===e.GAMMACORRECTION?(t+="vec4 gammaEncode(vec4 color){\n  vec4 tmp = sqrt(color);\n  return vec4(tmp.rgb, color.a);\n}\n",t+="vec4 gammaDecode(vec4 color){\n  vec4 tmp = color * color;\n  return vec4(tmp.rgb, color.a);\n}\n",t+="vec3 gammaEncode(vec3 color){\n  return sqrt(color);\n}\n",t+="vec3 gammaDecode(vec3 color){\n  return (color * color);\n}\n"):(t+="const vec4 gammaEncode4Vector = vec4(0.4545454545454545, 0.4545454545454545, 0.4545454545454545, 1.0);\n",t+="const vec4 gammaDecode4Vector = vec4(2.2, 2.2, 2.2, 1.0);\n",t+="vec4 gammaEncode(vec4 color){\n    return pow(color, gammaEncode4Vector);\n}\n",t+="vec4 gammaDecode(vec4 color){\n    return pow(color, gammaDecode4Vector);\n}\n",t+="const vec3 gammaEncode3Vector = vec3(0.4545454545454545, 0.4545454545454545, 0.4545454545454545);\n",t+="const vec3 gammaDecode3Vector = vec3(2.2, 2.2, 2.2);\n",t+="vec3 gammaEncode(vec3 color){\n    return pow(color, gammaEncode3Vector);\n}\n",t+="vec3 gammaDecode(vec3 color){\n    return pow(color, gammaDecode3Vector);\n}\n")),t},x3dom.shader.encodeGamma=function(e,t){return"none"===e.GAMMACORRECTION?t:"gammaEncode ("+t+")"},x3dom.shader.decodeGamma=function(e,t){return"none"===e.GAMMACORRECTION?t:"gammaDecode ("+t+")"},x3dom.shader.rgbaPacking=function(){return"vec4 packDepth(float depth){\n depth = (depth + 1.0)*0.5;\n vec4 outVal = vec4(1.0, 255.0, 65025.0, 160581375.0) * depth;\n outVal = fract(outVal);\n   outVal -= outVal.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);\n   return outVal;\n}\n","float unpackDepth(vec4 color){\n float depth = dot(color, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/160581375.0));\n return (2.0*depth - 1.0);\n}\n","vec4 packDepth(float depth){\n depth = (depth + 1.0)*0.5;\n vec4 outVal = vec4(1.0, 255.0, 65025.0, 160581375.0) * depth;\n outVal = fract(outVal);\n   outVal -= outVal.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);\n   return outVal;\n}\nfloat unpackDepth(vec4 color){\n float depth = dot(color, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/160581375.0));\n return (2.0*depth - 1.0);\n}\n"},x3dom.shader.shadowRendering=function(){var e="";return e+="float getLightInfluence(float lType, float lShadowIntensity, float lOn, vec3 lLocation, vec3 lDirection, float lCutOffAngle, float lBeamWidth, vec3 lAttenuation, float lRadius, vec3 eyeCoords) {\n if (lOn == 0.0 || lShadowIntensity == 0.0){ return 0.0;\n } else if (lType == 0.0) {\n  return 1.0;\n } else {\n    float attenuation = 0.0;\n    vec3 lightVec = (lLocation - (eyeCoords));\n    float distance = length(lightVec);\n  lightVec = normalize(lightVec);\n  eyeCoords = normalize(-eyeCoords);\n    if(lRadius == 0.0 || distance &lt;= lRadius) {\n        attenuation = 1.0 / max(lAttenuation.x + lAttenuation.y * distance + lAttenuation.z * (distance * distance), 1.0);\n  }\n   if (lType == 1.0) return attenuation;\n    float spotAngle = acos(max(0.0, dot(-lightVec, normalize(lDirection))));\n    if(spotAngle &gt;= lCutOffAngle) return 0.0;\n    else if(spotAngle &lt;= lBeamWidth) return attenuation;\n    else return attenuation * (spotAngle - lCutOffAngle) / (lBeamWidth - lCutOffAngle);\n }\n}\n",e+="void getShadowValues(inout vec4 shadowMapValues, inout float viewSampleDepth, in mat4 lightMatrix, in vec4 worldCoords, in sampler2D shadowMap){\n vec4 lightSpaceCoords = lightMatrix*worldCoords;\n vec3 lightSpaceCoordsCart = lightSpaceCoords.xyz / lightSpaceCoords.w;\n vec2 textureCoords = (lightSpaceCoordsCart.xy + 1.0)*0.5;\n viewSampleDepth = lightSpaceCoordsCart.z;\n shadowMapValues = texture2D(shadowMap, textureCoords);\n",x3dom.caps.FP_TEXTURES&amp;&amp;!x3dom.caps.MOBILE||(e+=" shadowMapValues = vec4(1.0,1.0,unpackDepth(shadowMapValues),1.0);\n"),e+="}\n",e+="void getShadowValuesPointLight(inout vec4 shadowMapValues, inout float viewSampleDepth, in vec3 lLocation, in vec4 worldCoords, in mat4 lightViewMatrix,in mat4 lMatrix_0, in mat4 lMatrix_1, in mat4 lMatrix_2, in mat4 lMatrix_3, in mat4 lMatrix_4, in mat4 lMatrix_5,in sampler2D shadowMap_0, in sampler2D shadowMap_1, in sampler2D shadowMap_2, in sampler2D shadowMap_3,in sampler2D shadowMap_4, in sampler2D shadowMap_5){\n vec4 transformed = lightViewMatrix * worldCoords;\n vec3 lightVec = normalize(transformed.xyz/transformed.w);\n vec3 lightVecAbs = abs(lightVec);\n float maximum = max(max(lightVecAbs.x, lightVecAbs.y),lightVecAbs.z);\n if (lightVecAbs.x == maximum) {\n  if (lightVec.x &lt; 0.0) getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_3,worldCoords,shadowMap_3);\n  else getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_1,worldCoords,shadowMap_1);\n }\n else if (lightVecAbs.y == maximum) {\n  if (lightVec.y &lt; 0.0) getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_4,worldCoords,shadowMap_4);\n  else getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_5,worldCoords,shadowMap_5);\n }\n else if (lightVec.z &lt; 0.0) getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_0,worldCoords,shadowMap_0);\n else getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_2,worldCoords,shadowMap_2);\n}\n",e+="void getShadowValuesCascaded(inout vec4 shadowMapValues, inout float viewSampleDepth, in vec4 worldCoords, in float eyeDepth, in mat4 lMatrix_0, in mat4 lMatrix_1, in mat4 lMatrix_2,in mat4 lMatrix_3, in mat4 lMatrix_4, in mat4 lMatrix_5, in sampler2D shadowMap_0, in sampler2D shadowMap_1, in sampler2D shadowMap_2,in sampler2D shadowMap_3, in sampler2D shadowMap_4, in sampler2D shadowMap_5, in float split_0, in float split_1, in float split_2, in float split_3, in float split_4){\n if (eyeDepth &lt; split_0) getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_0, worldCoords, shadowMap_0);\n else if (eyeDepth &lt; split_1) getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_1, worldCoords, shadowMap_1);\n else if (eyeDepth &lt; split_2) getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_2, worldCoords, shadowMap_2);\n else if (eyeDepth &lt; split_3) getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_3, worldCoords, shadowMap_3);\n else if (eyeDepth &lt; split_4) getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_4, worldCoords, shadowMap_4);\n else getShadowValues(shadowMapValues, viewSampleDepth, lMatrix_5, worldCoords, shadowMap_5);\n}\n",e+="float ESM(float shadowMapDepth, float viewSampleDepth, float offset){\n",!x3dom.caps.FP_TEXTURES||x3dom.caps.MOBILE?e+=" return exp(-80.0*(1.0-offset)*(viewSampleDepth - shadowMapDepth));\n":e+=" return shadowMapDepth * exp(-80.0*(1.0-offset)*viewSampleDepth);\n",e+="}\n",e+="float VSM(vec2 moments, float viewSampleDepth, float offset){\n viewSampleDepth = (viewSampleDepth + 1.0) * 0.5;\n if (viewSampleDepth &lt;= moments.x) return 1.0;\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.00002 + offset*0.01);\n float d = viewSampleDepth - moments.x;\n return variance/(variance + d*d);\n}\n"},x3dom.shader.light=function(e){for(var t="",i=0;i&lt;e;i++)t+="uniform float light"+i+"_On;\nuniform float light"+i+"_Type;\nuniform vec3  light"+i+"_Location;\nuniform vec3  light"+i+"_Direction;\nuniform vec3  light"+i+"_Color;\nuniform vec3  light"+i+"_Attenuation;\nuniform float light"+i+"_Radius;\nuniform float light"+i+"_Intensity;\nuniform float light"+i+"_AmbientIntensity;\nuniform float light"+i+"_BeamWidth;\nuniform float light"+i+"_CutOffAngle;\nuniform float light"+i+"_ShadowIntensity;\n";return t+="vec3 lighting(in float lType, in vec3 lLocation, in vec3 lDirection, in vec3 lColor, in vec3 lAttenuation, in float lRadius, in float lIntensity, in float lAmbientIntensity, in float lBeamWidth, in float lCutOffAngle, in vec3 N, in vec3 V, float shin, float ambIntensity)\n{\n   vec3 L;\n   float spot = 1.0, attentuation = 0.0;\n   if(lType == 0.0) {\n       L = -normalize(lDirection);\n  V = normalize(V);\n  attentuation = 1.0;\n   } else{\n       L = (lLocation - (-V));\n       float d = length(L);\n  L = normalize(L);\n  V = normalize(V);\n       if(lRadius == 0.0 || d &lt;= lRadius) {\n        attentuation = 1.0 / max(lAttenuation.x + lAttenuation.y * d + lAttenuation.z * (d * d), 1.0);\n  }\n       if(lType == 2.0) {\n           float spotAngle = acos(max(0.0, dot(-L, normalize(lDirection))));\n           if(spotAngle &gt;= lCutOffAngle) spot = 0.0;\n           else if(spotAngle &lt;= lBeamWidth) spot = 1.0;\n           else spot = (spotAngle - lCutOffAngle ) / (lBeamWidth - lCutOffAngle);\n       }\n   }\n   vec3  H = normalize( L + V );\n   float NdotL = clamp(dot(L, N), 0.0, 1.0);\n   float NdotH = clamp(dot(H, N), 0.0, 1.0);\n   float ambientFactor  = lAmbientIntensity * ambIntensity;\n   float diffuseFactor  = lIntensity * NdotL;\n   float specularFactor = lIntensity * pow(NdotH, shin*128.0);\n   return vec3(ambientFactor, diffuseFactor, specularFactor) * attentuation * spot;\n}\n"},x3dom.shader.TBNCalculation=function(){return"mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv)\n{\n    // get edge vectors of the pixel triangle\n    vec3 dp1 = dFdx( p );\n    vec3 dp2 = dFdy( p );\n    vec2 duv1 = dFdx( uv );\n    vec2 duv2 = dFdy( uv );\n\n    // solve the linear system\n    vec3 dp2perp = cross( dp2, N );\n    vec3 dp1perp = cross( N, dp1 );\n    vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n    vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n\n    // construct a scale-invariant frame\n    float invmax = inversesqrt( max( dot(T,T), dot(B,B) ) );\n    return mat3( T * invmax, B * invmax, N );\n}\n\n","vec3 perturb_normal( vec3 N, vec3 V, vec2 texcoord )\n{\n    // assume N, the interpolated vertex normal and\n    // V, the view vector (vertex to eye)\n    vec3 map = texture2D(normalMap, texcoord ).xyz;\n    map = 2.0 * map - 1.0;\n    mat3 TBN = cotangent_frame(N, -V, texcoord);\n    return normalize(TBN * map);\n}\n\n","mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv)\n{\n    // get edge vectors of the pixel triangle\n    vec3 dp1 = dFdx( p );\n    vec3 dp2 = dFdy( p );\n    vec2 duv1 = dFdx( uv );\n    vec2 duv2 = dFdy( uv );\n\n    // solve the linear system\n    vec3 dp2perp = cross( dp2, N );\n    vec3 dp1perp = cross( N, dp1 );\n    vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n    vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n\n    // construct a scale-invariant frame\n    float invmax = inversesqrt( max( dot(T,T), dot(B,B) ) );\n    return mat3( T * invmax, B * invmax, N );\n}\n\nvec3 perturb_normal( vec3 N, vec3 V, vec2 texcoord )\n{\n    // assume N, the interpolated vertex normal and\n    // V, the view vector (vertex to eye)\n    vec3 map = texture2D(normalMap, texcoord ).xyz;\n    map = 2.0 * map - 1.0;\n    mat3 TBN = cotangent_frame(N, -V, texcoord);\n    return normalize(TBN * map);\n}\n\n"},x3dom.shader.DynamicShader=function(e,t){this.program=e.createProgram();var i=this.generateVertexShader(e,t),s=this.generateFragmentShader(e,t);return e.attachShader(this.program,i),e.attachShader(this.program,s),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.DynamicShader.prototype.generateVertexShader=function(e,t){var i="";if(i+="uniform mat4 modelViewMatrix;\n",i+="uniform mat4 modelViewProjectionMatrix;\n",3==t.POSCOMPONENTS?i+="attribute vec3 position;\n":4==t.POSCOMPONENTS&amp;&amp;(i+="attribute vec4 position;\n"),t.IMAGEGEOMETRY){i+="uniform vec3 IG_bboxMin;\n",i+="uniform vec3 IG_bboxMax;\n",i+="uniform float IG_coordTextureWidth;\n",i+="uniform float IG_coordTextureHeight;\n",i+="uniform vec2 IG_implicitMeshSize;\n";for(var s=0;s&lt;t.IG_PRECISION;s++)i+="uniform sampler2D IG_coords"+s+"\n;";t.IG_INDEXED&amp;&amp;(i+="uniform sampler2D IG_index;\n",i+="uniform float IG_indexTextureWidth;\n",i+="uniform float IG_indexTextureHeight;\n")}if(t.POPGEOMETRY&amp;&amp;(i+="uniform float PG_precisionLevel;\n",i+="uniform float PG_powPrecision;\n",i+="uniform vec3 PG_maxBBSize;\n",i+="uniform vec3 PG_bbMin;\n",i+="uniform vec3 PG_bbMaxModF;\n",i+="uniform vec3 PG_bboxShiftVec;\n",i+="uniform float PG_numAnchorVertices;\n",i+="attribute float PG_vertexID;\n"),t.LIGHTS&amp;&amp;(t.NORMALMAP&amp;&amp;"OBJECT"==t.NORMALSPACE||(i+="varying vec3 fragNormal;\n",i+="uniform mat4 normalMatrix;\n",t.IMAGEGEOMETRY?i+="uniform sampler2D IG_normals;\n":2==t.NORCOMPONENTS?4!=t.POSCOMPONENTS&amp;&amp;(i+="attribute vec2 normal;\n"):3==t.NORCOMPONENTS&amp;&amp;(i+="attribute vec3 normal;\n"))),t.VERTEXCOLOR&amp;&amp;(t.IMAGEGEOMETRY?(i+="uniform sampler2D IG_colors;\n",3==t.COLCOMPONENTS?i+="varying vec3 fragColor;\n":4==t.COLCOMPONENTS&amp;&amp;(i+="varying vec4 fragColor;\n")):3==t.COLCOMPONENTS?(i+="attribute vec3 color;\n",i+="varying vec3 fragColor;\n"):4==t.COLCOMPONENTS&amp;&amp;(i+="attribute vec4 color;\n",i+="varying vec4 fragColor;\n")),t.TEXTURED&amp;&amp;(i+="varying vec2 fragTexcoord;\n",t.SPHEREMAPPING||(t.IMAGEGEOMETRY?i+="uniform sampler2D IG_texCoords;\n":t.IS_PARTICLE||(i+="attribute vec2 texcoord;\n")),t.TEXTRAFO&amp;&amp;(i+="uniform mat4 texTrafoMatrix;\n"),t.NORMALMAP&amp;&amp;"TANGENT"==t.NORMALSPACE&amp;&amp;!x3dom.caps.STD_DERIVATIVES&amp;&amp;(x3dom.debug.logWarning("Your System doesn't support the 'OES_STANDARD_DERIVATIVES' Extension. You must set tangents and binormals manually via the FloatVertexAttribute-Node to use normal maps"),i+="attribute vec3 tangent;\n",i+="attribute vec3 binormal;\n",i+="varying vec3 fragTangent;\n",i+="varying vec3 fragBinormal;\n"),t.CUBEMAP&amp;&amp;(i+="varying vec3 fragViewDir;\n",i+="uniform mat4 viewMatrix;\n"),t.DISPLACEMENTMAP&amp;&amp;(i+="uniform sampler2D displacementMap;\n",i+="uniform float displacementFactor;\n",i+="uniform float displacementWidth;\n",i+="uniform float displacementHeight;\n",i+="uniform float displacementAxis;\n"),t.DIFFPLACEMENTMAP&amp;&amp;(i+="uniform sampler2D diffuseDisplacementMap;\n",i+="uniform float displacementFactor;\n",i+="uniform float displacementWidth;\n",i+="uniform float displacementHeight;\n",i+="uniform float displacementAxis;\n")),t.VERTEXID&amp;&amp;(i+="attribute float id;\n",i+="varying float fragID;\n"),t.IS_PARTICLE&amp;&amp;(i+="attribute vec3 particleSize;\n"),(t.LIGHTS||t.FOG||t.CLIPPLANES)&amp;&amp;(i+="uniform vec3 eyePosition;\n",i+="varying vec4 fragPosition;\n",t.FOG&amp;&amp;(i+="varying vec3 fragEyePosition;\n")),t.REQUIREBBOX&amp;&amp;(i+="uniform vec3 bgCenter;\n",i+="uniform vec3 bgSize;\n",i+="uniform float bgPrecisionMax;\n"),t.REQUIREBBOXNOR&amp;&amp;(i+="uniform float bgPrecisionNorMax;\n"),t.REQUIREBBOXCOL&amp;&amp;(i+="uniform float bgPrecisionColMax;\n"),t.REQUIREBBOXTEX&amp;&amp;(i+="uniform float bgPrecisionTexMax;\n"),i+="void main(void) {\n",t.IMAGEGEOMETRY){t.IG_INDEXED?(i+="vec2 halfPixel = vec2(0.5/IG_indexTextureWidth,0.5/IG_indexTextureHeight);\n",i+="vec2 IG_texCoord = vec2(position.x*(IG_implicitMeshSize.x/IG_indexTextureWidth), position.y*(IG_implicitMeshSize.y/IG_indexTextureHeight)) + halfPixel;\n",i+="vec2 IG_indices = texture2D( IG_index, IG_texCoord ).rg;\n",i+="halfPixel = vec2(0.5/IG_coordTextureWidth,0.5/IG_coordTextureHeight);\n",i+="IG_texCoord = (IG_indices * 0.996108948) + halfPixel;\n"):(i+="vec2 halfPixel = vec2(0.5/IG_coordTextureWidth, 0.5/IG_coordTextureHeight);\n",i+="vec2 IG_texCoord = vec2(position.x*(IG_implicitMeshSize.x/IG_coordTextureWidth), position.y*(IG_implicitMeshSize.y/IG_coordTextureHeight)) + halfPixel;\n"),i+="vec3 temp = vec3(0.0, 0.0, 0.0);\n",i+="vec3 vertPosition = vec3(0.0, 0.0, 0.0);\n";for(s=0;s&lt;t.IG_PRECISION;s++)i+="temp = 255.0 * texture2D( IG_coords"+s+", IG_texCoord ).rgb;\n",i+="vertPosition *= 256.0;\n",i+="vertPosition += temp;\n";i+="vertPosition /= (pow(2.0, 8.0 * "+t.IG_PRECISION+".0) - 1.0);\n",i+="vertPosition = vertPosition * (IG_bboxMax - IG_bboxMin) + IG_bboxMin;\n",t.LIGHTS&amp;&amp;(i+="vec3 vertNormal = texture2D( IG_normals, IG_texCoord ).rgb;\n",i+="vertNormal = vertNormal * 2.0 - 1.0;\n"),t.VERTEXCOLOR&amp;&amp;(3==t.COLCOMPONENTS?i+="fragColor = texture2D( IG_colors, IG_texCoord ).rgb;\n":4==t.COLCOMPONENTS&amp;&amp;(i+="fragColor = texture2D( IG_colors, IG_texCoord ).rgba;\n")),t.TEXTURED&amp;&amp;(i+="vec4 IG_doubleTexCoords = texture2D( IG_texCoords, IG_texCoord );\n",i+="vec2 vertTexCoord;",i+="vertTexCoord.r = (IG_doubleTexCoords.r * 0.996108948) + (IG_doubleTexCoords.b * 0.003891051);\n",i+="vertTexCoord.g = (IG_doubleTexCoords.g * 0.996108948) + (IG_doubleTexCoords.a * 0.003891051);\n")}else i+="vec3 vertPosition = position.xyz;\n",t.POPGEOMETRY?(i+="vec3 offsetVec = step(vertPosition / bgPrecisionMax, PG_bbMaxModF) * PG_bboxShiftVec;\n",i+="if ((PG_precisionLevel &lt;= 2.0) || PG_vertexID &gt;= PG_numAnchorVertices) {\n",i+="   vertPosition = floor(vertPosition / PG_powPrecision) * PG_powPrecision;\n",i+="   vertPosition /= (65536.0 - PG_powPrecision);\n",i+="}\n",i+="else {\n",i+="   vertPosition /= bgPrecisionMax;\n",i+="}\n",i+="vertPosition = (vertPosition + offsetVec + PG_bbMin) * PG_maxBBSize;\n"):t.REQUIREBBOX&amp;&amp;(i+="vertPosition = bgCenter + bgSize * vertPosition / bgPrecisionMax;\n"),t.LIGHTS&amp;&amp;(2==t.NORCOMPONENTS?(4==t.POSCOMPONENTS?(i+="vec3 vertNormal = vec3(position.w / 256.0); \n",i+="vertNormal.x = floor(vertNormal.x) / 255.0; \n",i+="vertNormal.y = fract(vertNormal.y) * 1.00392156862745; \n"):t.REQUIREBBOXNOR&amp;&amp;(i+="vec3 vertNormal = vec3(normal.xy, 0.0) / bgPrecisionNorMax;\n"),i+="vec2 thetaPhi = 3.14159265358979 * vec2(vertNormal.x, vertNormal.y*2.0-1.0); \n",i+="vec4 sinCosThetaPhi = sin( vec4(thetaPhi, thetaPhi + 1.5707963267949) ); \n",i+="vertNormal.x = sinCosThetaPhi.x * sinCosThetaPhi.w; \n",i+="vertNormal.y = sinCosThetaPhi.x * sinCosThetaPhi.y; \n",i+="vertNormal.z = sinCosThetaPhi.z; \n"):t.NORMALMAP&amp;&amp;"OBJECT"==t.NORMALSPACE||(i+="vec3 vertNormal = normal;\n",t.REQUIREBBOXNOR&amp;&amp;(i+="vertNormal = vertNormal / bgPrecisionNorMax;\n"),t.POPGEOMETRY&amp;&amp;(i+="vertNormal = 2.0*vertNormal - 1.0;\n"))),t.VERTEXCOLOR&amp;&amp;(i+="fragColor = color;\n",t.REQUIREBBOXCOL&amp;&amp;(i+="fragColor = fragColor / bgPrecisionColMax;\n")),t.TEXTURED&amp;&amp;!t.SPHEREMAPPING&amp;&amp;(t.IS_PARTICLE?i+="vec2 vertTexCoord = vec2(0.0);\n":(i+="vec2 vertTexCoord = texcoord;\n",t.REQUIREBBOXTEX&amp;&amp;(i+="vertTexCoord = vertTexCoord / bgPrecisionTexMax;\n")));t.LIGHTS&amp;&amp;(!t.DISPLACEMENTMAP&amp;&amp;!t.DIFFPLACEMENTMAP||t.NORMALMAP?t.NORMALMAP&amp;&amp;"OBJECT"==t.NORMALSPACE||(i+="fragNormal = (normalMatrix * vec4(vertNormal, 0.0)).xyz;\n"):(i+="float dx = 1.0 / displacementWidth;\n",i+="float dy = 1.0 / displacementHeight;\n",t.DISPLACEMENTMAP?(i+="float s1 = texture2D(displacementMap, vec2(vertTexCoord.x - dx, 1.0 - vertTexCoord.y)).r;\n",i+="float s2 = texture2D(displacementMap, vec2(vertTexCoord.x, 1.0 - vertTexCoord.y - dy)).r;\n",i+="float s3 = texture2D(displacementMap, vec2(vertTexCoord.x + dx, 1.0 - vertTexCoord.y)).r;\n",i+="float s4 = texture2D(displacementMap, vec2(vertTexCoord.x, 1.0 - vertTexCoord.y + dy)).r;\n"):t.DIFFPLACEMENTMAP&amp;&amp;(i+="float s1 = texture2D(diffuseDisplacementMap, vec2(vertTexCoord.x - dx, 1.0 - vertTexCoord.y)).a;\n",i+="float s2 = texture2D(diffuseDisplacementMap, vec2(vertTexCoord.x, 1.0 - vertTexCoord.y - dy)).a;\n",i+="float s3 = texture2D(diffuseDisplacementMap, vec2(vertTexCoord.x + dx, 1.0 - vertTexCoord.y)).a;\n",i+="float s4 = texture2D(diffuseDisplacementMap, vec2(vertTexCoord.x, 1.0 - vertTexCoord.y + dy)).a;\n"),i+="float coef = displacementFactor;\n",i+="vec3 calcNormal;\n",i+="if (displacementAxis == 0.0) {\n",i+="calcNormal = vec3((s1 - s3) * coef, -5.0, (s2 - s4) * coef);\n",i+="} else if(displacementAxis == 1.0) {\n",i+="calcNormal = vec3((s1 - s3) * coef, -5.0, (s2 - s4) * coef);\n",i+="} else {\n",i+="calcNormal = vec3((s1 - s3) * coef, -(s2 - s4) * coef, 5.0);\n",i+="}\n",i+="calcNormal = normalize(calcNormal);\n",i+="fragNormal = (normalMatrix * vec4(calcNormal, 0.0)).xyz;\n")),t.TEXTURED&amp;&amp;(t.CUBEMAP&amp;&amp;(i+="fragViewDir = (viewMatrix[3].xyz);\n"),t.SPHEREMAPPING?i+=" fragTexcoord = 0.5 + fragNormal.xy / 2.0;\n":t.TEXTRAFO?i+=" fragTexcoord = (texTrafoMatrix * vec4(vertTexCoord, 1.0, 1.0)).xy;\n":(i+=" fragTexcoord = vertTexCoord;\n",t.POPGEOMETRY&amp;&amp;!0===x3dom.debug.usePrecisionLevelAsTexCoord&amp;&amp;(i+="fragTexcoord = vec2(0.03125 + 0.9375 * (PG_precisionLevel / 16.0), 1.0);")),t.NORMALMAP&amp;&amp;"TANGENT"==t.NORMALSPACE&amp;&amp;!x3dom.caps.STD_DERIVATIVES&amp;&amp;(i+="fragTangent  = (normalMatrix * vec4(tangent, 0.0)).xyz;\n",i+="fragBinormal = (normalMatrix * vec4(binormal, 0.0)).xyz;\n")),(t.LIGHTS||t.FOG||t.CLIPPLANES)&amp;&amp;(i+="fragPosition = (modelViewMatrix * vec4(vertPosition, 1.0));\n",t.FOG&amp;&amp;(i+="fragEyePosition = eyePosition - fragPosition.xyz;\n")),t.MULTIDIFFALPMAP&amp;&amp;(i+="fragID = id;\n"),t.DISPLACEMENTMAP?i+="vertPosition += normalize(vertNormal) * texture2D(displacementMap, vec2(fragTexcoord.x, 1.0-fragTexcoord.y)).r * displacementFactor;\n":t.DIFFPLACEMENTMAP&amp;&amp;(i+="vertPosition += normalize(vertNormal) * texture2D(diffuseDisplacementMap, vec2(fragTexcoord.x, 1.0-fragTexcoord.y)).a * displacementFactor;\n"),i+="gl_Position = modelViewProjectionMatrix * vec4(vertPosition, 1.0);\n",t.IS_PARTICLE?(i+="float spriteDist = (gl_Position.w &gt; 0.000001) ? gl_Position.w : 0.000001;\n",i+="float pointSize = floor(length(particleSize) * 256.0 / spriteDist + 0.5);\n",i+="gl_PointSize = clamp(pointSize, 2.0, 256.0);\n"):i+="gl_PointSize = 2.0;\n",i+="}\n";var r=e.createShader(e.VERTEX_SHADER);return e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||(x3dom.debug.logInfo("VERTEX:\n"+i),x3dom.debug.logError("VertexShader "+e.getShaderInfoLog(r))),r},x3dom.shader.DynamicShader.prototype.generateFragmentShader=function(e,t){var i="#ifdef GL_FRAGMENT_PRECISION_HIGH\n";if(i+=" precision highp float;\n",i+="#else\n",i+=" precision mediump float;\n",i+="#endif\n\n",i+="uniform mat4 modelMatrix;\n",i+="uniform mat4 modelViewMatrix;\n",i+="uniform mat4 viewMatrixInverse;\n",i+=x3dom.shader.material(),t.TWOSIDEDMAT&amp;&amp;(i+=x3dom.shader.twoSidedMaterial()),t.VERTEXCOLOR&amp;&amp;(3==t.COLCOMPONENTS?i+="varying vec3 fragColor;  \n":4==t.COLCOMPONENTS&amp;&amp;(i+="varying vec4 fragColor;  \n")),(t.CUBEMAP||t.CLIPPLANES)&amp;&amp;(i+="uniform mat4 modelViewMatrixInverse;\n"),t.VERTEXID&amp;&amp;(i+="varying float fragID;\n",t.MULTIDIFFALPMAP&amp;&amp;(i+="uniform sampler2D multiDiffuseAlphaMap;\n",i+="uniform float multiDiffuseAlphaWidth;\n",i+="uniform float multiDiffuseAlphaHeight;\n"),t.MULTIEMIAMBMAP&amp;&amp;(i+="uniform sampler2D multiEmissiveAmbientMap;\n",i+="uniform float multiEmissiveAmbientWidth;\n",i+="uniform float multiEmissiveAmbientHeight;\n"),t.MULTISPECSHINMAP&amp;&amp;(i+="uniform sampler2D multiSpecularShininessMap;\n",i+="uniform float multiSpecularShininessWidth;\n",i+="uniform float multiSpecularShininessHeight;\n"),t.MULTIVISMAP&amp;&amp;(i+="uniform sampler2D multiVisibilityMap;\n",i+="uniform float multiVisibilityWidth;\n",i+="uniform float multiVisibilityHeight;\n")),t.TEXTURED&amp;&amp;(i+="varying vec2 fragTexcoord;\n",(t.TEXTURED||t.DIFFUSEMAP)&amp;&amp;(i+="uniform sampler2D diffuseMap;\n"),t.CUBEMAP&amp;&amp;(i+="uniform samplerCube environmentMap;\n",i+="varying vec3 fragViewDir;\n",i+="uniform float environmentFactor;\n"),t.SPECMAP&amp;&amp;(i+="uniform sampler2D specularMap;\n"),t.SHINMAP&amp;&amp;(i+="uniform sampler2D shininessMap;\n"),t.DISPLACEMENTMAP&amp;&amp;(i+="uniform sampler2D displacementMap;\n",i+="uniform float displacementWidth;\n",i+="uniform float displacementHeight;\n"),t.DIFFPLACEMENTMAP&amp;&amp;(i+="uniform sampler2D diffuseDisplacementMap;\n",i+="uniform float displacementWidth;\n",i+="uniform float displacementHeight;\n"),t.NORMALMAP&amp;&amp;(i+="uniform sampler2D normalMap;\n","TANGENT"==t.NORMALSPACE?x3dom.caps.STD_DERIVATIVES?(i+="#extension GL_OES_standard_derivatives:enable\n",i+=x3dom.shader.TBNCalculation()):(i+="varying vec3 fragTangent;\n",i+="varying vec3 fragBinormal;\n"):"OBJECT"==t.NORMALSPACE&amp;&amp;(i+="uniform mat4 normalMatrix;\n"))),t.FOG&amp;&amp;(i+=x3dom.shader.fog()),(t.LIGHTS||t.CLIPPLANES)&amp;&amp;(i+="varying vec4 fragPosition;\n",i+="uniform float isOrthoView;\n"),t.LIGHTS&amp;&amp;(t.NORMALMAP&amp;&amp;"OBJECT"==t.NORMALSPACE||(i+="varying vec3 fragNormal;\n"),i+=x3dom.shader.light(t.LIGHTS)),t.CLIPPLANES&amp;&amp;(i+=x3dom.shader.clipPlanes(t.CLIPPLANES)),i+=x3dom.shader.gammaCorrectionDecl(t),i+="void main(void) {\n",t.CLIPPLANES&amp;&amp;(i+="vec3 cappingColor = calculateClipPlanes();\n"),i+="vec4 color;\n",i+="color.rgb = "+x3dom.shader.decodeGamma(t,"diffuseColor")+";\n",i+="color.a = 1.0 - transparency;\n",i+="vec3 _emissiveColor     = emissiveColor;\n",i+="float _shininess        = shininess;\n",i+="vec3 _specularColor     = specularColor;\n",i+="float _ambientIntensity = ambientIntensity;\n",i+="float _transparency     = transparency;\n",(t.MULTIVISMAP||t.MULTIDIFFALPMAP||t.MULTISPECSHINMAP||t.MULTIEMIAMBMAP)&amp;&amp;(i+="vec2 idCoord;\n",i+="float roundedIDVisibility = floor(fragID+0.5);\n",i+="float roundedIDMaterial = floor(fragID+0.5);\n",i+="if(!gl_FrontFacing) {\n",i+="    roundedIDMaterial = floor(fragID + (multiDiffuseAlphaWidth*multiDiffuseAlphaWidth) + 0.5);\n",i+="}\n"),t.MULTIVISMAP&amp;&amp;(i+="idCoord.x = mod(roundedIDVisibility, multiVisibilityWidth) * (1.0 / multiVisibilityWidth) + (0.5 / multiVisibilityWidth);\n",i+="idCoord.y = floor(roundedIDVisibility / multiVisibilityWidth) * (1.0 / multiVisibilityHeight) + (0.5 / multiVisibilityHeight);\n",i+="vec4 visibility = texture2D( multiVisibilityMap, idCoord );\n",i+="if (visibility.r &lt; 1.0) discard; \n"),t.MULTIDIFFALPMAP&amp;&amp;(i+="idCoord.x = mod(roundedIDMaterial, multiDiffuseAlphaWidth) * (1.0 / multiDiffuseAlphaWidth) + (0.5 / multiDiffuseAlphaWidth);\n",i+="idCoord.y = floor(roundedIDMaterial / multiDiffuseAlphaWidth) * (1.0 / multiDiffuseAlphaHeight) + (0.5 / multiDiffuseAlphaHeight);\n",i+="vec4 diffAlpha = texture2D( multiDiffuseAlphaMap, idCoord );\n",i+="color.rgb = "+x3dom.shader.decodeGamma(t,"diffAlpha.rgb")+";\n",i+="_transparency = 1.0 - diffAlpha.a;\n",i+="color.a = diffAlpha.a;\n"),t.MULTIEMIAMBMAP&amp;&amp;(i+="idCoord.x = mod(roundedIDMaterial, multiDiffuseAlphaWidth) * (1.0 / multiDiffuseAlphaWidth) + (0.5 / multiDiffuseAlphaWidth);\n",i+="idCoord.y = floor(roundedIDMaterial / multiDiffuseAlphaWidth) * (1.0 / multiDiffuseAlphaHeight) + (0.5 / multiDiffuseAlphaHeight);\n",i+="vec4 emiAmb = texture2D( multiEmissiveAmbientMap, idCoord );\n",i+="_emissiveColor = emiAmb.rgb;\n",i+="_ambientIntensity = emiAmb.a;\n"),t.VERTEXCOLOR&amp;&amp;(3===t.COLCOMPONENTS?i+="color.rgb = "+x3dom.shader.decodeGamma(t,"fragColor")+";\n":4===t.COLCOMPONENTS&amp;&amp;(i+="color = "+x3dom.shader.decodeGamma(t,"fragColor")+";\n")),t.LIGHTS){if(i+="vec3 ambient   = vec3(0.0, 0.0, 0.0);\n",i+="vec3 diffuse   = vec3(0.0, 0.0, 0.0);\n",i+="vec3 specular  = vec3(0.0, 0.0, 0.0);\n",i+="vec3 eye;\n",i+="if ( isOrthoView &gt; 0.0 ) {\n",i+="    eye = vec3(0.0, 0.0, 1.0);\n",i+="} else {\n",i+="    eye = -fragPosition.xyz;\n",i+="}\n",t.NORMALMAP&amp;&amp;"OBJECT"==t.NORMALSPACE?i+="vec3 normal  = vec3(0.0, 0.0, 0.0);\n":i+="vec3 normal    = normalize(fragNormal);\n",t.NORMALMAP&amp;&amp;("TANGENT"==t.NORMALSPACE?(i+="vec3 n = normal;\n",x3dom.caps.STD_DERIVATIVES?i+="normal = perturb_normal( n, fragPosition.xyz, vec2(fragTexcoord.x, 1.0-fragTexcoord.y) );\n":(i+="vec3 t = normalize( fragTangent );\n",i+="vec3 b = normalize( fragBinormal );\n",i+="mat3 tangentToWorld = mat3(t, b, n);\n",i+="normal = texture2D( normalMap, vec2(fragTexcoord.x, 1.0-fragTexcoord.y) ).rgb;\n",i+="normal = 2.0 * normal - 1.0;\n",i+="normal = normalize( normal * tangentToWorld );\n",i+="normal.y = -normal.y;\n",i+="normal.x = -normal.x;\n")):"OBJECT"==t.NORMALSPACE&amp;&amp;(i+="normal = texture2D( normalMap, vec2(fragTexcoord.x, 1.0-fragTexcoord.y) ).rgb;\n",i+="normal = 2.0 * normal - 1.0;\n",i+="normal = (normalMatrix * vec4(normal, 0.0)).xyz;\n",i+="normal = normalize(normal);\n")),t.SHINMAP&amp;&amp;(i+="_shininess = texture2D( shininessMap, vec2(fragTexcoord.x, 1.0-fragTexcoord.y) ).r;\n"),t.SPECMAP&amp;&amp;(i+="_specularColor = "+x3dom.shader.decodeGamma(t,"texture2D(specularMap, vec2(fragTexcoord.x, 1.0-fragTexcoord.y)).rgb")+";\n"),t.MULTISPECSHINMAP&amp;&amp;(i+="idCoord.x = mod(roundedIDMaterial, multiSpecularShininessWidth) * (1.0 / multiSpecularShininessWidth) + (0.5 / multiSpecularShininessWidth);\n",i+="idCoord.y = floor(roundedIDMaterial / multiSpecularShininessWidth) * (1.0 / multiSpecularShininessHeight) + (0.5 / multiSpecularShininessHeight);\n",i+="vec4 specShin = texture2D( multiSpecularShininessMap, idCoord );\n",i+="_specularColor = specShin.rgb;\n",i+="_shininess = specShin.a;\n"),t.SOLID&amp;&amp;!t.TWOSIDEDMAT||(i+="if (dot(normal, eye) &lt; 0.0) {\n",i+="  normal *= -1.0;\n",i+="}\n"),t.SEPARATEBACKMAT&amp;&amp;(i+="  if(!gl_FrontFacing) {\n",i+="    color.rgb = "+x3dom.shader.decodeGamma(t,"backDiffuseColor")+";\n",i+="    color.a = 1.0 - backTransparency;\n",i+="    _transparency = 1.0 - backTransparency;\n",i+="    _shininess = backShininess;\n",i+="    _emissiveColor = backEmissiveColor;\n",i+="    _specularColor = backSpecularColor;\n",i+="    _ambientIntensity = backAmbientIntensity;\n",i+="  }\n"),t.LIGHTS){i+="vec3 ads;\n";for(var s=0;s&lt;t.LIGHTS;s++){var r="light"+s+"_Color";i+="ads = lighting(light"+s+"_Type, light"+s+"_Location, light"+s+"_Direction, "+r+", light"+s+"_Attenuation, light"+s+"_Radius, light"+s+"_Intensity, light"+s+"_AmbientIntensity, light"+s+"_BeamWidth, light"+s+"_CutOffAngle, normal, eye, _shininess, _ambientIntensity);\n",i+="   ambient  += "+r+" * ads.r;\n   diffuse  += "+r+" * ads.g;\n   specular += "+r+" * ads.b;\n"}i+="ambient = max(ambient, 0.0);\n",i+="diffuse = max(diffuse, 0.0);\n",i+="specular = max(specular, 0.0);\n"}t.TEXTURED&amp;&amp;(t.DIFFUSEMAP||t.DIFFPLACEMENTMAP||t.TEXT||t.CUBEMAP)?(t.CUBEMAP&amp;&amp;(i+="vec3 viewDir = normalize(fragViewDir);\n",i+="vec3 reflected = reflect(-eye, normal);\n",i+="reflected = (modelViewMatrixInverse * vec4(reflected, 0.0)).xyz;\n",i+="vec4 envColor = "+x3dom.shader.decodeGamma(t,"textureCube(environmentMap, reflected)")+";\n",i+="color.a *= envColor.a;\n"),t.DIFFPLACEMENTMAP?(i+="vec2 texCoord = vec2(fragTexcoord.x, 1.0-fragTexcoord.y);\n",i+="vec4 texColor = texture2D(diffuseDisplacementMap, texCoord);\n"):(t.DIFFUSEMAP||t.TEXT)&amp;&amp;(t.PIXELTEX?i+="vec2 texCoord = fragTexcoord;\n":i+="vec2 texCoord = vec2(fragTexcoord.x, 1.0-fragTexcoord.y);\n",i+="vec4 texColor = "+x3dom.shader.decodeGamma(t,"texture2D(diffuseMap, texCoord)")+";\n",i+="color.a *= texColor.a;\n"),t.BLENDING?(i+="color.rgb = (_emissiveColor + max(ambient + diffuse, 0.0) * color.rgb + specular*_specularColor);\n",(t.DIFFUSEMAP||t.TEXT)&amp;&amp;(i+="color.rgb *= texColor.rgb;\n"),t.CUBEMAP&amp;&amp;(i+="color.rgb *= mix(vec3(1.0,1.0,1.0), envColor.rgb, environmentFactor);\n")):i+="color.rgb = (_emissiveColor + max(ambient + diffuse, 0.0) * texColor.rgb + specular*_specularColor);\n"):i+="color.rgb = (_emissiveColor + max(ambient + diffuse, 0.0) * color.rgb + specular*_specularColor);\n"}else!t.APPMAT||t.VERTEXCOLOR||t.TEXTURED||(i+="color = vec4(0.0, 0.0, 0.0, 1.0 - _transparency);\n"),t.TEXTURED&amp;&amp;(t.DIFFUSEMAP||t.DIFFPLACEMENTMAP||t.TEXT)?(t.PIXELTEX?i+="vec2 texCoord = fragTexcoord;\n":i+="vec2 texCoord = vec2(fragTexcoord.x, 1.0-fragTexcoord.y);\n",t.IS_PARTICLE&amp;&amp;(i+="texCoord = clamp(gl_PointCoord, 0.01, 0.99);\n"),i+="vec4 texColor = "+x3dom.shader.decodeGamma(t,"texture2D(diffuseMap, texCoord)")+";\n",i+="color.a = texColor.a;\n",t.BLENDING||t.IS_PARTICLE?(i+="color.rgb += _emissiveColor.rgb;\n",i+="color.rgb *= texColor.rgb;\n"):i+="color = texColor;\n"):t.VERTEXCOLOR||t.POINTLINE2D?!t.VERTEXCOLOR&amp;&amp;t.POINTLINE2D?(i+="color.rgb = _emissiveColor;\n",t.IS_PARTICLE&amp;&amp;(i+="float pAlpha = 1.0 - clamp(length((gl_PointCoord - 0.5) * 2.0), 0.0, 1.0);\n",i+="color.rgb *= vec3(pAlpha);\n",i+="color.a = pAlpha;\n")):t.IS_PARTICLE&amp;&amp;(i+="float pAlpha = 1.0 - clamp(length((gl_PointCoord - 0.5) * 2.0), 0.0, 1.0);\n",i+="color.rgb *= vec3(pAlpha);\n",i+="color.a = pAlpha;\n"):i+="color.rgb += _emissiveColor;\n";t.CLIPPLANES&amp;&amp;(i+="if (cappingColor.r != -1.0) {\n",i+="    color.rgb = cappingColor;\n",i+="}\n"),t.TEXT?i+="if (color.a &lt;= 0.5) discard;\n":i+="if (color.a &lt;= "+t.ALPHATHRESHOLD+") discard;\n",i+="color = clamp(color, 0.0, 1.0);\n",i+="color = "+x3dom.shader.encodeGamma(t,"color")+";\n",t.FOG&amp;&amp;(i+="float f0 = calcFog(fragEyePosition);\n",i+="color.rgb = fogColor * (1.0-f0) + f0 * (color.rgb);\n"),i+="gl_FragColor = color;\n",i+="}\n";var o=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(o,i),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS)||(x3dom.debug.logInfo("FRAGMENT:\n"+i),x3dom.debug.logError("FragmentShader "+e.getShaderInfoLog(o))),o},x3dom.shader.DynamicMobileShader=function(e,t){this.program=e.createProgram();var i=this.generateVertexShader(e,t),s=this.generateFragmentShader(e,t);return e.attachShader(this.program,i),e.attachShader(this.program,s),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.DynamicMobileShader.prototype.generateVertexShader=function(e,t){var i="";if(i+=x3dom.shader.material(),t.TWOSIDEDMAT&amp;&amp;(i+=x3dom.shader.twoSidedMaterial()),i+="uniform mat4 normalMatrix;\n",i+="uniform mat4 modelViewMatrix;\n",i+="uniform mat4 modelViewProjectionMatrix;\n",3==t.POSCOMPONENTS?i+="attribute vec3 position;\n":4==t.POSCOMPONENTS&amp;&amp;(i+="attribute vec4 position;\n"),t.IMAGEGEOMETRY){i+="uniform vec3 IG_bboxMin;\n",i+="uniform vec3 IG_bboxMax;\n",i+="uniform float IG_coordTextureWidth;\n",i+="uniform float IG_coordTextureHeight;\n",i+="uniform vec2 IG_implicitMeshSize;\n";for(var s=0;s&lt;t.IG_PRECISION;s++)i+="uniform sampler2D IG_coords"+s+"\n;";t.IG_INDEXED&amp;&amp;(i+="uniform sampler2D IG_index;\n",i+="uniform float IG_indexTextureWidth;\n",i+="uniform float IG_indexTextureHeight;\n")}if(t.POPGEOMETRY&amp;&amp;(i+="uniform float PG_precisionLevel;\n",i+="uniform float PG_powPrecision;\n",i+="uniform vec3 PG_maxBBSize;\n",i+="uniform vec3 PG_bbMin;\n",i+="uniform vec3 PG_bbMaxModF;\n",i+="uniform vec3 PG_bboxShiftVec;\n",i+="uniform float PG_numAnchorVertices;\n",i+="attribute float PG_vertexID;\n"),t.POINTLINE2D||(t.IMAGEGEOMETRY?i+="uniform sampler2D IG_normals;\n":2==t.NORCOMPONENTS?4!=t.POSCOMPONENTS&amp;&amp;(i+="attribute vec2 normal;\n"):3==t.NORCOMPONENTS&amp;&amp;(i+="attribute vec3 normal;\n")),i+="varying vec4 fragColor;\n",t.VERTEXCOLOR&amp;&amp;(t.IMAGEGEOMETRY?i+="uniform sampler2D IG_colors;":3==t.COLCOMPONENTS?i+="attribute vec3 color;":4==t.COLCOMPONENTS&amp;&amp;(i+="attribute vec4 color;")),t.TEXTURED&amp;&amp;(i+="varying vec2 fragTexcoord;\n",t.IMAGEGEOMETRY?i+="uniform sampler2D IG_texCoords;":i+="attribute vec2 texcoord;\n",t.TEXTRAFO&amp;&amp;(i+="uniform mat4 texTrafoMatrix;\n"),t.BLENDING||(i+="varying vec3 fragAmbient;\n",i+="varying vec3 fragDiffuse;\n"),t.CUBEMAP&amp;&amp;(i+="varying vec3 fragViewDir;\n",i+="varying vec3 fragNormal;\n",i+="uniform mat4 viewMatrix;\n")),t.FOG&amp;&amp;(i+=x3dom.shader.fog()),t.LIGHTS&amp;&amp;(i+=x3dom.shader.light(t.LIGHTS)),t.REQUIREBBOX&amp;&amp;(i+="uniform vec3 bgCenter;\n",i+="uniform vec3 bgSize;\n",i+="uniform float bgPrecisionMax;\n"),t.REQUIREBBOXNOR&amp;&amp;(i+="uniform float bgPrecisionNorMax;\n"),t.REQUIREBBOXCOL&amp;&amp;(i+="uniform float bgPrecisionColMax;\n"),t.REQUIREBBOXTEX&amp;&amp;(i+="uniform float bgPrecisionTexMax;\n"),i+="void main(void) {\n",i+="gl_PointSize = 2.0;\n",t.IMAGEGEOMETRY){t.IG_INDEXED?(i+="vec2 halfPixel = vec2(0.5/IG_indexTextureWidth,0.5/IG_indexTextureHeight);\n",i+="vec2 IG_texCoord = vec2(position.x*(IG_implicitMeshSize.x/IG_indexTextureWidth), position.y*(IG_implicitMeshSize.y/IG_indexTextureHeight)) + halfPixel;\n",i+="vec2 IG_indices = texture2D( IG_index, IG_texCoord ).rg;\n",i+="halfPixel = vec2(0.5/IG_coordTextureWidth,0.5/IG_coordTextureHeight);\n",i+="IG_texCoord = (IG_indices * 0.996108948) + halfPixel;\n"):(i+="vec2 halfPixel = vec2(0.5/IG_coordTextureWidth, 0.5/IG_coordTextureHeight);\n",i+="vec2 IG_texCoord = vec2(position.x*(IG_implicitMeshSize.x/IG_coordTextureWidth), position.y*(IG_implicitMeshSize.y/IG_coordTextureHeight)) + halfPixel;\n"),i+="vec3 temp = vec3(0.0, 0.0, 0.0);\n",i+="vec3 vertPosition = vec3(0.0, 0.0, 0.0);\n";for(s=0;s&lt;t.IG_PRECISION;s++)i+="temp = 255.0 * texture2D( IG_coords"+s+", IG_texCoord ).rgb;\n",i+="vertPosition *= 256.0;\n",i+="vertPosition += temp;\n";i+="vertPosition /= (pow(2.0, 8.0 * "+t.IG_PRECISION+".0) - 1.0);\n",i+="vertPosition = vertPosition * (IG_bboxMax - IG_bboxMin) + IG_bboxMin;\n",t.POINTLINE2D||(i+="vec3 vertNormal = texture2D( IG_normals, IG_texCoord ).rgb;\n",i+="vertNormal = vertNormal * 2.0 - 1.0;\n"),t.VERTEXCOLOR&amp;&amp;(3==t.COLCOMPONENTS?i+="vec3 vertColor = texture2D( IG_colors, IG_texCoord ).rgb;":4==t.COLCOMPONENTS&amp;&amp;(i+="vec4 vertColor = texture2D( IG_colors, IG_texCoord ).rgba;")),t.TEXTURED&amp;&amp;(i+="vec4 IG_doubleTexCoords = texture2D( IG_texCoords, IG_texCoord );\n",i+="vec2 vertTexCoord;",i+="vertTexCoord.r = (IG_doubleTexCoords.r * 0.996108948) + (IG_doubleTexCoords.b * 0.003891051);\n",i+="vertTexCoord.g = (IG_doubleTexCoords.g * 0.996108948) + (IG_doubleTexCoords.a * 0.003891051);\n")}else i+="vec3 vertPosition = position.xyz;\n",t.POPGEOMETRY?(i+="vec3 offsetVec = step(vertPosition / bgPrecisionMax, PG_bbMaxModF) * PG_bboxShiftVec;\n",i+="if ((PG_precisionLevel &lt;= 2.0) || PG_vertexID &gt;= PG_numAnchorVertices) {\n",i+="   vertPosition = floor(vertPosition / PG_powPrecision) * PG_powPrecision;\n",i+="   vertPosition /= (65536.0 - PG_powPrecision);\n",i+="}\n",i+="else {\n",i+="   vertPosition /= bgPrecisionMax;\n",i+="}\n",i+="vertPosition = (vertPosition + offsetVec + PG_bbMin) * PG_maxBBSize;\n"):t.REQUIREBBOX&amp;&amp;(i+="vertPosition = bgCenter + bgSize * vertPosition / bgPrecisionMax;\n"),t.POINTLINE2D||(2==t.NORCOMPONENTS?(4==t.POSCOMPONENTS?(i+="vec3 vertNormal = vec3(position.w / 256.0); \n",i+="vertNormal.x = floor(vertNormal.x) / 255.0; \n",i+="vertNormal.y = fract(vertNormal.y) * 1.00392156862745; \n"):t.REQUIREBBOXNOR?i+="vec3 vertNormal = vec3(normal.xy, 0.0) / bgPrecisionNorMax;\n":i+="vec3 vertNormal = vec3(normal.xy, 0.0);\n",i+="vec2 thetaPhi = 3.14159265358979 * vec2(vertNormal.x, vertNormal.y*2.0-1.0); \n",i+="vec4 sinCosThetaPhi = vec4(thetaPhi, thetaPhi + 1.5707963267949); \n",i+="vec4 thetaPhiPow2 = sinCosThetaPhi * sinCosThetaPhi; \n",i+="vec4 thetaPhiPow3 =  thetaPhiPow2  * sinCosThetaPhi; \n",i+="vec4 thetaPhiPow5 =  thetaPhiPow3  * thetaPhiPow2; \n",i+="vec4 thetaPhiPow7 =  thetaPhiPow5  * thetaPhiPow2; \n",i+="vec4 thetaPhiPow9 =  thetaPhiPow7  * thetaPhiPow2; \n",i+="sinCosThetaPhi +=  -0.16666666667   * thetaPhiPow3; \n",i+="sinCosThetaPhi +=   0.00833333333   * thetaPhiPow5; \n",i+="sinCosThetaPhi +=  -0.000198412698  * thetaPhiPow7; \n",i+="sinCosThetaPhi +=   0.0000027557319 * thetaPhiPow9; \n",i+="vertNormal.x = sinCosThetaPhi.x * sinCosThetaPhi.w; \n",i+="vertNormal.y = sinCosThetaPhi.x * sinCosThetaPhi.y; \n",i+="vertNormal.z = sinCosThetaPhi.z; \n"):(i+="vec3 vertNormal = normal;\n",t.REQUIREBBOXNOR&amp;&amp;(i+="vertNormal = vertNormal / bgPrecisionNorMax;\n"),t.POPGEOMETRY&amp;&amp;(i+="vertNormal = 2.0*vertNormal - 1.0;\n"))),t.VERTEXCOLOR&amp;&amp;(3==t.COLCOMPONENTS?i+="vec3 vertColor = color;":4==t.COLCOMPONENTS&amp;&amp;(i+="vec4 vertColor = color;"),t.REQUIREBBOXCOL&amp;&amp;(i+="vertColor = vertColor / bgPrecisionColMax;\n")),t.TEXTURED&amp;&amp;(i+="vec2 vertTexCoord = texcoord;\n",t.REQUIREBBOXTEX&amp;&amp;(i+="vertTexCoord = vertTexCoord / bgPrecisionTexMax;\n"));if(i+="vec3 positionMV = (modelViewMatrix * vec4(vertPosition, 1.0)).xyz;\n",t.POINTLINE2D||(i+="vec3 normalMV = normalize( (normalMatrix * vec4(vertNormal, 0.0)).xyz );\n"),i+="vec3 eye = -positionMV;\n",t.VERTEXCOLOR?(i+="vec3 rgb = vertColor.rgb;\n",4==t.COLCOMPONENTS?i+="float alpha = vertColor.a;\n":3==t.COLCOMPONENTS&amp;&amp;(i+="float alpha = 1.0 - transparency;\n")):(i+="vec3 rgb = diffuseColor;\n",i+="float alpha = 1.0 - transparency;\n"),t.TEXTURED&amp;&amp;(t.CUBEMAP?(i+="fragViewDir = viewMatrix[3].xyz;\n",i+="fragNormal = normalMV;\n"):t.SPHEREMAPPING?i+=" fragTexcoord = 0.5 + normalMV.xy / 2.0;\n":t.TEXTRAFO?i+=" fragTexcoord = (texTrafoMatrix * vec4(vertTexCoord, 1.0, 1.0)).xy;\n":(i+=" fragTexcoord = vertTexCoord;\n",t.POPGEOMETRY&amp;&amp;!0===x3dom.debug.usePrecisionLevelAsTexCoord&amp;&amp;(i+="fragTexcoord = vec2(0.03125 + 0.9375 * (PG_precisionLevel / 16.0), 1.0);"))),t.LIGHTS){if(i+="vec3 ambient   = vec3(0.0, 0.0, 0.0);\n",i+="vec3 diffuse   = vec3(0.0, 0.0, 0.0);\n",i+="vec3 specular  = vec3(0.0, 0.0, 0.0);\n",i+="float _shininess     = shininess;\n",i+="vec3 _specularColor  = specularColor;\n",i+="vec3 _emissiveColor  = emissiveColor;\n",i+="float _ambientIntensity = ambientIntensity;\n",t.SOLID&amp;&amp;!t.TWOSIDEDMAT||(i+="if (dot(normalMV, eye) &lt; 0.0) {\n",i+="  normalMV *= -1.0;\n",t.SEPARATEBACKMAT&amp;&amp;(i+="    rgb = backDiffuseColor;\n",i+="    alpha = 1.0 - backTransparency;\n",i+="    _shininess = backShininess;\n",i+="    _emissiveColor = backEmissiveColor;\n",i+="    _specularColor = backSpecularColor;\n",i+="    _ambientIntensity = backAmbientIntensity;\n"),i+="  }\n"),t.LIGHTS){i+="vec3 ads;\n";for(var r=0;r&lt;t.LIGHTS;r++){var o="light"+r+"_Color";i+="ads = lighting(light"+r+"_Type, light"+r+"_Location, light"+r+"_Direction, "+o+", light"+r+"_Attenuation, light"+r+"_Radius, light"+r+"_Intensity, light"+r+"_AmbientIntensity, light"+r+"_BeamWidth, light"+r+"_CutOffAngle, normalMV, eye, _shininess, _ambientIntensity);\n",i+="   ambient  += "+o+" * ads.r;\n   diffuse  += "+o+" * ads.g;\n   specular += "+o+" * ads.b;\n"}i+="ambient = max(ambient, 0.0);\n",i+="diffuse = max(diffuse, 0.0);\n",i+="specular = max(specular, 0.0);\n"}t.TEXTURED&amp;&amp;!t.BLENDING?(i+="fragAmbient = ambient;\n",i+="fragDiffuse = diffuse;\n",i+="fragColor.rgb = (_emissiveColor + specular*_specularColor);\n",i+="fragColor.a = alpha;\n"):(i+="fragColor.rgb = (_emissiveColor + max(ambient + diffuse, 0.0) * rgb + specular*_specularColor);\n",i+="fragColor.a = alpha;\n")}else t.APPMAT&amp;&amp;!t.VERTEXCOLOR&amp;&amp;(i+="rgb = vec3(0.0, 0.0, 0.0);\n"),t.TEXTURED&amp;&amp;!t.BLENDING?(i+="fragAmbient = vec3(0.0);\n",i+="fragDiffuse = vec3(1.0);\n",i+="fragColor.rgb = vec3(0.0);\n",i+="fragColor.a = alpha;\n"):!t.VERTEXCOLOR&amp;&amp;t.POINTLINE2D?(i+="fragColor.rgb = emissiveColor;\n",i+="fragColor.a = alpha;\n"):(i+="fragColor.rgb = rgb + emissiveColor;\n",i+="fragColor.a = alpha;\n");t.FOG&amp;&amp;(i+="float f0 = calcFog(-positionMV);\n",i+="fragColor.rgb = fogColor * (1.0-f0) + f0 * (fragColor.rgb);\n"),i+="gl_Position = modelViewProjectionMatrix * vec4(vertPosition, 1.0);\n",i+="}\n";var n=e.createShader(e.VERTEX_SHADER);return e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS)||x3dom.debug.logError("[DynamicMobileShader] VertexShader "+e.getShaderInfoLog(n)),n},x3dom.shader.DynamicMobileShader.prototype.generateFragmentShader=function(e,t){var i="#ifdef GL_FRAGMENT_PRECISION_HIGH\n";i+="precision highp float;\n",i+="#else\n",i+=" precision mediump float;\n",i+="#endif\n\n",i+="varying vec4 fragColor;\n",t.TEXTURED&amp;&amp;(t.CUBEMAP?(i+="uniform samplerCube cubeMap;\n",i+="varying vec3 fragViewDir;\n",i+="varying vec3 fragNormal;\n",i+="uniform mat4 modelViewMatrixInverse;\n"):(i+="uniform sampler2D diffuseMap;           \n",i+="varying vec2 fragTexcoord;       \n"),t.BLENDING||(i+="varying vec3 fragAmbient;\n",i+="varying vec3 fragDiffuse;\n")),i+="void main(void) {\n",i+="vec4 color = fragColor;\n",t.TEXTURED&amp;&amp;(t.CUBEMAP?(i+="vec3 normal = normalize(fragNormal);\n",i+="vec3 viewDir = normalize(fragViewDir);\n",i+="vec3 reflected = reflect(viewDir, normal);\n",i+="reflected = (modelViewMatrixInverse * vec4(reflected,0.0)).xyz;\n",i+="vec4 texColor = textureCube(cubeMap, reflected);\n"):i+="vec4 texColor = texture2D(diffuseMap, vec2(fragTexcoord.s, 1.0-fragTexcoord.t));\n",t.BLENDING?t.CUBEMAP?(i+="color.rgb = mix(color.rgb, texColor.rgb, vec3(0.75));\n",i+="color.a = texColor.a;\n"):(i+="color.rgb *= texColor.rgb;\n",i+="color.a *= texColor.a;\n"):(i+="color.rgb += max(fragAmbient + fragDiffuse, 0.0) * texColor.rgb;\n",i+="color.a *= texColor.a;\n")),t.TEXT?i+="if (color.a &lt;= 0.5) discard;\n":i+="if (color.a &lt;= 0.1) discard;\n",i+="gl_FragColor = clamp(color, 0.0, 1.0);\n",i+="}\n";var s=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||x3dom.debug.logError("[DynamicMobileShader] FragmentShader "+e.getShaderInfoLog(s)),s},x3dom.shader.DynamicShaderPicking=function(e,t,i){this.program=e.createProgram();var s=this.generateVertexShader(e,t,i),r=this.generateFragmentShader(e,t,i);return e.attachShader(this.program,s),e.attachShader(this.program,r),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.DynamicShaderPicking.prototype.generateVertexShader=function(e,t,i){var s="";if(s+="uniform mat4 modelMatrix;\n",s+="uniform mat4 modelViewProjectionMatrix;\n",s+="attribute vec3 position;\n",s+="uniform vec3 from;\n",s+="varying vec3 worldCoord;\n",1==i?(s+="attribute vec3 color;\n",s+="varying vec3 fragColor;\n"):2==i&amp;&amp;(s+="attribute vec2 texcoord;\n",s+="varying vec3 fragColor;\n"),t.REQUIREBBOX&amp;&amp;(s+="uniform vec3 bgCenter;\n",s+="uniform vec3 bgSize;\n",s+="uniform float bgPrecisionMax;\n"),t.REQUIREBBOXCOL&amp;&amp;(s+="uniform float bgPrecisionColMax;\n"),t.REQUIREBBOXTEX&amp;&amp;(s+="uniform float bgPrecisionTexMax;\n"),t.VERTEXID&amp;&amp;(s+="uniform float shadowIDs;\n",s+=3==i?"varying vec3 idCoord;\n":"varying vec2 idCoord;\n",s+="varying float fragID;\n",s+="attribute float id;\n"),t.IMAGEGEOMETRY){s+="uniform vec3 IG_bboxMin;\n",s+="uniform vec3 IG_bboxMax;\n",s+="uniform float IG_coordTextureWidth;\n",s+="uniform float IG_coordTextureHeight;\n",s+="uniform vec2 IG_implicitMeshSize;\n";for(var r=0;r&lt;t.IG_PRECISION;r++)s+="uniform sampler2D IG_coords"+r+"\n;";t.IG_INDEXED&amp;&amp;(s+="uniform sampler2D IG_index;\n",s+="uniform float IG_indexTextureWidth;\n",s+="uniform float IG_indexTextureHeight;\n")}t.POPGEOMETRY&amp;&amp;(s+="uniform float PG_precisionLevel;\n",s+="uniform float PG_powPrecision;\n",s+="uniform vec3 PG_maxBBSize;\n",s+="uniform vec3 PG_bbMin;\n",s+="uniform vec3 PG_bbMaxModF;\n",s+="uniform vec3 PG_bboxShiftVec;\n",s+="uniform float PG_numAnchorVertices;\n",s+="attribute float PG_vertexID;\n"),t.CLIPPLANES&amp;&amp;(s+="uniform mat4 modelViewMatrix;\n",s+="varying vec4 fragPosition;\n"),s+="void main(void) {\n",s+="gl_PointSize = 2.0;\n",s+="vec3 pos = position;\n",t.VERTEXID&amp;&amp;(0==i?(s+="idCoord = vec2((id + shadowIDs) / 256.0);\n",s+="idCoord.x = floor(idCoord.x) / 255.0;\n",s+="idCoord.y = fract(idCoord.y) * 1.00392156862745;\n",s+="fragID = id;\n"):3==i?(s+="float ID = id + shadowIDs;\n",s+="float h = floor(ID / 256.0);\n",s+="idCoord.x = ID - (h * 256.0);\n",s+="idCoord.z = floor(h / 256.0);\n",s+="idCoord.y = h - (idCoord.z * 256.0);\n",s+="idCoord = idCoord.zyx / 255.0;\n",s+="fragID = id;\n"):4==i&amp;&amp;(s+="idCoord = vec2((id + shadowIDs) / 256.0);\n",s+="idCoord.x = floor(idCoord.x) / 255.0;\n",s+="idCoord.y = fract(idCoord.y) * 1.00392156862745;\n",s+="fragID = id;\n")),t.IMAGEGEOMETRY?(t.IG_INDEXED?(s+="vec2 halfPixel = vec2(0.5/IG_indexTextureWidth,0.5/IG_indexTextureHeight);\n",s+="vec2 IG_texCoord = vec2(position.x*(IG_implicitMeshSize.x/IG_indexTextureWidth), position.y*(IG_implicitMeshSize.y/IG_indexTextureHeight)) + halfPixel;\n",s+="vec2 IG_indices = texture2D( IG_index, IG_texCoord ).rg;\n",s+="halfPixel = vec2(0.5/IG_coordTextureWidth,0.5/IG_coordTextureHeight);\n",s+="IG_texCoord = (IG_indices * 0.996108948) + halfPixel;\n"):(s+="vec2 halfPixel = vec2(0.5/IG_coordTextureWidth, 0.5/IG_coordTextureHeight);\n",s+="vec2 IG_texCoord = vec2(position.x*(IG_implicitMeshSize.x/IG_coordTextureWidth), position.y*(IG_implicitMeshSize.y/IG_coordTextureHeight)) + halfPixel;\n"),s+="pos = texture2D( IG_coordinateTexture, IG_texCoord ).rgb;\n",s+="pos = pos * (IG_bboxMax - IG_bboxMin) + IG_bboxMin;\n"):t.POPGEOMETRY?(s+="vec3 offsetVec = step(pos / bgPrecisionMax, PG_bbMaxModF) * PG_bboxShiftVec;\n",s+="if (PG_precisionLevel &lt;= 2.0) {\n",s+="pos = floor(pos / PG_powPrecision) * PG_powPrecision;\n",s+="pos /= (65536.0 - PG_powPrecision);\n",s+="}\n",s+="else {\n",s+="pos /= bgPrecisionMax;\n",s+="}\n",s+="pos = (pos + offsetVec + PG_bbMin) * PG_maxBBSize;\n"):(t.REQUIREBBOX&amp;&amp;(s+="pos = bgCenter + bgSize * pos / bgPrecisionMax;\n"),1!=i||t.REQUIREBBOXCOL?1==i&amp;&amp;t.REQUIREBBOXCOL?s+="fragColor = color / bgPrecisionColMax;\n":2!=i||t.REQUIREBBOXTEX?2==i&amp;&amp;t.REQUIREBBOXTEX&amp;&amp;(s+="vec2 texCoord = texcoord / bgPrecisionTexMax;\n",s+="fragColor = vec3(abs(texCoord.x), abs(texCoord.y), 0.0);\n"):s+="fragColor = vec3(abs(texcoord.x), abs(texcoord.y), 0.0);\n":s+="fragColor = color;\n"),t.CLIPPLANES&amp;&amp;(s+="fragPosition = (modelViewMatrix * vec4(pos, 1.0));\n"),s+="worldCoord = (modelMatrix * vec4(pos, 1.0)).xyz - from;\n",s+="gl_Position = modelViewProjectionMatrix * vec4(pos, 1.0);\n",s+="}\n";var o=e.createShader(e.VERTEX_SHADER);return e.shaderSource(o,s),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS)||(x3dom.debug.logInfo("VERTEX:\n"+s),x3dom.debug.logError("VertexShader "+e.getShaderInfoLog(o))),o},x3dom.shader.DynamicShaderPicking.prototype.generateFragmentShader=function(e,t,i){var s="#ifdef GL_FRAGMENT_PRECISION_HIGH\n";s+=" precision highp float;\n",s+="#else\n",s+=" precision mediump float;\n",s+="#endif\n\n",s+="uniform float highBit;\n",s+="uniform float lowBit;\n",s+="uniform float sceneSize;\n",s+="varying vec3 worldCoord;\n",1!=i&amp;&amp;2!=i||(s+="varying vec3 fragColor;\n"),t.VERTEXID&amp;&amp;(s+=3==i?"varying vec3 idCoord;\n":"varying vec2 idCoord;\n",s+="varying float fragID;\n"),t.CLIPPLANES&amp;&amp;(s+="uniform mat4 viewMatrixInverse;\n",s+="varying vec4 fragPosition;\n"),t.MULTIVISMAP&amp;&amp;(s+="uniform sampler2D multiVisibilityMap;\n",s+="uniform float multiVisibilityWidth;\n",s+="uniform float multiVisibilityHeight;\n"),t.CLIPPLANES&amp;&amp;(s+=x3dom.shader.clipPlanes(t.CLIPPLANES)),s+="void main(void) {\n",t.CLIPPLANES&amp;&amp;(s+="calculateClipPlanes();\n"),s+=1==i||2==i?"vec4 color = vec4(fragColor, lowBit);\n":4==i?"vec4 color = vec4(highBit, lowBit, 0.0, 0.0);\n":"vec4 color = vec4(0.0, 0.0, highBit, lowBit);\n",t.VERTEXID&amp;&amp;(0==i||4==i?s+="color.ba = idCoord;\n":3==i&amp;&amp;(s+="color.gba = idCoord;\n"),t.MULTIVISMAP&amp;&amp;(s+="vec2 idTexCoord;\n",s+="float roundedID = floor(fragID+0.5);\n",s+="idTexCoord.x = (mod(roundedID, multiVisibilityWidth)) * (1.0 / multiVisibilityWidth) + (0.5 / multiVisibilityWidth);\n",s+="idTexCoord.y = (floor(roundedID / multiVisibilityHeight)) * (1.0 / multiVisibilityHeight) + (0.5 / multiVisibilityHeight);\n",s+="vec4 visibility = texture2D( multiVisibilityMap, idTexCoord );\n",s+="if (visibility.r &lt; 1.0) discard; \n")),1!=i&amp;&amp;2!=i&amp;&amp;(s+="float d = length(worldCoord) / sceneSize;\n"),0==i?(s+="vec2 comp = fract(d * vec2(256.0, 1.0));\n",s+="color.rg = comp - (comp.rr * vec2(0.0, 1.0/256.0));\n"):3==i&amp;&amp;(s+="color.r = d;\n"),s+="gl_FragColor = color;\n",s+="}\n";var r=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(r,s),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||(x3dom.debug.logInfo("FRAGMENT:\n"+s),x3dom.debug.logError("FragmentShader "+e.getShaderInfoLog(r))),r},x3dom.shader.DynamicShadowShader=function(e,t){this.program=e.createProgram();var i=this.generateVertexShader(e,t),s=this.generateFragmentShader(e,t);return e.attachShader(this.program,i),e.attachShader(this.program,s),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.DynamicShadowShader.prototype.generateVertexShader=function(e,t){var i="";if(i+="attribute vec3 position;\n",i+="uniform mat4 modelViewProjectionMatrix;\n",i+="varying vec4 projCoords;\n",t.VERTEXID&amp;&amp;(i+="varying float fragID;\n",i+="attribute float id;\n"),t.REQUIREBBOX&amp;&amp;(i+="uniform vec3 bgCenter;\n",i+="uniform vec3 bgSize;\n",i+="uniform float bgPrecisionMax;\n"),t.IMAGEGEOMETRY){i+="uniform vec3 IG_bboxMin;\n",i+="uniform vec3 IG_bboxMax;\n",i+="uniform float IG_coordTextureWidth;\n",i+="uniform float IG_coordTextureHeight;\n",i+="uniform vec2 IG_implicitMeshSize;\n";for(var s=0;s&lt;t.IG_PRECISION;s++)i+="uniform sampler2D IG_coords"+s+"\n;";t.IG_INDEXED&amp;&amp;(i+="uniform sampler2D IG_index;\n",i+="uniform float IG_indexTextureWidth;\n",i+="uniform float IG_indexTextureHeight;\n")}t.POPGEOMETRY&amp;&amp;(i+="uniform float PG_precisionLevel;\n",i+="uniform float PG_powPrecision;\n",i+="uniform vec3 PG_maxBBSize;\n",i+="uniform vec3 PG_bbMin;\n",i+="uniform vec3 PG_bbMaxModF;\n",i+="uniform vec3 PG_bboxShiftVec;\n",i+="uniform float PG_numAnchorVertices;\n",i+="attribute float PG_vertexID;\n"),t.CLIPPLANES&amp;&amp;(i+="uniform mat4 modelViewMatrix;\n",i+="varying vec4 fragPosition;\n"),i+="void main(void) {\n",i+="    vec3 pos = position;\n",t.IMAGEGEOMETRY?(t.IG_INDEXED?(i+="    vec2 halfPixel = vec2(0.5/IG_indexTextureWidth,0.5/IG_indexTextureHeight);\n",i+="    vec2 IG_texCoord = vec2(position.x*(IG_implicitMeshSize.x/IG_indexTextureWidth), position.y*(IG_implicitMeshSize.y/IG_indexTextureHeight)) + halfPixel;\n",i+="    vec2 IG_indices = texture2D( IG_index, IG_texCoord ).rg;\n",i+="    halfPixel = vec2(0.5/IG_coordTextureWidth,0.5/IG_coordTextureHeight);\n",i+="    IG_texCoord = (IG_indices * 0.996108948) + halfPixel;\n"):(i+="    vec2 halfPixel = vec2(0.5/IG_coordTextureWidth, 0.5/IG_coordTextureHeight);\n",i+="    vec2 IG_texCoord = vec2(position.x*(IG_implicitMeshSize.x/IG_coordTextureWidth), position.y*(IG_implicitMeshSize.y/IG_coordTextureHeight)) + halfPixel;\n"),i+="    pos = texture2D( IG_coordinateTexture, IG_texCoord ).rgb;\n",i+="    pos = pos * (IG_bboxMax - IG_bboxMin) + IG_bboxMin;\n"):t.POPGEOMETRY?(i+="    vec3 offsetVec = step(pos / bgPrecisionMax, PG_bbMaxModF) * PG_bboxShiftVec;\n",i+="    if (PG_precisionLevel &lt;= 2.0) {\n",i+="        pos = floor(pos / PG_powPrecision) * PG_powPrecision;\n",i+="        pos /= (65536.0 - PG_powPrecision);\n",i+="    }\n",i+="    else {\n",i+="        pos /= bgPrecisionMax;\n",i+="    }\n",i+="    pos = (pos + offsetVec + PG_bbMin) * PG_maxBBSize;\n"):t.REQUIREBBOX&amp;&amp;(i+="    pos = bgCenter + bgSize * pos / bgPrecisionMax;\n"),t.VERTEXID&amp;&amp;(i+="    fragID = id;\n"),t.CLIPPLANES&amp;&amp;(i+="    fragPosition = (modelViewMatrix * vec4(pos, 1.0));\n"),i+="    projCoords = modelViewProjectionMatrix * vec4(pos, 1.0);\n",i+="    gl_Position = projCoords;\n",i+="}\n";var r=e.createShader(e.VERTEX_SHADER);return e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)||x3dom.debug.logError("[ShadowShader] VertexShader "+e.getShaderInfoLog(r)),r},x3dom.shader.DynamicShadowShader.prototype.generateFragmentShader=function(e,t){var i="";i+="#ifdef GL_FRAGMENT_PRECISION_HIGH\n",i+="    precision highp float;\n",i+="#else\n",i+="    precision mediump float;\n",i+="#endif\n\n",i+="varying vec4 projCoords;\n",i+="uniform float offset;\n",i+="uniform bool cameraView;\n",t.VERTEXID&amp;&amp;(i+="varying float fragID;\n"),t.MULTIVISMAP&amp;&amp;(i+="uniform sampler2D multiVisibilityMap;\n",i+="uniform float multiVisibilityWidth;\n",i+="uniform float multiVisibilityHeight;\n"),t.CLIPPLANES&amp;&amp;(i+="uniform mat4 viewMatrixInverse;\n",i+="varying vec4 fragPosition;\n",i+=x3dom.shader.clipPlanes(t.CLIPPLANES)),x3dom.caps.FP_TEXTURES||(i+=x3dom.shader.rgbaPacking()),i+="void main(void) {\n",t.CLIPPLANES&amp;&amp;(i+="calculateClipPlanes();\n"),t.MULTIVISMAP&amp;&amp;(i+="    vec2 idTexCoord;\n",i+="    float roundedID = floor(fragID+0.5);\n",i+="    idTexCoord.x = (mod(roundedID, multiVisibilityWidth)) * (1.0 / multiVisibilityWidth) + (0.5 / multiVisibilityWidth);\n",i+="    idTexCoord.y = (floor(roundedID / multiVisibilityHeight)) * (1.0 / multiVisibilityHeight) + (0.5 / multiVisibilityHeight);\n",i+="    vec4 visibility = texture2D( multiVisibilityMap, idTexCoord );\n",i+="    if (visibility.r &lt; 1.0) discard; \n"),i+="    vec3 proj = (projCoords.xyz / projCoords.w);\n",x3dom.caps.FP_TEXTURES?(i+="    if (!cameraView){\n",i+="     proj.z = (proj.z + 1.0)*0.5;\n",i+="     proj.y = proj.z * proj.z;\n",i+="    }\n",i+="    gl_FragColor = vec4(proj, 1.0);\n"):i+="    gl_FragColor = packDepth(proj.z);\n",i+="}\n";var s=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||x3dom.debug.logError("[ShadowShader] FragmentShader "+e.getShaderInfoLog(s)),s},x3dom.shader.ComposedShader=function(e,t){this.program=e.createProgram();var i=this.generateVertexShader(e,t),s=this.generateFragmentShader(e,t);return e.attachShader(this.program,i),e.attachShader(this.program,s),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.ComposedShader.prototype.generateVertexShader=function(e,t){var i=t._cf.appearance.node._shader._vertex._vf.url[0],s=e.createShader(e.VERTEX_SHADER);return e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||x3dom.debug.logError("[ComposedShader] VertexShader "+e.getShaderInfoLog(s)),s},x3dom.shader.ComposedShader.prototype.generateFragmentShader=function(e,t){var i=t._cf.appearance.node._shader._fragment._vf.url[0],s=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||x3dom.debug.logError("[ComposedShader] FragmentShader "+e.getShaderInfoLog(s)),s},x3dom.shader.NormalShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.NormalShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec3 position;\nattribute vec3 normal;\nuniform vec3 bgCenter;\nuniform vec3 bgSize;\nuniform float bgPrecisionMax;\nuniform float bgPrecisionNorMax;\nuniform mat4 normalMatrix;\nuniform mat4 modelViewProjectionMatrix;\nvarying vec3 fragNormal;\nvoid main(void) {\n    vec3 pos = bgCenter + bgSize * position / bgPrecisionMax;\n    fragNormal = (normalMatrix * vec4(normal / bgPrecisionNorMax, 0.0)).xyz;\n    gl_Position = modelViewProjectionMatrix * vec4(pos, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[NormalShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.NormalShader.prototype.generateFragmentShader=function(e){var t=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(t,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\n precision mediump float;\n#endif\n\nvarying vec3 fragNormal;\nvoid main(void) {\n    gl_FragColor = vec4(normalize(fragNormal) / 2.0 + 0.5, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[NormalShader] FragmentShader "+e.getShaderInfoLog(t)),t},x3dom.shader.FrontgroundTextureShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.FrontgroundTextureShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec3 position;\nvarying vec2 fragTexCoord;\n\nvoid main(void) {\n    vec2 texCoord = (position.xy + 1.0) * 0.5;\n    fragTexCoord = texCoord;\n    gl_Position = vec4(position.xy, 0.0, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[FrontgroundTextureShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.FrontgroundTextureShader.prototype.generateFragmentShader=function(e){var t=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(t,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\n precision mediump float;\n#endif\n\nuniform sampler2D tex;\nvarying vec2 fragTexCoord;\n\nvoid main(void) {\n    vec4 col = texture2D(tex, fragTexCoord);\n    gl_FragColor = vec4(col.rgb, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[FrontgroundTextureShader] FragmentShader "+e.getShaderInfoLog(t)),t},x3dom.shader.BackgroundTextureShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.BackgroundTextureShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec3 position;\nvarying vec2 fragTexCoord;\nuniform vec2 scale;\nuniform vec2 translation;\n\nvoid main(void) {\n    vec2 texCoord = (position.xy + 1.0) * 0.5;\n    fragTexCoord = texCoord * scale + translation;\n    gl_Position = vec4(position.xy, 0.0, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[BackgroundTextureShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.BackgroundTextureShader.prototype.generateFragmentShader=function(e){var t=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(t,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\n precision mediump float;\n#endif\n\nuniform sampler2D tex;\nvarying vec2 fragTexCoord;\n\nvoid main(void) {\n    gl_FragColor = texture2D(tex, fragTexCoord);\n}"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[BackgroundTextureShader] FragmentShader "+e.getShaderInfoLog(t)),t},x3dom.shader.BackgroundSkyTextureShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.BackgroundSkyTextureShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec3 position;\nattribute vec2 texcoord;\nuniform mat4 modelViewProjectionMatrix;\nvarying vec2 fragTexCoord;\n\nvoid main(void) {\n    fragTexCoord = texcoord;\n    gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[BackgroundSkyTextureShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.BackgroundSkyTextureShader.prototype.generateFragmentShader=function(e){var t=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(t,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\n precision mediump float;\n#endif\n\nuniform sampler2D tex;\nvarying vec2 fragTexCoord;\n\nvoid main(void) {\n    gl_FragColor = texture2D(tex, fragTexCoord);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[BackgroundSkyTextureShader] FragmentShader "+e.getShaderInfoLog(t)),t},x3dom.shader.BackgroundCubeTextureShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.BackgroundCubeTextureShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec3 position;\nuniform mat4 modelViewProjectionMatrix;\nvarying vec3 fragNormal;\n\nvoid main(void) {\n    fragNormal = normalize(position);\n    gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[BackgroundCubeTextureShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.BackgroundCubeTextureShader.prototype.generateFragmentShader=function(e){var t=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(t,"#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\n precision mediump float;\n#endif\n\nuniform samplerCube tex;\nvarying vec3 fragNormal;\n\nfloat magn(float val) {\n    return ((val &gt;= 0.0) ? val : -1.0 * val);\n}\nvoid main(void) {\n    vec3 normal = -reflect(normalize(fragNormal), vec3(0.0,0.0,1.0));\n    if (magn(normal.y) &gt;= magn(normal.x) &amp;&amp; magn(normal.y) &gt;= magn(normal.z))\n        normal.xz = -normal.xz;\n    gl_FragColor = textureCube(tex, normal);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[BackgroundCubeTextureShader] FragmentShader "+e.getShaderInfoLog(t)),t},x3dom.shader.ShadowRenderingShader=function(e,t){this.program=e.createProgram();var i=this.generateVertexShader(e),s=this.generateFragmentShader(e,t);return e.attachShader(this.program,i),e.attachShader(this.program,s),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.ShadowRenderingShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec2 position;\nvarying vec2 vPosition;\nvoid main(void) {\n vPosition = position;\n gl_Position = vec4(position, -1.0, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[ShadowRendering] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.ShadowRenderingShader.prototype.generateFragmentShader=function(e,t){var i="#ifdef GL_FRAGMENT_PRECISION_HIGH\n";i+="precision highp float;\n",i+="#else\n",i+=" precision mediump float;\n",i+="#endif\n\n",i+="uniform mat4 inverseViewProj;\n",i+="uniform mat4 inverseProj;\n",i+="varying vec2 vPosition;\n",i+="uniform sampler2D sceneMap;\n";for(var s=0;s&lt;5;s++)i+="uniform float cascade"+s+"_Depth;\n";for(var r=0;r&lt;t.length;r++){i+="uniform float light"+r+"_On;\nuniform float light"+r+"_Type;\nuniform vec3  light"+r+"_Location;\nuniform vec3  light"+r+"_Direction;\nuniform vec3  light"+r+"_Attenuation;\nuniform float light"+r+"_Radius;\nuniform float light"+r+"_BeamWidth;\nuniform float light"+r+"_CutOffAngle;\nuniform float light"+r+"_ShadowIntensity;\nuniform float light"+r+"_ShadowOffset;\nuniform mat4 light"+r+"_ViewMatrix;\n";for(var o=0;o&lt;6;o++)i+="uniform mat4 light"+r+"_"+o+"_Matrix;\n",i+="uniform sampler2D light"+r+"_"+o+"_ShadowMap;\n";for(o=0;o&lt;5;o++)i+="uniform float light"+r+"_"+o+"_Split;\n"}x3dom.caps.FP_TEXTURES&amp;&amp;!x3dom.caps.MOBILE||(i+=x3dom.shader.rgbaPacking()),i+=x3dom.shader.shadowRendering(),i+=x3dom.shader.gammaCorrectionDecl({}),i+="void main(void) {\n float shadowValue = 1.0;\n vec2 texCoordsSceneMap = (vPosition + 1.0)*0.5;\n vec4 projCoords = texture2D(sceneMap, texCoordsSceneMap);\n if (projCoords != vec4(1.0,1.0,1.0,0.0)){\n",x3dom.caps.FP_TEXTURES&amp;&amp;!x3dom.caps.MOBILE||(i+=" projCoords.z = unpackDepth(projCoords);\n projCoords.w = 1.0;\n"),i+=" projCoords = projCoords / projCoords.w;\n projCoords.xy = vPosition;\n vec4 eyeCoords = inverseProj*projCoords;\n vec4 worldCoords = inverseViewProj*projCoords;\n float lightInfluence = 0.0;\n";for(r=0;r&lt;t.length;r++)i+=" lightInfluence = getLightInfluence(light"+r+"_Type, light"+r+"_ShadowIntensity, light"+r+"_On, light"+r+"_Location, light"+r+"_Direction, light"+r+"_CutOffAngle, light"+r+"_BeamWidth, light"+r+"_Attenuation, light"+r+"_Radius, eyeCoords.xyz/eyeCoords.w);\n if (lightInfluence != 0.0){\n  vec4 shadowMapValues;\n  float viewSampleDepth;\n",x3dom.isa(t[r],x3dom.nodeTypes.PointLight)?i+="  getShadowValuesPointLight(shadowMapValues, viewSampleDepth, light"+r+"_Location, worldCoords, light"+r+"_ViewMatrix, light"+r+"_0_Matrix,light"+r+"_1_Matrix,light"+r+"_2_Matrix,light"+r+"_3_Matrix,light"+r+"_4_Matrix,light"+r+"_5_Matrix,light"+r+"_0_ShadowMap,light"+r+"_1_ShadowMap,light"+r+"_2_ShadowMap,light"+r+"_3_ShadowMap,light"+r+"_4_ShadowMap,light"+r+"_5_ShadowMap);\n":i+="  getShadowValuesCascaded(shadowMapValues, viewSampleDepth, worldCoords, -eyeCoords.z/eyeCoords.w,light"+r+"_0_Matrix,light"+r+"_1_Matrix,light"+r+"_2_Matrix,light"+r+"_3_Matrix,light"+r+"_4_Matrix,light"+r+"_5_Matrix,light"+r+"_0_ShadowMap,light"+r+"_1_ShadowMap,light"+r+"_2_ShadowMap,light"+r+"_3_ShadowMap,light"+r+"_4_ShadowMap,light"+r+"_5_ShadowMap, light"+r+"_0_Split, light"+r+"_1_Split, light"+r+"_2_Split, light"+r+"_3_Split, \nlight"+r+"_4_Split);\n",!x3dom.caps.FP_TEXTURES||x3dom.caps.MOBILE?i+=" shadowValue *= clamp(ESM(shadowMapValues.z, viewSampleDepth, light"+r+"_ShadowOffset),     1.0 - light"+r+"_ShadowIntensity*lightInfluence, 1.0);\n":i+="  shadowValue *= clamp(VSM(shadowMapValues.zy, viewSampleDepth, light"+r+"_ShadowOffset),     1.0 - light"+r+"_ShadowIntensity*lightInfluence, 1.0);\n",i+=" }\n";i+="}\n gl_FragColor = "+x3dom.shader.encodeGamma({},"vec4(shadowValue, shadowValue, shadowValue, 1.0)")+";\n}\n";var n=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS)||x3dom.debug.logError("[ShadowRendering] FragmentShader "+e.getShaderInfoLog(n)),n},x3dom.shader.TextureRefinementShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.TextureRefinementShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec2 position;\nvarying vec2 fragTexCoord;\n\nvoid main(void) {\n    fragTexCoord = (position.xy + 1.0) / 2.0;\n    gl_Position = vec4(position, -1.0, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[TextureRefinementShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.TextureRefinementShader.prototype.generateFragmentShader=function(e){var t=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(t,"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n\nuniform sampler2D stamp;\nuniform sampler2D lastTex;\nuniform sampler2D curTex;\nuniform int mode;\nuniform vec2 repeat;\nvarying vec2 fragTexCoord;\n\nvoid init(void);\nvoid refine(void);\n\nvoid main(void) {\n    if (mode == 0) { init(); }\n    else { refine(); }\n}\n\nvoid init(void) {\n    gl_FragColor = texture2D(curTex, fragTexCoord);\n}\n\nvoid refine(void) {\n    vec3 red = texture2D(stamp, repeat * fragTexCoord).rgb;\n    vec3 v1  = texture2D(lastTex, fragTexCoord).rgb;\n    vec3 v2  = texture2D(curTex, fragTexCoord).rgb;\n    if (red.r &lt;= 0.5) {\n        gl_FragColor = vec4(v1, 1.0);\n    }\n    else {\n        gl_FragColor = vec4(v2, 1.0);\n    }\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[TextureRefinementShader] FragmentShader "+e.getShaderInfoLog(t)),t},x3dom.shader.BlurShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.BlurShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec2 position;\nvarying vec2 vPosition;\nvoid main(void) {\n vPosition = position;\n gl_Position = vec4(position, -1.0, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[BlurShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.BlurShader.prototype.generateFragmentShader=function(e){var t="#ifdef GL_FRAGMENT_PRECISION_HIGH\n";t+="precision highp float;\n",t+="#else\n",t+=" precision mediump float;\n",t+="#endif\n\n",t+="varying vec2 vPosition;\nuniform sampler2D texture;\nuniform bool horizontal;\nuniform float pixelSizeHor;\nuniform float pixelSizeVert;\nuniform int filterSize;\n",!x3dom.caps.FP_TEXTURES||x3dom.caps.MOBILE?t+=x3dom.shader.rgbaPacking()+"void main(void) {\n vec2 texCoords = (vPosition + 1.0)*0.5;\n vec2 offset;\n if (horizontal) offset = vec2(pixelSizeHor, 0.0);\n else offset = vec2(0.0, pixelSizeVert);\n float depth = unpackDepth(texture2D(texture, texCoords));\n if (filterSize == 3){\n  depth = depth * 0.3844;\n  depth += 0.3078*unpackDepth(texture2D(texture, texCoords-offset));\n  depth += 0.3078*unpackDepth(texture2D(texture, texCoords+offset));\n } else if (filterSize == 5){\n  depth = depth * 0.2921;\n  depth += 0.2339*unpackDepth(texture2D(texture, texCoords-offset));\n  depth += 0.2339*unpackDepth(texture2D(texture, texCoords+offset));\n  depth += 0.1201*unpackDepth(texture2D(texture, texCoords-2.0*offset));\n  depth += 0.1201*unpackDepth(texture2D(texture, texCoords+2.0*offset));\n } else if (filterSize == 7){\n  depth = depth * 0.2161;\n  depth += 0.1907*unpackDepth(texture2D(texture, texCoords-offset));\n  depth += 0.1907*unpackDepth(texture2D(texture, texCoords+offset));\n  depth += 0.1311*unpackDepth(texture2D(texture, texCoords-2.0*offset));\n  depth += 0.1311*unpackDepth(texture2D(texture, texCoords+2.0*offset));\n  depth += 0.0702*unpackDepth(texture2D(texture, texCoords-3.0*offset));\n  depth += 0.0702*unpackDepth(texture2D(texture, texCoords+3.0*offset));\n }\n gl_FragColor = packDepth(depth);\n}\n":t+="void main(void) {\n vec2 texCoords = (vPosition + 1.0)*0.5;\n vec2 offset;\n if (horizontal) offset = vec2(pixelSizeHor, 0.0);\n else offset = vec2(0.0, pixelSizeVert);\n vec4 color = texture2D(texture, texCoords);\n if (filterSize == 3){\n  color = color * 0.3844;\n  color += 0.3078*texture2D(texture, texCoords-offset);\n  color += 0.3078*texture2D(texture, texCoords+offset);\n } else if (filterSize == 5){\n  color = color * 0.2921;\n  color += 0.2339*texture2D(texture, texCoords-offset);\n  color += 0.2339*texture2D(texture, texCoords+offset);\n  color += 0.1201*texture2D(texture, texCoords-2.0*offset);\n  color += 0.1201*texture2D(texture, texCoords+2.0*offset);\n } else if (filterSize == 7){\n  color = color * 0.2161;\n  color += 0.1907*texture2D(texture, texCoords-offset);\n  color += 0.1907*texture2D(texture, texCoords+offset);\n  color += 0.1311*texture2D(texture, texCoords-2.0*offset);\n  color += 0.1311*texture2D(texture, texCoords+2.0*offset);\n  color += 0.0702*texture2D(texture, texCoords-3.0*offset);\n  color += 0.0702*texture2D(texture, texCoords+3.0*offset);\n }\n gl_FragColor = color;\n}\n";var i=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(i,t),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||x3dom.debug.logError("[BlurShader] FragmentShader "+e.getShaderInfoLog(i)),i},x3dom.shader.KHRMaterialCommonsShader=function(e,t){this.program=e.createProgram();var i=this.generateVertexShader(e),s=this.generateFragmentShader(e,t);return e.attachShader(this.program,i),e.attachShader(this.program,s),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.KHRMaterialCommonsShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"precision highp float;\nattribute vec3 position;attribute vec3 normal;attribute vec3 texcoord;varying vec3 v_eye;varying vec3 v_normal;varying vec3 v_texcoord;uniform mat4 modelViewProjectionMatrix;uniform mat4 modelViewMatrix;uniform mat4 normalMatrix;void main (void){    vec4 pos = modelViewProjectionMatrix * vec4(position, 1.0);    v_eye = (modelViewMatrix * vec4(position, 1.0)).xyz;    v_normal = (normalMatrix * vec4(normal,1.0)).xyz;    v_texcoord = texcoord;    gl_Position = pos;}"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[KHRMaterialCommonsShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.KHRMaterialCommonsShader.prototype.generateFragmentShader=function(e,t){var i="precision highp float;\nvarying vec3 v_eye;\nvarying vec3 v_normal;\nvarying vec3 v_texcoord;\nuniform vec4 lightVector;\nuniform vec4 ambient;\n";if((t.LIGHTS||t.CLIPPLANES)&amp;&amp;(i+="varying vec4 fragPosition;\n",i+="uniform float isOrthoView;\n"),t.LIGHTS&amp;&amp;(t.NORMALMAP&amp;&amp;"OBJECT"==t.NORMALSPACE||(i+="varying vec3 fragNormal;\n"),i+=x3dom.shader.light(t.LIGHTS)),0==t.USE_DIFFUSE_TEX?i+="uniform vec4 diffuse;\n":i+="uniform sampler2D diffuseTex;\n",0==t.USE_EMISSION_TEX?i+="uniform vec4 emission;\n":i+="uniform sampler2D emissionTex;\n",0==t.USE_SPECULAR_TEX?i+="uniform vec4 specular;\n":i+="uniform sampler2D specularTex;\n",i+="uniform float shininess;\nuniform float transparency;\nuniform float ambientIntensity;\nuniform vec4 ambientLight;\nuniform int technique;\nvoid main(void)\n{\nvec4 I = -vec4(normalize(v_eye),1.0);\nvec4 N = vec4(normalize(v_normal),1.0);\nvec4 al = ambientLight;\nvec4 L = normalize(lightVector-vec4(v_eye,1.0));\n",0==t.USE_DIFFUSE_TEX?i+="vec4 _diffuse = diffuse;\n":i+="vec4 _diffuse = texture2D(diffuseTex, v_texcoord.xy);\n",0==t.USE_SPECULAR_TEX?i+="vec4 _specularColor = specular;\n":i+="vec4 _specularColor = texture2D(specularTex, v_texcoord.xy);\n",0==t.USE_EMISSION_TEX?i+="vec4 _emission = emission;\n":i+="vec4 _emission = texture2D(emissionTex, v_texcoord.xy);\n",i+="vec4 color;\nif(technique == 0) // BLINN\n{\nvec4 H = normalize(I+L);\ncolor = _emission + ambient * al + _diffuse * max(dot(N,L),0.0) + _specularColor * pow(max(dot(H,N),0.0),shininess);\n}\nelse if(technique==1) // PHONG\n{\nvec4 R = -reflect(L,N);\ncolor = _emission + ambient * al + _diffuse * max(dot(N,L),0.0) + _specularColor * pow(max(dot(R,I),0.0),shininess);\n}\nelse if(technique==2) // LAMBERT\n{\ncolor = _emission + ambient * al + _diffuse * max(dot(N,L), 0.0);\n}\nelse if(technique==3) // CONSTANT\n{\ncolor = _emission + ambient * al;\n}\n",t.LIGHTS){i+="vec3 ambient   = vec3(0.0, 0.0, 0.0);\n",i+="vec3 diffuse   = vec3(0.0, 0.0, 0.0);\n",i+="vec3 specular  = vec3(0.0, 0.0, 0.0);\n",i+="vec3 eye;\n",i+="if ( isOrthoView &gt; 0.0 ) {\n",i+="    eye = vec3(0.0, 0.0, 1.0);\n",i+="} else {\n",i+="    eye = -v_eye.xyz;\n",i+="}\n",i+="vec3 ads;\n";for(var s=0;s&lt;t.LIGHTS;s++){var r="light"+s+"_Color";i+="ads = lighting(light"+s+"_Type, light"+s+"_Location, light"+s+"_Direction, "+r+", light"+s+"_Attenuation, light"+s+"_Radius, light"+s+"_Intensity, light"+s+"_AmbientIntensity, light"+s+"_BeamWidth, light"+s+"_CutOffAngle, v_normal, eye, shininess, ambientIntensity);\n",i+="ambient  += "+r+" * ads.r;\ndiffuse  += "+r+" * ads.g;\nspecular += "+r+" * ads.b;\n"}i+="ambient = max(ambient, 0.0);\n",i+="diffuse = max(diffuse, 0.0);\n",i+="specular = max(specular, 0.0);\n",i+="color.rgb = (_emission.rgb + max(ambient + diffuse, 0.0) * color.rgb + specular*_specularColor.rgb);\n"}i+="gl_FragColor = vec4(color.rgb, 1.0-transparency);\n}";var o=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(o,i),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS)||x3dom.debug.logError("[KHRMaterialCommonsShader] FragmentShader "+e.getShaderInfoLog(o)),o},x3dom.shader.SSAOShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.SSAOShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec3 position;\nvarying vec2 depthTexCoord;\nvarying vec2 randomTexCoord;\nuniform vec2 randomTextureTilingFactor;\n\nvoid main(void) {\n    vec2 texCoord = (position.xy + 1.0) * 0.5;\n    depthTexCoord = texCoord;\n  randomTexCoord = randomTextureTilingFactor*texCoord;\n    gl_Position = vec4(position.xy, 0.0, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[SSAOShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.SSAOShader.depthReconsructionFunctionCode=function(){var e="uniform float depthReconstructionConstantA;\nuniform float depthReconstructionConstantB;\n";return x3dom.caps.FP_TEXTURES&amp;&amp;!x3dom.caps.MOBILE||(e+=x3dom.shader.rgbaPacking()),e+="float getDepth(vec2 depthTexCoord) {\n    vec4 col = texture2D(depthTexture, depthTexCoord);\n    float d;\n",!x3dom.caps.FP_TEXTURES||x3dom.caps.MOBILE?e+="    d = unpackDepth(col);\n":e+="    d = col.b;\n",e+="    return depthReconstructionConstantB/(depthReconstructionConstantA+d);\n",e+="}\n"},x3dom.shader.SSAOShader.prototype.generateFragmentShader=function(e){var t="#ifdef GL_FRAGMENT_PRECISION_HIGH\n";t+="precision highp float;\n",t+="#else\n",t+=" precision mediump float;\n",t+="#endif\n\n",t+="uniform sampler2D depthTexture;\nuniform sampler2D randomTexture;\nuniform float nearPlane;\nuniform float farPlane;\nuniform float radius;\nuniform float depthBufferEpsilon;\nuniform vec3 samples[16];\nvarying vec2 depthTexCoord;\nvarying vec2 randomTexCoord;\n",t+=x3dom.shader.SSAOShader.depthReconsructionFunctionCode(),t+="void main(void) {\n    float referenceDepth = getDepth(depthTexCoord);\n    if(referenceDepth == 1.0)\n    {\n        gl_FragColor = vec4(1.0,1.0,1.0, 1.0);\n        return;\n    }\n    int numOcclusions = 0;\n    for(int i = 0; i&lt;16; ++i){\n        float scale  = 1.0/referenceDepth;\n        vec3 samplepos = reflect(samples[i],texture2D(randomTexture,randomTexCoord).xyz*2.0-vec3(1.0,1.0,1.0));\n        float sampleDepth = getDepth(depthTexCoord+samplepos.xy*scale*radius);\n        //if(abs(sampleDepth-referenceDepth)&lt;=radius*(1.0/nearPlane))\n        if( sampleDepth &lt; referenceDepth-depthBufferEpsilon) {\n            ++numOcclusions;\n        }\n    }\n    float r = 1.0-float(numOcclusions)/16.0;\n    r*=2.0;\n    gl_FragColor = vec4(r,r,r, 1.0);\n}\n";var i=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(i,t),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||x3dom.debug.logError("[SSAOhader] FragmentShader "+e.getShaderInfoLog(i)),i},x3dom.shader.SSAOBlurShader=function(e){this.program=e.createProgram();var t=this.generateVertexShader(e),i=this.generateFragmentShader(e);return e.attachShader(this.program,t),e.attachShader(this.program,i),e.bindAttribLocation(this.program,0,"position"),e.linkProgram(this.program),this.program},x3dom.shader.SSAOBlurShader.prototype.generateVertexShader=function(e){var t=e.createShader(e.VERTEX_SHADER);return e.shaderSource(t,"attribute vec3 position;\nvarying vec2 fragTexCoord;\n\nvoid main(void) {\n    vec2 texCoord = (position.xy + 1.0) * 0.5;\n    fragTexCoord = texCoord;\n    gl_Position = vec4(position.xy, 0.0, 1.0);\n}\n"),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||x3dom.debug.logError("[SSAOShader] VertexShader "+e.getShaderInfoLog(t)),t},x3dom.shader.SSAOBlurShader.prototype.generateFragmentShader=function(e){var t="#ifdef GL_FRAGMENT_PRECISION_HIGH\n";t+="precision highp float;\n",t+="#else\n",t+=" precision mediump float;\n",t+="#endif\n\n",t+="uniform sampler2D SSAOTexture;\nuniform sampler2D depthTexture;\nuniform float nearPlane;\nuniform float farPlane;\nuniform float amount;\nuniform vec2 pixelSize;\nuniform float depthThreshold;\nvarying vec2 fragTexCoord;\n",t+=x3dom.shader.SSAOShader.depthReconsructionFunctionCode(),t+="void main(void) {\n    float sum = 0.0;\n    float numSamples = 0.0;\n    float referenceDepth = getDepth(fragTexCoord);\n    for(int i = -2; i&lt;2;i++){\n        for(int j = -2; j&lt;2;j++){\n            vec2 sampleTexCoord = fragTexCoord+vec2(pixelSize.x*float(i),pixelSize.y*float(j));\n            if(abs(referenceDepth - getDepth(sampleTexCoord))&lt;depthThreshold){\n                sum+= texture2D(SSAOTexture,sampleTexCoord).r;\n                numSamples++;\n    }}}\n    float intensity = mix(1.0,sum/numSamples,amount);\n    gl_FragColor = vec4(intensity,intensity,intensity,1.0);\n}\n";var i=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(i,t),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||x3dom.debug.logError("[SSAOhader] FragmentShader "+e.getShaderInfoLog(i)),i},x3dom.SSAO={},x3dom.SSAO.isEnabled=function(e){return e.getEnvironment()._vf.SSAO},x3dom.SSAO.reinitializeShadersIfNecessary=function(e){void 0===x3dom.SSAO.shaderProgram&amp;&amp;(x3dom.SSAO.shaderProgram=x3dom.Utils.wrapProgram(e,new x3dom.shader.SSAOShader(e),"ssao")),void 0===x3dom.SSAO.blurShaderProgram&amp;&amp;(x3dom.SSAO.blurShaderProgram=x3dom.Utils.wrapProgram(e,new x3dom.shader.SSAOBlurShader(e),"ssao-blur"))},x3dom.SSAO.reinitializeRandomTextureIfNecessary=function(e,t){var i=t.getEnvironment()._vf.SSAOrandomTextureSize!=x3dom.SSAO.currentRandomTextureSize;if(void 0===x3dom.SSAO.randomTexture&amp;&amp;(x3dom.SSAO.randomTexture=e.createTexture()),void 0===x3dom.SSAO.randomTexture||i){e.bindTexture(e.TEXTURE_2D,x3dom.SSAO.randomTexture);for(var s=x3dom.SSAO.currentRandomTextureSize=t.getEnvironment()._vf.SSAOrandomTextureSize,r=new ArrayBuffer(s*s*4),o=new Uint8Array(r),n=0;n&lt;s*s;++n){var a=2*Math.random()-1,h=2*Math.random()-1,d=Math.sqrt(a*a+h*h+0);a/=d,h/=d,o[4*n]=.5*(a+1)*255,o[4*n+1]=.5*(h+1)*255,o[4*n+2]=127.5,o[4*n+3]=255}e.texImage2D(e.TEXTURE_2D,0,e.RGBA,s,s,0,e.RGBA,e.UNSIGNED_BYTE,o),e.bindTexture(e.TEXTURE_2D,null)}},x3dom.SSAO.reinitializeFBOIfNecessary=function(e,t){var i=x3dom.SSAO.currentFBOWidth!=t.width||x3dom.SSAO.currentFBOHeight!=t.height;if(void 0===x3dom.SSAO.fbo||i){x3dom.SSAO.currentFBOWidth=t.width,x3dom.SSAO.currentFBOHeight=t.height;var s=e.getParameter(e.FRAMEBUFFER_BINDING);void 0===x3dom.SSAO.fbo&amp;&amp;(x3dom.SSAO.fbo=e.createFramebuffer()),e.bindFramebuffer(e.FRAMEBUFFER,x3dom.SSAO.fbo),void 0===x3dom.SSAO.fbotex&amp;&amp;(x3dom.SSAO.fbotex=e.createTexture()),e.bindTexture(e.TEXTURE_2D,x3dom.SSAO.fbotex),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,x3dom.SSAO.currentFBOWidth,x3dom.SSAO.currentFBOHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,x3dom.SSAO.fbotex,0),e.bindFramebuffer(e.FRAMEBUFFER,s)}},x3dom.SSAO.render=function(e,t,i,s,r,o){var n=t.getParameter(t.FRAMEBUFFER_BINDING);null!=o&amp;&amp;t.bindFramebuffer(t.FRAMEBUFFER,o),e.frontFace(t.CCW),e.disable(t.CULL_FACE),e.disable(t.DEPTH_TEST);var a=x3dom.SSAO.shaderProgram;e.useProgram(a),a.depthTexture=0,a.randomTexture=1,a.radius=i.getEnvironment()._vf.SSAOradius,a.randomTextureTilingFactor=[r.width/x3dom.SSAO.currentRandomTextureSize,r.height/x3dom.SSAO.currentRandomTextureSize];var h=i.getViewpoint(),d=h.getNear(),l=h.getFar();a.nearPlane=d,a.farPlane=l,a.depthReconstructionConstantA=(l+d)/(d-l),a.depthReconstructionConstantB=2*l*d/(d-l),a.depthBufferEpsilon=1e-4*(l-d),a.samples=[.03800223814729654,.10441029119843426,-.04479934806797181,-.03800223814729654,-.10441029119843426,.04479934806797181,-.17023209847088397,.1428416910414532,.6154407640895228,.17023209847088397,-.1428416910414532,-.6154407640895228,-.288675134594813,-.16666666666666646,-.3774214123135722,.288675134594813,.16666666666666646,.3774214123135722,.07717696785196887,-.43769233467209245,-.5201284112706428,-.07717696785196887,.43769233467209245,.5201284112706428,.5471154183401156,-.09647120981496134,-.15886420745887797,-.5471154183401156,.09647120981496134,.15886420745887797,.3333333333333342,.5773502691896253,-.8012446019636266,-.3333333333333342,-.5773502691896253,.8012446019636266,-.49994591864508653,.5958123446480936,-.15385106176844343,.49994591864508653,-.5958123446480936,.15385106176844343,-.8352823295874743,-.3040179051783715,.7825440557226517,.8352823295874743,.3040179051783715,-.7825440557226517],a.tex||(a.tex=0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,x3dom.SSAO.randomTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i._fgnd._webgl.buffers[0]),t.bindBuffer(t.ARRAY_BUFFER,i._fgnd._webgl.buffers[1]),t.vertexAttribPointer(a.position,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(a.position),t.drawElements(i._fgnd._webgl.primType,i._fgnd._webgl.indexes.length,t.UNSIGNED_SHORT,0),t.disableVertexAttribArray(a.position),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,null),null!=o&amp;&amp;t.bindFramebuffer(t.FRAMEBUFFER,n)},x3dom.SSAO.blur=function(e,t,i,s,r,o,n){var a=t.getParameter(t.FRAMEBUFFER_BINDING);null!=n&amp;&amp;t.bindFramebuffer(t.FRAMEBUFFER,n),e.frontFace(t.CCW),e.disable(t.CULL_FACE),e.disable(t.DEPTH_TEST);var h=x3dom.SSAO.blurShaderProgram;e.useProgram(h),h.SSAOTexture=0,h.depthTexture=1,h.depthThreshold=i.getEnvironment()._vf.SSAOblurDepthTreshold;var d=i.getViewpoint(),l=d.getNear(),u=d.getFar();h.nearPlane=l,h.farPlane=u,h.depthReconstructionConstantA=(u+l)/(l-u),h.depthReconstructionConstantB=2*u*l/(l-u),h.pixelSize=[1/o.width,1/o.height],h.amount=i.getEnvironment()._vf.SSAOamount,t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i._fgnd._webgl.buffers[0]),t.bindBuffer(t.ARRAY_BUFFER,i._fgnd._webgl.buffers[1]),t.vertexAttribPointer(h.position,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(h.position),t.drawElements(i._fgnd._webgl.primType,i._fgnd._webgl.indexes.length,t.UNSIGNED_SHORT,0),t.disableVertexAttribArray(h.position),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,null),null!=n&amp;&amp;t.bindFramebuffer(t.FRAMEBUFFER,a)},x3dom.SSAO.renderSSAO=function(e,t,i,s){this.reinitializeShadersIfNecessary(t),this.reinitializeRandomTextureIfNecessary(t,i),this.reinitializeFBOIfNecessary(t,s),e.viewport(0,0,s.width,s.height),this.render(e,t,i,i._webgl.fboScene.tex,s,x3dom.SSAO.fbo),t.enable(t.BLEND),t.blendFunc(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA),this.blur(e,t,i,x3dom.SSAO.fbotex,i._webgl.fboScene.tex,s,null),t.disable(t.BLEND)},x3dom.gfx_webgl=function(){"use strict";function e(e,t,i,s){this.ctx3d=e,this.canvas=t,this.name=i,this.x3dElem=s,this.IG_PositionBuffer=null,this.cache=new x3dom.Cache,this.stateManager=new x3dom.StateManager(e)}return e.prototype.getName=function(){return this.name},e.prototype.setupShape=function(e,t,i){var s,r,o,n,a,h,d,l,u,f,c=0,m=t.shape,_=m._cf.geometry.node;if(void 0!==m._webgl){var p=!1;if(!0===m._dirty.colors&amp;&amp;void 0===m._webgl.shader.color&amp;&amp;_._mesh._colors[0].length&amp;&amp;(p=!0),p&amp;&amp;m._cleanupGLObjects&amp;&amp;m._cleanupGLObjects(!0,!1),!0===m._dirty.texture){if(m._webgl.texture.length!=m.getTextures().length){for(o=0;o&lt;m._webgl.texture.length;++o)m._webgl.texture.pop();for(r=m.getTextures(),o=0;o&lt;r.length;++o)m._webgl.texture.push(new x3dom.Texture(e,m._nameSpace.doc,this.cache,r[o]));m._dirty.shader=!0,void 0===m._webgl.shader.texcoord&amp;&amp;(m._dirty.texcoords=!0)}else for(r=m.getTextures(),o=0;o&lt;r.length;++o)r[o]===m._webgl.texture[o].node||(m._webgl.texture[o].texture=null,m._webgl.texture[o].node=r[o]),m._webgl.texture[o].update();m._dirty.texture=!1}if(m._webgl.shader=this.cache.getShaderByProperties(e,m,m.getShaderProperties(i)),!p&amp;&amp;0==m._webgl.binaryGeometry)for(c=0;c&lt;m._webgl.positions.length;c++)if(s=6*c,1!=m._dirty.positions&amp;&amp;1!=m._dirty.indexes||(void 0!==m._webgl.shader.position&amp;&amp;(m._webgl.indexes[c]=_._mesh._indices[c],e.deleteBuffer(m._webgl.buffers[s]),u=e.createBuffer(),m._webgl.buffers[s]=u,x3dom.caps.INDEX_UINT&amp;&amp;_._mesh._positions[0].length/3&gt;65535?(f=new Uint32Array(m._webgl.indexes[c]),m._webgl.indexType=e.UNSIGNED_INT):(f=new Uint16Array(m._webgl.indexes[c]),m._webgl.indexType=e.UNSIGNED_SHORT),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u),e.bufferData(e.ELEMENT_ARRAY_BUFFER,f,e.STATIC_DRAW),f=null,m._webgl.positions[c]=_._mesh._positions[c],e.deleteBuffer(m._webgl.buffers[s+1]),a=e.createBuffer(),m._webgl.buffers[s+1]=a,e.bindBuffer(e.ARRAY_BUFFER,a),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m._webgl.buffers[s]),n=new Float32Array(m._webgl.positions[c]),e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,a),e.vertexAttribPointer(m._webgl.shader.position,_._mesh._numPosComponents,m._webgl.coordType,!1,m._coordStrideOffset[0],m._coordStrideOffset[1]),n=null),m._dirty.positions=!1,m._dirty.indexes=!1),1==m._dirty.colors&amp;&amp;(void 0!==m._webgl.shader.color&amp;&amp;(m._webgl.colors[c]=_._mesh._colors[c],e.deleteBuffer(m._webgl.buffers[s+4]),l=e.createBuffer(),m._webgl.buffers[s+4]=l,w=new Float32Array(m._webgl.colors[c]),e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,w,e.STATIC_DRAW),e.vertexAttribPointer(m._webgl.shader.color,_._mesh._numColComponents,m._webgl.colorType,!1,m._colorStrideOffset[0],m._colorStrideOffset[1]),w=null),m._dirty.colors=!1),1==m._dirty.normals&amp;&amp;(void 0!==m._webgl.shader.normal&amp;&amp;(m._webgl.normals[c]=_._mesh._normals[c],e.deleteBuffer(m._webgl.buffers[s+2]),d=e.createBuffer(),m._webgl.buffers[s+2]=d,b=new Float32Array(m._webgl.normals[c]),e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,b,e.STATIC_DRAW),e.vertexAttribPointer(m._webgl.shader.normal,_._mesh._numNormComponents,m._webgl.normalType,!1,m._normalStrideOffset[0],m._normalStrideOffset[1]),b=null),m._dirty.normals=!1),1==m._dirty.texcoords&amp;&amp;(void 0!==m._webgl.shader.texcoord&amp;&amp;(m._webgl.texcoords[c]=_._mesh._texCoords[c],e.deleteBuffer(m._webgl.buffers[s+3]),h=e.createBuffer(),m._webgl.buffers[s+3]=h,S=new Float32Array(m._webgl.texcoords[c]),e.bindBuffer(e.ARRAY_BUFFER,h),e.bufferData(e.ARRAY_BUFFER,S,e.STATIC_DRAW),e.vertexAttribPointer(m._webgl.shader.texCoord,_._mesh._numTexComponents,m._webgl.texCoordType,!1,m._texCoordStrideOffset[0],m._texCoordStrideOffset[1]),S=null),m._dirty.texcoords=!1),1==m._dirty.specialAttribs&amp;&amp;void 0!==m._webgl.shader.particleSize){var x=_._vf.size.toGL();x.length&amp;&amp;(e.deleteBuffer(m._webgl.buffers[s+5]),m._webgl.buffers[s+5]=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,m._webgl.buffers[s+5]),e.bufferData(e.ARRAY_BUFFER,new Float32Array(x),e.STATIC_DRAW)),m._dirty.specialAttribs=!1}if(0!=m._webgl.imageGeometry){for(o=0;o&lt;m._webgl.texture.length;++o)m._webgl.texture[o].updateTexture();_.unsetGeoDirty(),m.unsetGeoDirty()}if(!p)return}else if(!(x3dom.isa(_,x3dom.nodeTypes.Text)||x3dom.isa(_,x3dom.nodeTypes.BinaryGeometry)||x3dom.isa(_,x3dom.nodeTypes.PopGeometry)||x3dom.isa(_,x3dom.nodeTypes.ExternalGeometry)||x3dom.isa(m,x3dom.nodeTypes.ExternalShape))&amp;&amp;(!_||_._mesh._positions[0].length&lt;1))return void(x3dom.caps.MAX_VERTEX_TEXTURE_IMAGE_UNITS&lt;2&amp;&amp;x3dom.isa(_,x3dom.nodeTypes.ImageGeometry)?x3dom.debug.logError("Can't render ImageGeometry nodes with only "+x3dom.caps.MAX_VERTEX_TEXTURE_IMAGE_UNITS+" vertex texture units. Please upgrade your GPU!"):x3dom.debug.logError("NO VALID MESH OR NO VERTEX POSITIONS SET!"));for(m.unsetDirty(),m._cleanupGLObjects||(m._cleanupGLObjects=function(t,i){if(this._webgl&amp;&amp;(arguments.length&gt;0&amp;&amp;t||0==this._parentNodes.length)){for(var s=this._webgl.shader,r=0;r&lt;this._webgl.positions.length;r++){var o=6*r;void 0!==s.position&amp;&amp;(e.deleteBuffer(this._webgl.buffers[o+1]),e.deleteBuffer(this._webgl.buffers[o])),void 0!==s.normal&amp;&amp;e.deleteBuffer(this._webgl.buffers[o+2]),void 0!==s.texcoord&amp;&amp;e.deleteBuffer(this._webgl.buffers[o+3]),void 0!==s.color&amp;&amp;e.deleteBuffer(this._webgl.buffers[o+4]),void 0!==s.id&amp;&amp;e.deleteBuffer(this._webgl.buffers[o+5])}for(var n=0;n&lt;this._webgl.dynamicFields.length;n++){var a=this._webgl.dynamicFields[n];void 0!==s[a.name]&amp;&amp;e.deleteBuffer(a.buf)}void 0===i&amp;&amp;(i=!0),i&amp;&amp;(delete this._webgl,x3dom.BinaryContainerLoader.outOfMemory=!1)}}),m._webgl={positions:_._mesh._positions,normals:_._mesh._normals,texcoords:_._mesh._texCoords,colors:_._mesh._colors,indexes:_._mesh._indices,indexType:e.UNSIGNED_SHORT,coordType:e.FLOAT,normalType:e.FLOAT,texCoordType:e.FLOAT,colorType:e.FLOAT,texture:[],dirtyLighting:x3dom.Utils.checkDirtyLighting(i),imageGeometry:0,binaryGeometry:0,popGeometry:0,externalGeometry:0},r=m.getTextures(),o=0;o&lt;r.length;++o)m._webgl.texture.push(new x3dom.Texture(e,m._nameSpace.doc,this.cache,r[o]));m._webgl.shader=this.cache.getShaderByProperties(e,m,m.getShaderProperties(i));var g=m._webgl.shader,v=0;if(m._webgl.buffers=[],m._webgl.dynamicFields=[],x3dom.isa(_,x3dom.nodeTypes.X3DBinaryContainerGeometryNode)){m._webgl.primType=[];for(var y=0;y&lt;_._vf.primType.length;++y)m._webgl.primType.push(x3dom.Utils.primTypeDic(e,_._vf.primType[y]))}else m._webgl.primType=x3dom.Utils.primTypeDic(e,_._mesh._primType);if(x3dom.isa(_,x3dom.nodeTypes.ExternalGeometry))_.update(m,g,e,i,this);else if(x3dom.isa(m,x3dom.nodeTypes.ExternalShape))m.update(m,g,e,i,this);else if(x3dom.isa(_,x3dom.nodeTypes.BinaryGeometry))x3dom.BinaryContainerLoader.setupBinGeo(m,g,e,i,this);else if(x3dom.isa(_,x3dom.nodeTypes.PopGeometry))x3dom.BinaryContainerLoader.setupPopGeo(m,g,e,i,this);else if(x3dom.isa(_,x3dom.nodeTypes.ImageGeometry))x3dom.BinaryContainerLoader.setupImgGeo(m,g,e,i,this);else{for(c=0;c&lt;m._webgl.positions.length;c++){if(s=6*c,void 0!==g.position&amp;&amp;(u=e.createBuffer(),m._webgl.buffers[s]=u,x3dom.caps.INDEX_UINT&amp;&amp;m._webgl.positions[0].length/3&gt;65535?(f=new Uint32Array(m._webgl.indexes[c]),m._webgl.indexType=e.UNSIGNED_INT):(f=new Uint16Array(m._webgl.indexes[c]),m._webgl.indexType=e.UNSIGNED_SHORT),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u),e.bufferData(e.ELEMENT_ARRAY_BUFFER,f,e.STATIC_DRAW),f=null,a=e.createBuffer(),m._webgl.buffers[s+1]=a,e.bindBuffer(e.ARRAY_BUFFER,a),n=new Float32Array(m._webgl.positions[c]),e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,a),e.vertexAttribPointer(g.position,_._mesh._numPosComponents,m._webgl.coordType,!1,m._coordStrideOffset[0],m._coordStrideOffset[1]),e.enableVertexAttribArray(g.position),n=null),void 0!==g.normal||m._webgl.normals[c]){d=e.createBuffer(),m._webgl.buffers[s+2]=d;var b=new Float32Array(m._webgl.normals[c]);e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,b,e.STATIC_DRAW),e.vertexAttribPointer(g.normal,_._mesh._numNormComponents,m._webgl.normalType,!1,m._normalStrideOffset[0],m._normalStrideOffset[1]),e.enableVertexAttribArray(g.normal),b=null}if(void 0!==g.texcoord){var T=e.createBuffer();m._webgl.buffers[s+3]=T;var S=new Float32Array(m._webgl.texcoords[c]);e.bindBuffer(e.ARRAY_BUFFER,T),e.bufferData(e.ARRAY_BUFFER,S,e.STATIC_DRAW),e.vertexAttribPointer(g.texcoord,_._mesh._numTexComponents,m._webgl.texCoordType,!1,m._texCoordStrideOffset[0],m._texCoordStrideOffset[1]),e.enableVertexAttribArray(g.texcoord),S=null}if(void 0!==g.color){l=e.createBuffer(),m._webgl.buffers[s+4]=l;var w=new Float32Array(m._webgl.colors[c]);e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,w,e.STATIC_DRAW),e.vertexAttribPointer(g.color,_._mesh._numColComponents,m._webgl.colorType,!1,m._colorStrideOffset[0],m._colorStrideOffset[1]),e.enableVertexAttribArray(g.color),w=null}if(void 0!==g.particleSize){var M=_._vf.size.toGL();if(M.length){var E=e.createBuffer();m._webgl.buffers[s+5]=E,e.bindBuffer(e.ARRAY_BUFFER,E),e.bufferData(e.ARRAY_BUFFER,new Float32Array(M),e.STATIC_DRAW)}}}for(var F in _._mesh._dynamicFields)if(_._mesh._dynamicFields.hasOwnProperty(F)){var C=_._mesh._dynamicFields[F];if(m._webgl.dynamicFields[v]={buf:{},name:F,numComponents:C.numComponents},void 0!==g[F]){var A=e.createBuffer();m._webgl.dynamicFields[v++].buf=A;var R=new Float32Array(C.value);e.bindBuffer(e.ARRAY_BUFFER,A),e.bufferData(e.ARRAY_BUFFER,R,e.STATIC_DRAW),e.vertexAttribPointer(g[F],C.numComponents,e.FLOAT,!1,0,0),R=null}}}},e.prototype.setupScene=function(e,t){var i=null,s=null,r=this;if(void 0!==t._webgl){if(!t._dirty)return;void 0!==t._webgl.texture&amp;&amp;t._webgl.texture&amp;&amp;e.deleteTexture(t._webgl.texture),t._cleanupGLObjects&amp;&amp;t._cleanupGLObjects(),t._webgl={}}t._dirty=!1;var o=t.getTexUrl(),n=0;if(o.length&gt;0&amp;&amp;o[0].length&gt;0)o.length&gt;=6&amp;&amp;o[1].length&gt;0&amp;&amp;o[2].length&gt;0&amp;&amp;o[3].length&gt;0&amp;&amp;o[4].length&gt;0&amp;&amp;o[5].length&gt;0?(i=new x3dom.nodeTypes.Sphere,t._webgl={positions:i._mesh._positions[0],indexes:i._mesh._indices[0],buffers:[{},{}]},t._webgl.primType=e.TRIANGLES,t._webgl.shader=this.cache.getShader(e,x3dom.shader.BACKGROUND_CUBETEXTURE),t._webgl.texture=x3dom.Utils.createTextureCube(e,t._nameSpace.doc,o,!0,t._vf.crossOrigin,!0,!1)):(t._webgl={positions:[-1,-1,0,-1,1,0,1,-1,0,1,1,0],indexes:[0,1,2,3],buffers:[{},{}]},o=t._nameSpace.getURL(o[0]),t._webgl.texture=x3dom.Utils.createTexture2D(e,t._nameSpace.doc,o,!0,t._vf.crossOrigin,!1,!1),t._webgl.primType=e.TRIANGLE_STRIP,t._webgl.shader=this.cache.getShader(e,x3dom.shader.BACKGROUND_TEXTURE));else if(t.getSkyColor().length&gt;1||t.getGroundColor().length){i=new x3dom.nodeTypes.Sphere,s=e.createTexture(),t._webgl={positions:i._mesh._positions[0],texcoords:i._mesh._texCoords[0],indexes:i._mesh._indices[0],buffers:[{},{},{}],texture:s,primType:e.TRIANGLES};var a=x3dom.Utils.nextHighestPowerOfTwo(t.getSkyColor().length+t.getGroundColor().length+2);a=a&lt;512?512:a;var h=t._vf.groundAngle.length,d=[],l=[],u=[],f=[0];for(n=0;n&lt;t._vf.skyColor.length;n++)u[n]=t._vf.skyColor[n];for(n=0;n&lt;t._vf.skyAngle.length;n++)f[n+1]=t._vf.skyAngle[n];if(h&gt;0||1==t._vf.groundColor.length){for(f[f.length-1]&lt;Math.PI/2&amp;&amp;(f[f.length]=Math.PI/2-x3dom.fields.Eps,u[u.length]=u[u.length-1]),n=h-1;n&gt;=0;n--)n==h-1&amp;&amp;Math.PI-t._vf.groundAngle[n]&lt;=Math.PI/2&amp;&amp;(f[f.length]=Math.PI/2,u[u.length]=t._vf.groundColor[t._vf.groundColor.length-1]),f[f.length]=Math.PI-t._vf.groundAngle[n],u[u.length]=t._vf.groundColor[n+1];0==h&amp;&amp;1==t._vf.groundColor.length&amp;&amp;(f[f.length]=Math.PI/2,u[u.length]=t._vf.groundColor[0]),f[f.length]=Math.PI,u[u.length]=t._vf.groundColor[0]}else f[f.length-1]&lt;Math.PI&amp;&amp;(f[f.length]=Math.PI,u[u.length]=u[u.length-1]);for(n=0;n&lt;f.length;n++)f[n]/=Math.PI;if(f.length!=u.length){x3dom.debug.logError("Number of background colors and corresponding angles are different!");var c=f.length&lt;u.length?f.length:u.length;f.length=c,u.length=c}var m=new x3dom.nodeTypes.ColorInterpolator;for(m._vf.key=new x3dom.fields.MFFloat(f),m._vf.keyValue=new x3dom.fields.MFColor(u),n=0;n&lt;a;n++)m._vf.set_fraction=n/(a-1),m.fieldChanged("set_fraction"),d[n]=m._vf.value_changed;d.reverse();var _=Math.floor(255*(1-t.getTransparency()));for(n=0;n&lt;d.length;n++)l.push(Math.floor(255*d[n].r),Math.floor(255*d[n].g),Math.floor(255*d[n].b),_);var p=new Uint8Array(l),x=e.RGBA;a=p.length/4,e.bindTexture(e.TEXTURE_2D,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.texImage2D(e.TEXTURE_2D,0,x,1,a,0,x,e.UNSIGNED_BYTE,p),e.bindTexture(e.TEXTURE_2D,null),t._webgl.shader=this.cache.getShader(e,x3dom.shader.BACKGROUND_SKYTEXTURE)}else t._webgl={};if(t._webgl.shader){var g=t._webgl.shader,v=e.createBuffer();t._webgl.buffers[1]=v,e.bindBuffer(e.ARRAY_BUFFER,v);var y=new Float32Array(t._webgl.positions);e.bufferData(e.ARRAY_BUFFER,y,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,v),e.vertexAttribPointer(g.position,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(g.position);var b=e.createBuffer();t._webgl.buffers[0]=b;var T=new Uint16Array(t._webgl.indexes);if(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,b),e.bufferData(e.ELEMENT_ARRAY_BUFFER,T,e.STATIC_DRAW),y=null,T=null,void 0!==g.texcoord){var S=e.createBuffer();t._webgl.buffers[2]=S;var w=new Float32Array(t._webgl.texcoords);e.bindBuffer(e.ARRAY_BUFFER,S),e.bufferData(e.ARRAY_BUFFER,w,e.STATIC_DRAW),e.vertexAttribPointer(g.texcoord,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(g.texcoord),w=null}t._cleanupGLObjects=function(){var t=this._webgl.shader;void 0!==t.position&amp;&amp;(e.deleteBuffer(this._webgl.buffers[0]),e.deleteBuffer(this._webgl.buffers[1])),void 0!==t.texcoord&amp;&amp;e.deleteBuffer(this._webgl.buffers[2])}}t._webgl.render=function(e,i,s){var o=t._webgl.shader,n=1-t.getTransparency(),a=null,h=s._22,d=s._23,l=i.e3();if(void 0!==o&amp;&amp;null!==o&amp;&amp;void 0!==o.texcoord&amp;&amp;null!==o.texcoord&amp;&amp;void 0!==t._webgl.texture&amp;&amp;null!==t._webgl.texture)e.clearColor(0,0,0,n),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT),r.stateManager.frontFace(e.CCW),r.stateManager.disable(e.CULL_FACE),r.stateManager.disable(e.DEPTH_TEST),r.stateManager.disable(e.BLEND),r.stateManager.useProgram(o),o.tex||(o.tex=0),s._22=100001/99999,s._23=2e5/99999,i._03=0,i._13=0,i._23=0,a=s.mult(i),o.modelViewProjectionMatrix=a.toGL(),i._03=l.x,i._13=l.y,i._23=l.z,s._22=h,s._23=d,e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t._webgl.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t._webgl.buffers[0]),e.bindBuffer(e.ARRAY_BUFFER,t._webgl.buffers[1]),e.vertexAttribPointer(o.position,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o.position),e.bindBuffer(e.ARRAY_BUFFER,t._webgl.buffers[2]),e.vertexAttribPointer(o.texcoord,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o.texcoord),e.drawElements(t._webgl.primType,t._webgl.indexes.length,e.UNSIGNED_SHORT,0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.disableVertexAttribArray(o.position),e.disableVertexAttribArray(o.texcoord),e.clear(e.DEPTH_BUFFER_BIT);else if(!o||!t._webgl.texture||void 0!==t._webgl.texture.textureCubeReady&amp;&amp;!0!==t._webgl.texture.textureCubeReady){var u=t.getSkyColor().toGL();e.clearColor(u[0],u[1],u[2],n),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)}else{if(e.clearColor(0,0,0,n),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT),r.stateManager.frontFace(e.CCW),r.stateManager.disable(e.CULL_FACE),r.stateManager.disable(e.DEPTH_TEST),r.stateManager.disable(e.BLEND),r.stateManager.useProgram(o),o.tex||(o.tex=0),t._webgl.texture.textureCubeReady)s._22=100001/99999,s._23=2e5/99999,i._03=0,i._13=0,i._23=0,a=s.mult(i),o.modelViewProjectionMatrix=a.toGL(),i._03=l.x,i._13=l.y,i._23=l.z,s._22=h,s._23=d,e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,t._webgl.texture),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);else{if(e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t._webgl.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t._vf.scaling&amp;&amp;t._webgl.texture.ready){var f=1,c=new x3dom.fields.SFVec2f(r.canvas.width,r.canvas.height),m=new x3dom.fields.SFVec2f(t._webgl.texture.width,t._webgl.texture.height);c.x&gt;c.y?(f=c.x/m.x,m.x=c.x,m.y=m.y*f):(f=c.y/m.y,m.y=c.y,m.x=m.x*f);var _=c.divideComponents(m),p=m.subtract(c).multiply(.5).divideComponents(m)}else _=new x3dom.fields.SFVec2f(1,1),p=new x3dom.fields.SFVec2f(0,0);o.scale=_.toGL(),o.translation=p.toGL()}e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t._webgl.buffers[0]),e.bindBuffer(e.ARRAY_BUFFER,t._webgl.buffers[1]),e.vertexAttribPointer(o.position,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o.position),e.drawElements(t._webgl.primType,t._webgl.indexes.length,e.UNSIGNED_SHORT,0),e.disableVertexAttribArray(o.position),e.activeTexture(e.TEXTURE0),t._webgl.texture.textureCubeReady?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null),e.clear(e.DEPTH_BUFFER_BIT)}}},e.prototype.setupFgnds=function(e,t){if(void 0===t._fgnd){var i=this;t._fgnd={},t._fgnd._webgl={positions:[-1,-1,0,-1,1,0,1,-1,0,1,1,0],indexes:[0,1,2,3],buffers:[{},{}]},t._fgnd._webgl.primType=e.TRIANGLE_STRIP,t._fgnd._webgl.shader=this.cache.getShader(e,x3dom.shader.FRONTGROUND_TEXTURE);var s=t._fgnd._webgl.shader,r=e.createBuffer();t._fgnd._webgl.buffers[1]=r,e.bindBuffer(e.ARRAY_BUFFER,r);var o=new Float32Array(t._fgnd._webgl.positions);e.bufferData(e.ARRAY_BUFFER,o,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,r),e.vertexAttribPointer(s.position,3,e.FLOAT,!1,0,0);var n=e.createBuffer();t._fgnd._webgl.buffers[0]=n;var a=new Uint16Array(t._fgnd._webgl.indexes);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n),e.bufferData(e.ELEMENT_ARRAY_BUFFER,a,e.STATIC_DRAW),o=null,a=null,t._fgnd._webgl.render=function(e,r){t._fgnd._webgl.texture=r,i.stateManager.frontFace(e.CCW),i.stateManager.disable(e.CULL_FACE),i.stateManager.disable(e.DEPTH_TEST),i.stateManager.useProgram(s),s.tex||(s.tex=0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t._fgnd._webgl.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t._fgnd._webgl.buffers[0]),e.bindBuffer(e.ARRAY_BUFFER,t._fgnd._webgl.buffers[1]),e.vertexAttribPointer(s.position,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s.position),e.drawElements(t._fgnd._webgl.primType,t._fgnd._webgl.indexes.length,e.UNSIGNED_SHORT,0),e.disableVertexAttribArray(s.position),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null)}}},e.prototype.renderShadowPass=function(e,t,i,s,r,o,n){var a=t._scene,h=!1;this.stateManager.bindFramebuffer(e.FRAMEBUFFER,r.fbo),this.stateManager.viewport(0,0,r.width,r.height),e.clearColor(1,1,1,0),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),this.stateManager.depthFunc(e.LEQUAL),this.stateManager.enable(e.DEPTH_TEST),this.stateManager.enable(e.CULL_FACE),this.stateManager.disable(e.BLEND);x3dom.fields.SFVec3f.NullVector.toGL(),x3dom.fields.SFVec3f.OneVector.toGL();var d,l=a.getEnvironment()._vf.shadowExcludeTransparentObjects,u=a.drawableCollection.length;for(d=0;d&lt;u;d++){var f=a.drawableCollection.get(d),c=f.transform,m=f.shape,_=m._webgl;if(_&amp;&amp;(!l||"transparent"!=f.sortType)){var p=m._cf.geometry.node,x=m._cf.appearance.node,g=(p._mesh,m.getShaderProperties(t)),v=this.cache.getShaderByProperties(e,m,g,null,!0);if(!v)return;if(this.stateManager.useProgram(v),v.cameraView=n,v.offset=o,v.modelViewProjectionMatrix=i.mult(c).toGL(),_.coordType!=e.FLOAT&amp;&amp;(!_.popGeometry&amp;&amp;x3dom.Utils.isUnsignedType(p._vf.coordType)?v.bgCenter=p.getMin().toGL():v.bgCenter=p._vf.position.toGL(),v.bgSize=p._vf.size.toGL(),v.bgPrecisionMax=p.getPrecisionMax("coordType")),m._clipPlanes){v.modelViewMatrix=s.mult(c).toGL(),v.viewMatrixInverse=s.inverse().toGL();for(var y=0;y&lt;m._clipPlanes.length;y++){var b=m._clipPlanes[y].plane,T=m._clipPlanes[y].trafo;v["clipPlane"+y+"_Plane"]=T.multMatrixPlane(b._vf.plane).toGL(),v["clipPlane"+y+"_CappingStrength"]=b._vf.cappingStrength,v["clipPlane"+y+"_CappingColor"]=b._vf.cappingColor.toGL()}}if(0==_.imageGeometry||x3dom.caps.MOBILE){if((0!=_.binaryGeometry||0!=_.externalGeometry)&amp;&amp;1==p._vf.idsPerVertex){var S=x._shader;if(S&amp;&amp;x3dom.isa(x._shader,x3dom.nodeTypes.CommonSurfaceShader)&amp;&amp;S.getMultiVisibilityMap()){v.multiVisibilityMap=0;var w=x3dom.Utils.findTextureByName(_.texture,"multiVisibilityMap");v.multiVisibilityWidth=w.texture.width,v.multiVisibilityHeight=w.texture.height,e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,w.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST)}}}else{v.IG_bboxMin=p.getMin().toGL(),v.IG_bboxMax=p.getMax().toGL(),v.IG_implicitMeshSize=p._vf.implicitMeshSize.toGL();var M=x3dom.Utils.findTextureByName(_.texture,"IG_coords0");if(M&amp;&amp;(v.IG_coordTextureWidth=M.texture.width,v.IG_coordTextureHeight=M.texture.height),1==_.imageGeometry){var E=x3dom.Utils.findTextureByName(_.texture,"IG_index");E&amp;&amp;(v.IG_indexTextureWidth=E.texture.width,v.IG_indexTextureHeight=E.texture.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,E.texture),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,M.texture)}else e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,M.texture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);var F=0;p.getIndexTexture()&amp;&amp;(v.IG_indexTexture||(v.IG_indexTexture=F++)),p.getCoordinateTexture(0)&amp;&amp;(v.IG_coordinateTexture||(v.IG_coordinateTexture=F++))}m.isSolid()?(this.stateManager.enable(e.CULL_FACE),m.isCCW()?this.stateManager.frontFace(e.CCW):this.stateManager.frontFace(e.CW)):this.stateManager.disable(e.CULL_FACE);var C,A=x?x._cf.depthMode.node:null;if(A?A._vf.enableDepthTest?(this.stateManager.enable(e.DEPTH_TEST),this.stateManager.depthMask(!A._vf.readOnly),this.stateManager.depthFunc(x3dom.Utils.depthFunc(e,A._vf.depthFunc)),this.stateManager.depthRange(A._vf.zNearRange,A._vf.zFarRange)):this.stateManager.disable(e.DEPTH_TEST):(this.stateManager.enable(e.DEPTH_TEST),this.stateManager.depthMask(!0),this.stateManager.depthFunc(e.LEQUAL)),_.popGeometry){var R=s.mult(c);this.updatePopState(f,p,v,_,a,R,t,this.x3dElem.runtime.fps)}C=0!=_.externalGeometry?m.meshes.length:_.positions.length;for(var I=0;I&lt;C;I++){var N,P,D,V=6*I;if(0!=_.externalGeometry){var L=m.meshes[I];L.bindVertexAttribPointerPosition(e,v,!1),L.render(e,null)}else if(void 0===v.position||!_.buffers[V+1]||!_.indexes[I])continue;if(h=!1,0==_.externalGeometry)if(_.buffers[V]&amp;&amp;(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_.buffers[V]),h=!0),this.setVertexAttribPointerPosition(e,m,V,I),void 0!==v.id&amp;&amp;_.buffers[V+5]&amp;&amp;(e.bindBuffer(e.ARRAY_BUFFER,_.buffers[V+5]),0==_.binaryGeometry&amp;&amp;0==_.externalGeometry||1!=p._vf.idsPerVertex||(e.vertexAttribPointer(v.id,1,e.FLOAT,!1,4,0),e.enableVertexAttribArray(v.id))),h&amp;&amp;(_.binaryGeometry&gt;0||_.popGeometry&gt;0))for(N=0,D=0,P=p._vf.vertexCount.length;N&lt;P;N++)e.drawElements(_.primType[N],p._vf.vertexCount[N],_.indexType,x3dom.Utils.getByteAwareOffset(D,_.indexType,e)),D+=p._vf.vertexCount[N];else if(_.binaryGeometry&lt;0||_.popGeometry&lt;0||_.imageGeometry)for(N=0,D=0,P=p._vf.vertexCount.length;N&lt;P;N++)e.drawArrays(_.primType[N],D,p._vf.vertexCount[N]),D+=p._vf.vertexCount[N];else if(p.hasIndexOffset()){var O=m.tessellationProperties();for(N=0,P=O.length;N&lt;P;N++)e.drawElements(_.primType,O[N].count,_.indexType,O[N].offset*x3dom.Utils.getOffsetMultiplier(_.indexType,e))}else 0==_.indexes[I].length?e.drawArrays(_.primType,0,_.positions[I].length/3):e.drawElements(_.primType,_.indexes[I].length,_.indexType,0);e.disableVertexAttribArray(v.position),void 0!==v.texcoord&amp;&amp;_.buffers[V+3]&amp;&amp;e.disableVertexAttribArray(v.texcoord),void 0!==v.color&amp;&amp;_.buffers[V+4]&amp;&amp;e.disableVertexAttribArray(v.color),void 0!==v.id&amp;&amp;_.buffers[V+5]&amp;&amp;e.disableVertexAttribArray(v.id)}0==_.imageGeometry||x3dom.caps.MOBILE||(e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),1==_.imageGeometry&amp;&amp;(e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null)))}}x3dom.Utils.needLineWidth&amp;&amp;this.stateManager.lineWidth(1),A&amp;&amp;(this.stateManager.enable(e.DEPTH_TEST),this.stateManager.depthMask(!0),this.stateManager.depthFunc(e.LEQUAL),this.stateManager.depthRange(0,1)),e.flush(),this.stateManager.bindFramebuffer(e.FRAMEBUFFER,null)},e.prototype.renderPickingPass=function(e,t,i,s,r,o,n,a,h,d,l){var u=t._webgl.pickScale,f=t._webgl.fboPick.height,c=a*u,m=f-1-h*u,_=!1;this.stateManager.bindFramebuffer(e.FRAMEBUFFER,t._webgl.fboPick.fbo),this.stateManager.viewport(0,0,t._webgl.fboPick.width,f),e.clearColor(0,0,0,0),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);var p=t.drawableCollection.viewarea,x=t.getEnvironment(),g=t.drawableCollection.length;x._vf.smallFeatureCulling&amp;&amp;x._lowPriorityThreshold&lt;1&amp;&amp;p.isMovingOrAnimating()&amp;&amp;!(g=Math.floor(g*x._lowPriorityThreshold))&amp;&amp;t.drawableCollection.length&amp;&amp;(g=1);x3dom.fields.SFVec3f.NullVector.toGL(),x3dom.fields.SFVec3f.OneVector.toGL();this.stateManager.depthFunc(e.LEQUAL),this.stateManager.enable(e.DEPTH_TEST),this.stateManager.enable(e.CULL_FACE),this.stateManager.disable(e.BLEND),x3dom.Utils.needLineWidth&amp;&amp;this.stateManager.lineWidth(2);for(var v=0;v&lt;g;v++){var y=t.drawableCollection.get(v),b=y.transform,T=y.shape,S=T._webgl;if(S&amp;&amp;!(T._objectID&lt;1)&amp;&amp;T._vf.isPickable){var w=T._cf.geometry.node,M=T._cf.appearance.node,E=(w._mesh,T.getShaderProperties(p)),F=this.cache.getShaderByProperties(e,T,E,n);if(!F)return;if(this.stateManager.useProgram(F),F.modelMatrix=b.toGL(),F.modelViewProjectionMatrix=s.mult(b).toGL(),F.lowBit=(255&amp;T._objectID)/255,F.highBit=(T._objectID&gt;&gt;&gt;8)/255,F.from=r.toGL(),F.sceneSize=o,0==S.binaryGeometry&amp;&amp;0==S.externalGeometry||1!=w._vf.idsPerVertex||(F.shadowIDs=T._vf.idOffset+x3dom.nodeTypes.Shape.objectID+2),S.coordType!=e.FLOAT&amp;&amp;(!S.popGeometry&amp;&amp;x3dom.Utils.isUnsignedType(w._vf.coordType)?F.bgCenter=w.getMin().toGL():F.bgCenter=w._vf.position.toGL(),F.bgSize=w._vf.size.toGL(),F.bgPrecisionMax=w.getPrecisionMax("coordType")),1==n&amp;&amp;S.colorType!=e.FLOAT&amp;&amp;(F.bgPrecisionColMax=w.getPrecisionMax("colorType")),2==n&amp;&amp;S.texCoordType!=e.FLOAT&amp;&amp;(F.bgPrecisionTexMax=w.getPrecisionMax("texCoordType")),T._clipPlanes){F.modelViewMatrix=i.mult(b).toGL(),F.viewMatrixInverse=i.inverse().toGL();for(var C=0;C&lt;T._clipPlanes.length;C++){var A=T._clipPlanes[C].plane,R=T._clipPlanes[C].trafo;F["clipPlane"+C+"_Plane"]=R.multMatrixPlane(A._vf.plane).toGL(),F["clipPlane"+C+"_CappingStrength"]=A._vf.cappingStrength,F["clipPlane"+C+"_CappingColor"]=A._vf.cappingColor.toGL()}}if(0==S.imageGeometry||x3dom.caps.MOBILE){if((0!=S.binaryGeometry||0!=S.externalGeometry)&amp;&amp;1==w._vf.idsPerVertex){var I=M._shader;if(I&amp;&amp;x3dom.isa(M._shader,x3dom.nodeTypes.CommonSurfaceShader)&amp;&amp;I.getMultiVisibilityMap()){F.multiVisibilityMap=0;var N=x3dom.Utils.findTextureByName(S.texture,"multiVisibilityMap");F.multiVisibilityWidth=N.texture.width,F.multiVisibilityHeight=N.texture.height,e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,N.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST)}}}else{F.IG_bboxMin=w.getMin().toGL(),F.IG_bboxMax=w.getMax().toGL(),F.IG_implicitMeshSize=w._vf.implicitMeshSize.toGL();var P=x3dom.Utils.findTextureByName(S.texture,"IG_coords0");if(P&amp;&amp;(F.IG_coordTextureWidth=P.texture.width,F.IG_coordTextureHeight=P.texture.height),1==S.imageGeometry){var D=x3dom.Utils.findTextureByName(S.texture,"IG_index");D&amp;&amp;(F.IG_indexTextureWidth=D.texture.width,F.IG_indexTextureHeight=D.texture.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,D.texture),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,P.texture)}else e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,P.texture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);var V=0;w.getIndexTexture()&amp;&amp;(F.IG_indexTexture||(F.IG_indexTexture=V++)),w.getCoordinateTexture(0)&amp;&amp;(F.IG_coordinateTexture||(F.IG_coordinateTexture=V++))}T.isSolid()?(this.stateManager.enable(e.CULL_FACE),T.isCCW()?this.stateManager.frontFace(e.CCW):this.stateManager.frontFace(e.CW)):this.stateManager.disable(e.CULL_FACE);var L,O=M?M._cf.depthMode.node:null;if(O?O._vf.enableDepthTest?(this.stateManager.enable(e.DEPTH_TEST),this.stateManager.depthMask(!O._vf.readOnly),this.stateManager.depthFunc(x3dom.Utils.depthFunc(e,O._vf.depthFunc)),this.stateManager.depthRange(O._vf.zNearRange,O._vf.zFarRange)):this.stateManager.disable(e.DEPTH_TEST):(this.stateManager.enable(e.DEPTH_TEST),this.stateManager.depthMask(!0),this.stateManager.depthFunc(e.LEQUAL)),S.popGeometry){var k=i.mult(b);this.updatePopState(y,w,F,S,t,k,p,this.x3dElem.runtime.fps)}L=0!=S.externalGeometry?T.meshes.length:S.positions.length;for(var B=0;B&lt;L;B++){var U,z,G,X=6*B;if(0!=S.externalGeometry){var j=T.meshes[B];j.bindVertexAttribPointerPosition(e,F,!1),j.render(e,null)}else if(void 0===F.position||!S.buffers[X+1]||!S.indexes[B])continue;if(_=!1,0==S.externalGeometry)if(S.buffers[X]&amp;&amp;(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.buffers[X]),_=!0),this.setVertexAttribPointerPosition(e,T,X,B),1==n&amp;&amp;this.setVertexAttribPointerColor(e,T,X,B),2==n&amp;&amp;void 0!==F.texcoord&amp;&amp;S.buffers[X+3]&amp;&amp;this.setVertexAttribPointerTexCoord(e,T,X,B),void 0!==F.id&amp;&amp;S.buffers[X+5]&amp;&amp;(e.bindBuffer(e.ARRAY_BUFFER,S.buffers[X+5]),0==S.binaryGeometry&amp;&amp;0==S.externalGeometry||1!=w._vf.idsPerVertex||(e.vertexAttribPointer(F.id,1,e.FLOAT,!1,4,0),e.enableVertexAttribArray(F.id))),_&amp;&amp;(S.binaryGeometry&gt;0||S.popGeometry&gt;0))for(U=0,G=0,z=w._vf.vertexCount.length;U&lt;z;U++)e.drawElements(S.primType[U],w._vf.vertexCount[U],S.indexType,x3dom.Utils.getByteAwareOffset(G,S.indexType,e)),G+=w._vf.vertexCount[U];else if(S.binaryGeometry&lt;0||S.popGeometry&lt;0||S.imageGeometry)for(U=0,G=0,z=w._vf.vertexCount.length;U&lt;z;U++)e.drawArrays(S.primType[U],G,w._vf.vertexCount[U]),G+=w._vf.vertexCount[U];else if(w.hasIndexOffset()){var H=T.tessellationProperties();for(U=0,z=H.length;U&lt;z;U++)e.drawElements(S.primType,H[U].count,S.indexType,H[U].offset*x3dom.Utils.getOffsetMultiplier(S.indexType,e))}else 0==S.indexes[B].length?e.drawArrays(S.primType,0,S.positions[B].length/3):e.drawElements(S.primType,S.indexes[B].length,S.indexType,0);e.disableVertexAttribArray(F.position),void 0!==F.texcoord&amp;&amp;S.buffers[X+3]&amp;&amp;e.disableVertexAttribArray(F.texcoord),void 0!==F.color&amp;&amp;S.buffers[X+4]&amp;&amp;e.disableVertexAttribArray(F.color),void 0!==F.id&amp;&amp;S.buffers[X+5]&amp;&amp;e.disableVertexAttribArray(F.id)}0==S.imageGeometry||x3dom.caps.MOBILE||(e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),1==S.imageGeometry&amp;&amp;(e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null)))}}x3dom.Utils.needLineWidth&amp;&amp;this.stateManager.lineWidth(1),O&amp;&amp;(this.stateManager.enable(e.DEPTH_TEST),this.stateManager.depthMask(!0),this.stateManager.depthFunc(e.LEQUAL),this.stateManager.depthRange(0,1)),e.flush();try{var W=new Uint8Array(4*d*l);e.readPixels(c,m,d,l,e.RGBA,e.UNSIGNED_BYTE,W),t._webgl.fboPick.pixelData=W}catch(q){t._webgl.fboPick.pixelData=[],x3dom.debug.logException(q+" (cannot pick)")}this.stateManager.bindFramebuffer(e.FRAMEBUFFER,null)},e.prototype.renderShape=function(e,t,i,s,r,o,n,a,h){var d=!1,l=e.shape,u=e.transform;if(l&amp;&amp;l._webgl&amp;&amp;u){var f=l._webgl,c=f.shader;if(c){var m=this.stateManager.useProgram(c),_=l._cf.appearance.node,p=l._cf.geometry.node,x=p._mesh,g=t._scene,v=null;f.coordType!=h.FLOAT?(!f.popGeometry&amp;&amp;x3dom.Utils.isUnsignedType(p._vf.coordType)?c.bgCenter=p.getMin().toGL():c.bgCenter=p._vf.position.toGL(),c.bgSize=p._vf.size.toGL(),c.bgPrecisionMax=p.getPrecisionMax("coordType")):(c.bgCenter=[0,0,0],c.bgSize=[1,1,1],c.bgPrecisionMax=1),f.colorType!=h.FLOAT?c.bgPrecisionColMax=p.getPrecisionMax("colorType"):c.bgPrecisionColMax=1,f.texCoordType!=h.FLOAT?c.bgPrecisionTexMax=p.getPrecisionMax("texCoordType"):c.bgPrecisionTexMax=1,f.normalType!=h.FLOAT?c.bgPrecisionNorMax=p.getPrecisionMax("normalType"):c.bgPrecisionNorMax=1,0!=f.imageGeometry&amp;&amp;(c.IG_bboxMin=p.getMin().toGL(),c.IG_bboxMax=p.getMax().toGL(),c.IG_implicitMeshSize=p._vf.implicitMeshSize.toGL(),(v=x3dom.Utils.findTextureByName(f.texture,"IG_coords0"))&amp;&amp;(c.IG_coordTextureWidth=v.texture.width,c.IG_coordTextureHeight=v.texture.height),1==f.imageGeometry&amp;&amp;(v=x3dom.Utils.findTextureByName(f.texture,"IG_index"))&amp;&amp;(c.IG_indexTextureWidth=v.texture.width,c.IG_indexTextureHeight=v.texture.height),v=null);var y=g.getFog();y&amp;&amp;m&amp;&amp;(c.fogColor=y._vf.color.toGL(),c.fogRange=y._vf.visibilityRange,c.fogType="LINEAR"==y._vf.fogType?0:1);var b=_?_._cf.material.node:null,T=_?_._shader:null,S=!1,w=T&amp;&amp;x3dom.isa(T,x3dom.nodeTypes.ComposedShader);if(f.csshader?(c.diffuseColor=T._vf.diffuseFactor.toGL(),c.specularColor=T._vf.specularFactor.toGL(),c.emissiveColor=T._vf.emissiveFactor.toGL(),c.shininess=T._vf.shininessFactor,c.ambientIntensity=(T._vf.ambientFactor.x+T._vf.ambientFactor.y+T._vf.ambientFactor.z)/3,c.transparency=1-T._vf.alphaFactor,c.environmentFactor=T._vf.environmentFactor.x,T.getDisplacementMap()?(v=x3dom.Utils.findTextureByName(f.texture,"displacementMap"),c.displacementWidth=v.texture.width,c.displacementHeight=v.texture.height,c.displacementFactor=T._vf.displacementFactor,c.displacementAxis="x"==T._vf.displacementAxis?0:"y"==T._vf.displacementAxis?1:2):T.getDiffuseDisplacementMap()&amp;&amp;(v=x3dom.Utils.findTextureByName(f.texture,"diffuseDisplacementMap"),c.displacementWidth=v.texture.width,c.displacementHeight=v.texture.height,c.displacementFactor=T._vf.displacementFactor,c.displacementAxis="x"==T._vf.displacementAxis?0:"y"==T._vf.displacementAxis?1:2),T.getMultiDiffuseAlphaMap()&amp;&amp;(v=x3dom.Utils.findTextureByName(f.texture,"multiDiffuseAlphaMap"),c.multiDiffuseAlphaWidth=v.texture.width,c.multiDiffuseAlphaHeight=v.texture.height),T.getMultiEmissiveAmbientMap()&amp;&amp;(v=x3dom.Utils.findTextureByName(f.texture,"multiEmissiveAmbientMap"),c.multiEmissiveAmbientWidth=v.texture.width,c.multiEmissiveAmbientHeight=v.texture.height),T.getMultiSpecularShininessMap()&amp;&amp;(v=x3dom.Utils.findTextureByName(f.texture,"multiSpecularShininessMap"),c.multiSpecularShininessWidth=v.texture.width,c.multiSpecularShininessHeight=v.texture.height),T.getMultiVisibilityMap()&amp;&amp;(v=x3dom.Utils.findTextureByName(f.texture,"multiVisibilityMap"),c.multiVisibilityWidth=v.texture.width,c.multiVisibilityHeight=v.texture.height)):b?(c.diffuseColor=b._vf.diffuseColor.toGL(),c.specularColor=b._vf.specularColor.toGL(),c.emissiveColor=b._vf.emissiveColor.toGL(),c.shininess=b._vf.shininess,c.ambientIntensity=b._vf.ambientIntensity,c.transparency=b._vf.transparency,c.environmentFactor=0,x3dom.isa(b,x3dom.nodeTypes.TwoSidedMaterial)&amp;&amp;(S=!0,c.backDiffuseColor=b._vf.backDiffuseColor.toGL(),c.backSpecularColor=b._vf.backSpecularColor.toGL(),c.backEmissiveColor=b._vf.backEmissiveColor.toGL(),c.backShininess=b._vf.backShininess,c.backAmbientIntensity=b._vf.backAmbientIntensity,c.backTransparency=b._vf.backTransparency)):(c.diffuseColor=[1,1,1],c.specularColor=[0,0,0],c.emissiveColor=[0,0,0],c.shininess=0,c.ambientIntensity=1,c.transparency=0),T)if(w){for(var M in T._vf)if(T._vf.hasOwnProperty(M)&amp;&amp;"language"!==M){var E=T._vf[M];void 0!==E&amp;&amp;null!==E&amp;&amp;(E.toGL?c[M]=E.toGL():c[M]=E)}}else x3dom.isa(T,x3dom.nodeTypes.CommonSurfaceShader)&amp;&amp;(f.csshader=T);for(var F=0;F&lt;s&amp;&amp;m;F++){var C=r.mult(i[F].getCurrentTransform());x3dom.isa(i[F],x3dom.nodeTypes.DirectionalLight)?(c["light"+F+"_Type"]=0,c["light"+F+"_On"]=i[F]._vf.on?1:0,c["light"+F+"_Color"]=i[F]._vf.color.toGL(),c["light"+F+"_Intensity"]=i[F]._vf.intensity,c["light"+F+"_AmbientIntensity"]=i[F]._vf.ambientIntensity,c["light"+F+"_Direction"]=C.multMatrixVec(i[F]._vf.direction).toGL(),c["light"+F+"_Attenuation"]=[1,1,1],c["light"+F+"_Location"]=[1,1,1],c["light"+F+"_Radius"]=0,c["light"+F+"_BeamWidth"]=0,c["light"+F+"_CutOffAngle"]=0,c["light"+F+"_ShadowIntensity"]=i[F]._vf.shadowIntensity):x3dom.isa(i[F],x3dom.nodeTypes.PointLight)?(c["light"+F+"_Type"]=1,c["light"+F+"_On"]=i[F]._vf.on?1:0,c["light"+F+"_Color"]=i[F]._vf.color.toGL(),c["light"+F+"_Intensity"]=i[F]._vf.intensity,c["light"+F+"_AmbientIntensity"]=i[F]._vf.ambientIntensity,c["light"+F+"_Direction"]=[1,1,1],c["light"+F+"_Attenuation"]=i[F]._vf.attenuation.toGL(),c["light"+F+"_Location"]=C.multMatrixPnt(i[F]._vf.location).toGL(),c["light"+F+"_Radius"]=i[F]._vf.radius,c["light"+F+"_BeamWidth"]=0,c["light"+F+"_CutOffAngle"]=0,c["light"+F+"_ShadowIntensity"]=i[F]._vf.shadowIntensity):x3dom.isa(i[F],x3dom.nodeTypes.SpotLight)&amp;&amp;(c["light"+F+"_Type"]=2,c["light"+F+"_On"]=i[F]._vf.on?1:0,c["light"+F+"_Color"]=i[F]._vf.color.toGL(),c["light"+F+"_Intensity"]=i[F]._vf.intensity,c["light"+F+"_AmbientIntensity"]=i[F]._vf.ambientIntensity,c["light"+F+"_Direction"]=C.multMatrixVec(i[F]._vf.direction).toGL(),c["light"+F+"_Attenuation"]=i[F]._vf.attenuation.toGL(),c["light"+F+"_Location"]=C.multMatrixPnt(i[F]._vf.location).toGL(),c["light"+F+"_Radius"]=i[F]._vf.radius,c["light"+F+"_BeamWidth"]=i[F]._vf.beamWidth,c["light"+F+"_CutOffAngle"]=i[F]._vf.cutOffAngle,c["light"+F+"_ShadowIntensity"]=i[F]._vf.shadowIntensity)}if(g.getNavigationInfo()._vf.headlight&amp;&amp;m&amp;&amp;(c["light"+(s=s||0)+"_Type"]=0,c["light"+s+"_On"]=1,c["light"+s+"_Color"]=[1,1,1],c["light"+s+"_Intensity"]=1,c["light"+s+"_AmbientIntensity"]=0,c["light"+s+"_Direction"]=[0,0,-1],c["light"+s+"_Attenuation"]=[1,1,1],c["light"+s+"_Location"]=[1,1,1],c["light"+s+"_Radius"]=0,c["light"+s+"_BeamWidth"]=0,c["light"+s+"_CutOffAngle"]=0,c["light"+s+"_ShadowIntensity"]=0),l._clipPlanes)for(var A=0;A&lt;l._clipPlanes.length;A++){var R=l._clipPlanes[A].plane,I=l._clipPlanes[A].trafo;c["clipPlane"+A+"_Plane"]=I.multMatrixPlane(R._vf.plane).toGL(),c["clipPlane"+A+"_CappingStrength"]=R._vf.cappingStrength,c["clipPlane"+A+"_CappingColor"]=R._vf.cappingColor.toGL()}var N=_?_._cf.depthMode.node:null;N?N._vf.enableDepthTest?(this.stateManager.enable(h.DEPTH_TEST),this.stateManager.depthMask(!N._vf.readOnly),this.stateManager.depthFunc(x3dom.Utils.depthFunc(h,N._vf.depthFunc)),this.stateManager.depthRange(N._vf.zNearRange,N._vf.zFarRange)):this.stateManager.disable(h.DEPTH_TEST):(this.stateManager.enable(h.DEPTH_TEST),this.stateManager.depthMask(!0),this.stateManager.depthFunc(h.LEQUAL));var P=_?_._cf.blendMode.node:null;if(P){var D=x3dom.Utils.blendFunc(h,P._vf.srcFactor),V=x3dom.Utils.blendFunc(h,P._vf.destFactor);D&amp;&amp;V?(this.stateManager.enable(h.BLEND),this.stateManager.blendFuncSeparate(D,V,h.ONE,h.ONE),this.stateManager.blendColor(P._vf.color.r,P._vf.color.g,P._vf.color.b,1-P._vf.colorTransparency),this.stateManager.blendEquation(x3dom.Utils.blendEquation(h,P._vf.equation))):this.stateManager.disable(h.BLEND)}else this.stateManager.enable(h.BLEND),this.stateManager.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE);var L=_?_._cf.colorMaskMode.node:null;L?this.stateManager.colorMask(L._vf.maskR,L._vf.maskG,L._vf.maskB,L._vf.maskA):this.stateManager.colorMask(!0,!0,!0,!0);var O=_?_._cf.lineProperties.node:null;O?this.stateManager.lineWidth(O._vf.linewidthScaleFactor):x3dom.Utils.needLineWidth&amp;&amp;this.stateManager.lineWidth(1),l.isSolid()&amp;&amp;!S?(this.stateManager.enable(h.CULL_FACE),l.isCCW()?this.stateManager.frontFace(h.CCW):this.stateManager.frontFace(h.CW)):this.stateManager.disable(h.CULL_FACE);var k=r.mult(u),B=k.inverse();c.isOrthoView=1==a._33?1:0,c.modelViewMatrix=k.toGL(),c.viewMatrix=r.toGL(),c.normalMatrix=B.transpose().toGL(),c.modelViewMatrixInverse=B.toGL(),c.modelViewProjectionMatrix=o.mult(u).toGL(),(w||l._clipPlanes&amp;&amp;l._clipPlanes.length)&amp;&amp;(c.viewMatrixInverse=r.inverse().toGL()),(w||0!=f.externalGeometry)&amp;&amp;(c.model=u.toGL(),c.projectionMatrix=a.toGL(),c.worldMatrix=u.toGL(),c.worldInverseTranspose=u.inverse().transpose().toGL()),f.popGeometry&amp;&amp;this.updatePopState(e,p,c,f,g,k,t,this.x3dElem.runtime.fps);for(var U=0,z=f.texture.length;U&lt;z;U++)v=f.texture[U],h.activeTexture(h.TEXTURE0+U),h.bindTexture(v.type,v.texture),h.texParameteri(v.type,h.TEXTURE_WRAP_S,v.wrapS),h.texParameteri(v.type,h.TEXTURE_WRAP_T,v.wrapT),h.texParameteri(v.type,h.TEXTURE_MAG_FILTER,v.magFilter),h.texParameteri(v.type,h.TEXTURE_MIN_FILTER,v.minFilter),T&amp;&amp;w||c[v.samplerName]||(c[v.samplerName]=U);if(_&amp;&amp;_._cf.textureTransform.node){var G=_.texTransformMatrix();c.texTrafoMatrix=G.toGL()}var X,j,H,W,q,Y=null,Z=f.dynamicFields.length;for(X=0;X&lt;Z;X++)void 0!==c[(Y=f.dynamicFields[X]).name]&amp;&amp;(h.bindBuffer(h.ARRAY_BUFFER,Y.buf),h.vertexAttribPointer(c[Y.name],Y.numComponents,h.FLOAT,!1,0,0),h.enableVertexAttribArray(c[Y.name]));var Q=!1;x3dom.isa(p,x3dom.nodeTypes.ParticleSet)&amp;&amp;(Q=!0),q=0!=f.externalGeometry?l.meshes.length:f.positions.length;for(var K=0;K&lt;q;K++){var $=6*K;if(0!=f.externalGeometry){var J=l.meshes[K],ee=c;null!=J.material&amp;&amp;(null!=J.material.program&amp;&amp;(ee=J.material.program),null!=J.material.setShader&amp;&amp;J.material.setShader(h,this.cache,l,l.getShaderProperties(t)),J.material.bind(h,c,this.cache,l.getShaderProperties(t))),J.bindVertexAttribPointer(h,ee);var te=null;(de=t.getRenderMode())&gt;0&amp;&amp;(te=1==de?h.POINTS:h.LINES),J.render(h,te)}else if(void 0===c.position||!f.buffers[$+1]||!f.indexes[K])continue;if(d=!1,0==f.externalGeometry){if(void 0===c.position||!f.buffers[$+1]||!f.indexes[K])continue;if(f.buffers[$]){if(Q&amp;&amp;"any"!=p.drawOrder()){for(var ie,se=[],re=p._cf.coord.node.getPoints(),oe=re.length==f.indexes[K].length?f.indexes[K].length:0,ne=0;ne&lt;oe;ne++){var ae=k.multMatrixPnt(re[ne]);se.push([ne,ae.z])}for("backtofront"==p.drawOrder()?se.sort((function(e,t){return e[1]-t[1]})):se.sort((function(e,t){return t[1]-e[1]})),ne=0;ne&lt;oe;ne++)l._webgl.indexes[K][ne]=se[ne][0];x3dom.caps.INDEX_UINT&amp;&amp;oe&gt;65535?(ie=new Uint32Array(l._webgl.indexes[K]),l._webgl.indexType=h.UNSIGNED_INT):(ie=new Uint16Array(l._webgl.indexes[K]),l._webgl.indexType=h.UNSIGNED_SHORT),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.buffers[$]),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ie,h.DYNAMIC_DRAW),ie=null}h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.buffers[$]),d=!0}var he,de;if(this.setVertexAttribPointerPosition(h,l,$,K),this.setVertexAttribPointerNormal(h,l,$,K),this.setVertexAttribPointerTexCoord(h,l,$,K),this.setVertexAttribPointerColor(h,l,$,K),void 0===c.id&amp;&amp;void 0===c.particleSize||!l._webgl.buffers[$+5]||(h.bindBuffer(h.ARRAY_BUFFER,l._webgl.buffers[$+5]),0==f.binaryGeometry&amp;&amp;0==f.externalGeometry||1!=p._vf.idsPerVertex?Q&amp;&amp;(h.vertexAttribPointer(c.particleSize,3,h.FLOAT,!1,0,0),h.enableVertexAttribArray(c.particleSize)):(h.vertexAttribPointer(c.id,1,h.FLOAT,!1,4,0),h.enableVertexAttribArray(c.id))),0!=f.popGeometry&amp;&amp;f.buffers[$+5]&amp;&amp;(h.bindBuffer(h.ARRAY_BUFFER,f.buffers[$+5]),h.vertexAttribPointer(c.PG_vertexID,1,h.FLOAT,!1,4,0),h.enableVertexAttribArray(c.PG_vertexID)),(de=t.getRenderMode())&gt;0){te=1==de?h.POINTS:h.LINES;if(d&amp;&amp;(f.binaryGeometry&gt;0||f.popGeometry&gt;0))for(j=0,W=0,H=p._vf.vertexCount.length;j&lt;H;j++)h.drawElements(te,p._vf.vertexCount[j],f.indexType,x3dom.Utils.getByteAwareOffset(W,f.indexType,h)),W+=p._vf.vertexCount[j];else if(f.binaryGeometry&lt;0||f.popGeometry&lt;0||f.imageGeometry)for(j=0,W=0,H=p._vf.vertexCount.length;j&lt;H;j++)h.drawArrays(te,W,p._vf.vertexCount[j]),W+=p._vf.vertexCount[j];else if(p.hasIndexOffset())for(j=0,H=(he=l.tessellationProperties()).length;j&lt;H;j++)h.drawElements(te,he[j].count,f.indexType,he[j].offset*x3dom.Utils.getOffsetMultiplier(f.indexType,h));else 0==f.indexes[K].length?h.drawArrays(te,0,f.positions[K].length/3):h.drawElements(te,f.indexes[K].length,f.indexType,0)}else if(d&amp;&amp;(f.binaryGeometry&gt;0||f.popGeometry&gt;0))for(j=0,W=0,H=p._vf.vertexCount.length;j&lt;H;j++)h.drawElements(f.primType[j],p._vf.vertexCount[j],f.indexType,x3dom.Utils.getByteAwareOffset(W,f.indexType,h)),W+=p._vf.vertexCount[j];else if(f.binaryGeometry&lt;0||f.popGeometry&lt;0||f.imageGeometry)for(j=0,W=0,H=p._vf.vertexCount.length;j&lt;H;j++)h.drawArrays(f.primType[j],W,p._vf.vertexCount[j]),W+=p._vf.vertexCount[j];else if(p.hasIndexOffset())for(j=0,H=(he=l.tessellationProperties()).length;j&lt;H;j++)h.drawElements(f.primType,he[j].count,f.indexType,he[j].offset*x3dom.Utils.getOffsetMultiplier(f.indexType,h));else 0==f.indexes[K].length?h.drawArrays(f.primType,0,f.positions[K].length/3):h.drawElements(f.primType,f.indexes[K].length,f.indexType,0)}h.disableVertexAttribArray(c.position),void 0!==c.normal&amp;&amp;h.disableVertexAttribArray(c.normal),void 0!==c.texcoord&amp;&amp;h.disableVertexAttribArray(c.texcoord),void 0!==c.color&amp;&amp;h.disableVertexAttribArray(c.color),f.buffers[$+5]&amp;&amp;(void 0!==c.id?h.disableVertexAttribArray(c.id):void 0!==c.particleSize&amp;&amp;h.disableVertexAttribArray(c.particleSize)),0!=f.popGeometry&amp;&amp;void 0!==c.PG_vertexID&amp;&amp;h.disableVertexAttribArray(c.PG_vertexID)}for(X=0;X&lt;Z;X++)void 0!==c[(Y=f.dynamicFields[X]).name]&amp;&amp;h.disableVertexAttribArray(c[Y.name]);if(f.imageGeometry)for(H=p._vf.vertexCount.length,this.numDrawCalls+=H,j=0;j&lt;H;j++)f.primType[j]==h.TRIANGLE_STRIP?this.numFaces+=p._vf.vertexCount[j]-2:this.numFaces+=p._vf.vertexCount[j]/3,this.numCoords+=p._vf.vertexCount[j];else this.numCoords+=x._numCoords,this.numFaces+=x._numFaces,f.binaryGeometry||f.popGeometry?this.numDrawCalls+=p._vf.vertexCount.length:p.hasIndexOffset()?this.numDrawCalls+=l.tessellationProperties().length:this.numDrawCalls+=q;N&amp;&amp;(this.stateManager.enable(h.DEPTH_TEST),this.stateManager.depthMask(!0),this.stateManager.depthFunc(h.LEQUAL),this.stateManager.depthRange(0,1)),P&amp;&amp;(this.stateManager.enable(h.BLEND),this.stateManager.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE),this.stateManager.blendColor(1,1,1,1),this.stateManager.blendEquation(h.FUNC_ADD)),L&amp;&amp;this.stateManager.colorMask(!0,!0,!0,!0),O&amp;&amp;this.stateManager.lineWidth(1);var le=f.texture;for(z=le?le.length:0,U=0;U&lt;z;U++)le[U]&amp;&amp;_&amp;&amp;_._cf.texture.node&amp;&amp;(v=_._cf.texture.node.getTexture(U),h.activeTexture(h.TEXTURE0+U),x3dom.isa(v,x3dom.nodeTypes.X3DEnvironmentTextureNode)?h.bindTexture(h.TEXTURE_CUBE_MAP,null):h.bindTexture(h.TEXTURE_2D,null))}else x3dom.debug.logError("[Context|RenderShape] No Shader is set!")}else x3dom.debug.logError("[Context|RenderShape] No valid Shape!")},e.prototype.updatePopState=function(e,t,i,s,r,o,n,a){var h=x3dom.nodeTypes.PopGeometry.ErrorToleranceFactor*t._vf.precisionFactor;(a&lt;=1||n.isMovingOrAnimating())&amp;&amp;(h*=x3dom.nodeTypes.PopGeometry.PrecisionFactorOnMove);var d=16;if(h&gt;0){var l=r.getViewpoint(),u=l.getImgPlaneHeightAtDistOne(),f=l.getNear(),c=o.multMatrixPnt(t._vf.position),m=.5*o.multMatrixVec(t._vf.size).length(),_=2*(.5*o.multMatrixVec(t._vf.maxBBSize).length())/(h*(Math.max(-c.z-m,f)*(u/n._height)));d=(d=Math.ceil(Math.log(_)/.693147180559945))&lt;1?1:d&gt;16?16:d}var p=t._vf.minPrecisionLevel,x=t._vf.maxPrecisionLevel;d=-1!=p&amp;&amp;d&lt;p?p:d,d=-1!=x&amp;&amp;d&gt;x?x:d;var g=s.levelsAvailable&lt;d?s.levelsAvailable:d;d=g,h&lt;=1&amp;&amp;(d=d==t.getNumLevels()?16:d);var v=t._vf.indexedRendering,y=t._mesh;y._numCoords=0,y._numFaces=0;for(var b=0;b&lt;g;++b){var T=s.numVerticesAtLevel[b];y._numCoords+=T,y._numFaces+=(v?t.getNumIndicesByLevel(b):T)/3}x3dom.nodeTypes.PopGeometry.numRenderedVerts+=y._numCoords,x3dom.nodeTypes.PopGeometry.numRenderedTris+=y._numFaces,y.currentLOD=d,t.adaptVertexCount(v?3*y._numFaces:y._numCoords),i.PG_maxBBSize=t._vf.maxBBSize.toGL(),i.PG_bbMin=t._bbMinBySize,i.PG_numAnchorVertices=t._vf.numAnchorVertices,i.PG_bbMaxModF=t._vf.bbMaxModF.toGL(),i.PG_bboxShiftVec=t._vf.bbShiftVec.toGL(),i.PG_precisionLevel=d,i.PG_powPrecision=x3dom.nodeTypes.PopGeometry.powLUT[d-1]},e.prototype.pickValue=function(e,t,i,s,r,o){x3dom.Utils.startMeasure("picking");var n=e._scene,a=this.ctx3d;if(!a||!n||!n._webgl||!n.drawableCollection)return!1;var h,d,l=n._vf.pickMode.toLowerCase(),u=0;switch(l){case"box":return!1;case"idbuf":u=0;break;case"idbuf24":u=3;break;case"idbufid":u=4;break;case"color":u=1;break;case"texcoord":u=2}arguments.length&gt;4?(h=r,d=o):(h=e._last_mat_view,d=e._last_mat_scene);var f=x3dom.fields.SFVec3f.copy(n._lastMin),c=x3dom.fields.SFVec3f.copy(n._lastMax),m=h.inverse().e3(),_=x3dom.fields.SFVec3f.copy(m),p=x3dom.fields.SFVec3f.copy(m);_.x&gt;f.x&amp;&amp;(_.x=f.x),_.y&gt;f.y&amp;&amp;(_.y=f.y),_.z&gt;f.z&amp;&amp;(_.z=f.z),p.x&lt;c.x&amp;&amp;(p.x=c.x),p.y&lt;c.y&amp;&amp;(p.y=c.y),p.z&lt;c.z&amp;&amp;(p.z=c.z),n._lastMin.setValues(_),n._lastMax.setValues(p);var x=n._lastMax.subtract(n._lastMin).length(),g=e.getCCtoWCMatrix();n._lastMin.setValues(f),n._lastMax.setValues(c);var v=x3dom.nodeTypes.Shape.objectID+2;this.renderPickingPass(a,n,h,d,m,x,u,t,i,2,2);var y=n._webgl.fboPick.pixelData;if(y&amp;&amp;y.length){var b,T,S,w,M,E,F=new x3dom.fields.SFVec3f(0,0,0),C=new x3dom.fields.SFVec3f(0,0,1),A=0,R=y[A+3],I=1/n._webgl.pickScale,N=1/256;0==u?(R+=256*y[A+2],T=y[A]/255*N+y[A+1]/255,F=(S=e.calcViewRay(t,i,g)).pos.add(S.dir.multiply(T*x)),T=y[A=4]/255*N+y[A+1]/255,M=(M=(w=e.calcViewRay(t+I,i,g)).pos.add(w.dir.multiply(T*x))).subtract(F).normalize(),T=y[A=8]/255*N+y[A+1]/255,E=(E=(w=e.calcViewRay(t,i-I,g)).pos.add(w.dir.multiply(T*x))).subtract(F).normalize(),C=M.cross(E).normalize()):3==u?(R+=256*y[A+2]+65536*y[A+1],T=y[A]/255,F=(S=e.calcViewRay(t,i,g)).pos.add(S.dir.multiply(T*x)),T=y[A=4]/255,M=(M=(w=e.calcViewRay(t+I,i,g)).pos.add(w.dir.multiply(T*x))).subtract(F).normalize(),T=y[A=8]/255,E=(E=(w=e.calcViewRay(t,i-I,g)).pos.add(w.dir.multiply(T*x))).subtract(F).normalize(),C=M.cross(E).normalize()):4==u?(R+=256*y[A+2],b=y[A+1],b+=256*y[A],0==R&amp;&amp;b&gt;0&amp;&amp;b&lt;v&amp;&amp;(R=b)):(F.x=y[A],F.y=y[A+1],F.z=y[A+2]);var P,D,V="shadowObjectIdChanged",L=Math.max(s&gt;&gt;&gt;8,255&amp;s);if(R&gt;=v){var O,k,B;if(R-=v,4!=u?(e._pickingInfo.pickPos=F,e._pick.setValues(F),e._pickingInfo.pickNorm=C,e._pickNorm.setValues(C),e._pickingInfo.pickObj=null,e._pickingInfo.lastClickObj=null,O=n._xmlNode):(e._pickingInfo.pickObj=x3dom.nodeTypes.Shape.idMap.nodeID[b],O=e._pickingInfo.pickObj._xmlNode),n._multiPartMap)for(k=0;k&lt;n._multiPartMap.multiParts.length;k++)R&gt;=(B=n._multiPartMap.multiParts[k])._minId&amp;&amp;R&lt;=B._maxId?(O=B._xmlNode,D={target:B._xmlNode,button:L,mouseup:s&gt;&gt;&gt;8&gt;0,layerX:t,layerY:i,pickedId:R,worldX:F.x,worldY:F.y,worldZ:F.z,normalX:C.x,normalY:C.y,normalZ:C.z,hitPnt:F.toGL(),hitObject:O,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}},B.handleEvents(D)):(D={target:B._xmlNode,button:L,mouseup:s&gt;&gt;&gt;8&gt;0,layerX:t,layerY:i,pickedId:-1,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}},B.handleEvents(D));if(P=e._pickingInfo.shadowObjectId!=R,e._pickingInfo.lastShadowObjectId=e._pickingInfo.shadowObjectId,e._pickingInfo.shadowObjectId=R,(P||L)&amp;&amp;n._xmlNode&amp;&amp;(n._xmlNode["on"+V]||n._xmlNode.hasAttribute("on"+V)||n._listeners[V])&amp;&amp;(D={target:n._xmlNode,type:V,button:L,mouseup:s&gt;&gt;&gt;8&gt;0,layerX:t,layerY:i,shadowObjectId:R,worldX:F.x,worldY:F.y,worldZ:F.z,normalX:C.x,normalY:C.y,normalZ:C.z,hitPnt:F.toGL(),hitObject:O,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}},n.callEvtHandler("on"+V,D)),n._shadowIdMap&amp;&amp;n._shadowIdMap.mapping&amp;&amp;R&lt;n._shadowIdMap.mapping.length){var U,z,G,X=n._shadowIdMap.mapping[R].usage;for(S||(S=e.calcViewRay(t,i,g)),z=0;z&lt;X.length;z++)if((G=n._nameSpace.defMap[X[z]])&amp;&amp;G.doIntersect(S)){e._pickingInfo.pickObj=G;break}for(U=0;U&lt;n._nameSpace.childSpaces.length;U++)for(z=0;z&lt;X.length;z++)if((G=n._nameSpace.childSpaces[U].defMap[X[z]])&amp;&amp;G.doIntersect(S)){e._pickingInfo.pickObj=G;break}}}else{if(n._multiPartMap)for(k=0;k&lt;n._multiPartMap.multiParts.length;k++)D={target:(B=n._multiPartMap.multiParts[k])._xmlNode,button:L,mouseup:s&gt;&gt;&gt;8&gt;0,layerX:t,layerY:i,pickedId:-1,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}},B.handleEvents(D);P=-1!=e._pickingInfo.shadowObjectId,e._pickingInfo.shadowObjectId=-1,P&amp;&amp;n._xmlNode&amp;&amp;(n._xmlNode["on"+V]||n._xmlNode.hasAttribute("on"+V)||n._listeners[V])&amp;&amp;(D={target:n._xmlNode,type:V,button:L,mouseup:s&gt;&gt;&gt;8&gt;0,layerX:t,layerY:i,shadowObjectId:e._pickingInfo.shadowObjectId,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}},n.callEvtHandler("on"+V,D)),R&gt;0?(e._pickingInfo.pickPos=F,e._pickingInfo.pickNorm=C,e._pickingInfo.pickObj=x3dom.nodeTypes.Shape.idMap.nodeID[R]):(e._pickingInfo.pickObj=null,e._pickingInfo.lastClickObj=null)}}var j=x3dom.Utils.stopMeasure("picking");return this.x3dElem.runtime.addMeasurement("PICKING",j),!0},e.prototype.pickRect=function(e,t,i,s,r){var o=this.ctx3d,n=e?e._scene:null;if(!o||!n||!n._webgl||!n.drawableCollection)return!1;var a,h=e._last_mat_view.inverse().e3(),d=n._lastMax.subtract(n._lastMin).length(),l=t&lt;=s?t:s,u=i&gt;=r?i:r,f=(1+Math.abs(s-t))*n._webgl.pickScale,c=(1+Math.abs(r-i))*n._webgl.pickScale;this.renderPickingPass(o,n,e._last_mat_view,e._last_mat_scene,h,d,0,l,u,f&lt;1?1:f,c&lt;1?1:c);var m=[];for(a=0;n._webgl.fboPick.pixelData&amp;&amp;a&lt;n._webgl.fboPick.pixelData.length;a+=4){var _=n._webgl.fboPick.pixelData[a+3]+256*n._webgl.fboPick.pixelData[a+2];_&gt;0&amp;&amp;m.push(_)}m.sort(),m=function(e){for(var t=[],i=e.length,s=0;s&lt;i;s++){for(var r=s+1;r&lt;i;r++)e[s]===e[r]&amp;&amp;(r=++s);t.push(e[s])}return t}(m);var p,x,g=[],v=x3dom.nodeTypes.Shape.objectID+2;for(a=0;a&lt;m.length;a++){var y,b,T,S,w,M;if((_=m[a])&gt;=v){if(_-=v,n._multiPartMap)for(y=0;y&lt;n._multiPartMap.multiParts.length;y++)T=(b=n._multiPartMap.multiParts[y])._inlineNamespace.defMap.MultiMaterial_ColorMap,S=b._inlineNamespace.defMap.MultiMaterial_EmissiveMap,w=b._inlineNamespace.defMap.MultiMaterial_SpecularMap,M=b._inlineNamespace.defMap.MultiMaterial_VisibilityMap,_&gt;=b._minId&amp;&amp;_&lt;=b._maxId&amp;&amp;(p={partID:b._idMap.mapping[_-b._minId].name,part:x=new x3dom.Parts(b,[_],T,S,w,M)},g.push(p))}else(x=(x=x3dom.nodeTypes.Shape.idMap.nodeID[_])&amp;&amp;x._xmlNode?x._xmlNode:null)&amp;&amp;g.push(x)}return g},e.prototype.renderScene=function(e){var t=this.ctx3d,i=e._scene;if(null!==t&amp;&amp;null!==i){var s,r,o,n,a,h,d,l,u,f,c,m=e._doc._nodeBag.renderTextures,_=m.length,p=null,x=t.UNSIGNED_BYTE,g=t.UNSIGNED_BYTE;x3dom.caps.FP_TEXTURES&amp;&amp;!x3dom.caps.MOBILE&amp;&amp;(x=t.FLOAT,g=t.FLOAT,x3dom.caps.FPL_TEXTURES||!0);var v=[-1,-1,1,-1,-1,1,-1,1,1,-1,1,1];if(i.updateVolume(),i._webgl){var y=Math.round(this.canvas.width*i._webgl.pickScale),b=Math.round(this.canvas.height*i._webgl.pickScale);for(i._webgl._currFboWidth===y&amp;&amp;i._webgl._currFboHeight===b||(i._webgl._currFboWidth=y,i._webgl._currFboHeight=b,i._webgl.fboPick=x3dom.Utils.initFBO(t,y,b,i._webgl.fboPick.type,!1,!0),i._webgl.fboPick.pixelData=null,x3dom.debug.logInfo("Refreshed picking FBO to size ("+y+", "+b+")")),r=0;r&lt;_;r++)(s=m[r])._webgl&amp;&amp;s._webgl.fbo&amp;&amp;s._webgl.fbo.width==s._vf.dimensions[0]&amp;&amp;s._webgl.fbo.height==s._vf.dimensions[1]||(s.invalidateGLObject(),s._cleanupGLObjects?s._cleanupGLObjects():s._cleanupGLObjects=function(e){e||t.deleteTexture(this._webgl.fbo.tex),this._webgl.fbo.dtex&amp;&amp;t.deleteTexture(this._webgl.fbo.dtex),this._webgl.fbo.rbo&amp;&amp;t.deleteRenderbuffer(this._webgl.fbo.rbo),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(this._webgl.fbo.fbo),this._webgl.fbo.rbo=null,this._webgl.fbo.fbo=null},p=s._cf.textureProperties.node,f=s.requirePingPong()?t.UNSIGNED_BYTE:x,s._webgl={},s._webgl.fbo=x3dom.Utils.initFBO(t,s._vf.dimensions[0],s._vf.dimensions[1],f,p&amp;&amp;p._vf.generateMipMaps,s._vf.depthMap||!s.requirePingPong()),s.requirePingPong()&amp;&amp;(c=s._vf.dimensions[0]+"x"+s._vf.dimensions[1],void 0===i._webgl.refinement[c]&amp;&amp;(i._webgl.refinement[c]=x3dom.Utils.initFBO(t,s._vf.dimensions[0],s._vf.dimensions[1],f,!1,!1)),s._webgl.texture=null),x3dom.debug.logInfo("Init/resize RenderedTexture_"+r+" to size "+s._vf.dimensions[0]+" x "+s._vf.dimensions[1]));for(d=(o=e.getShadowedLights()).length,a=0;a&lt;d;a++)if(l=o[a]._vf.shadowMapSize,n=x3dom.isa(o[a],x3dom.nodeTypes.PointLight)?6:Math.max(1,Math.min(o[a]._vf.shadowCascades,6)),"undefined"===typeof i._webgl.fboShadow[a]||i._webgl.fboShadow[a].length!=n||i._webgl.fboShadow[a][0].height!=l)for(i._webgl.fboShadow[a]=[],h=0;h&lt;n;h++)i._webgl.fboShadow[a][h]=x3dom.Utils.initFBO(t,l,l,g,!1,!0);for(a=0;a&lt;d;a++){for(l=i._webgl.fboShadow[a][0].height,u=!1,h=0;h&lt;i._webgl.fboBlur.length;h++)l==i._webgl.fboBlur[h].height&amp;&amp;(u=!0);u||(i._webgl.fboBlur[i._webgl.fboBlur.length]=x3dom.Utils.initFBO(t,l,l,g,!1,!0))}((x3dom.SSAO.isEnabled(i)||i._webgl.fboShadow.length&gt;0)&amp;&amp;"undefined"==typeof i._webgl.fboScene||i._webgl.fboScene&amp;&amp;(this.canvas.width!=i._webgl.fboScene.width||this.canvas.height!=i._webgl.fboScene.height))&amp;&amp;(i._webgl.fboScene=x3dom.Utils.initFBO(t,this.canvas.width,this.canvas.height,g,!1,!0))}else{for(i._webgl={},this.setupFgnds(t,i),i._webgl.pickScale=.5,i._webgl._currFboWidth=Math.round(this.canvas.width*i._webgl.pickScale),i._webgl._currFboHeight=Math.round(this.canvas.height*i._webgl.pickScale),i._webgl.fboPick=x3dom.Utils.initFBO(t,i._webgl._currFboWidth,i._webgl._currFboHeight,t.UNSIGNED_BYTE,!1,!0),i._webgl.fboPick.pixelData=null,i._webgl.normalShader=this.cache.getShader(t,x3dom.shader.NORMAL),i._webgl.fboShadow=[],d=(o=e.getShadowedLights()).length,a=0;a&lt;d;a++)for(l=o[a]._vf.shadowMapSize,n=x3dom.isa(o[a],x3dom.nodeTypes.PointLight)?6:Math.max(1,Math.min(o[a]._vf.shadowCascades,6)),i._webgl.fboShadow[a]=[],h=0;h&lt;n;h++)i._webgl.fboShadow[a][h]=x3dom.Utils.initFBO(t,l,l,g,!1,!0);for((i._webgl.fboShadow.length&gt;0||x3dom.SSAO.isEnabled(i))&amp;&amp;(i._webgl.fboScene=x3dom.Utils.initFBO(t,this.canvas.width,this.canvas.height,g,!1,!0)),i._webgl.fboBlur=[],a=0;a&lt;d;a++){for(l=i._webgl.fboShadow[a][0].height,u=!1,h=0;h&lt;i._webgl.fboBlur.length;h++)l==i._webgl.fboBlur[h].height&amp;&amp;(u=!0);u||(i._webgl.fboBlur[i._webgl.fboBlur.length]=x3dom.Utils.initFBO(t,l,l,g,!1,!0))}for(i._webgl.ppBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,i._webgl.ppBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(v),t.STATIC_DRAW),i._webgl.refinement={stamps:new Array(2),positionBuffer:t.createBuffer()},t.bindBuffer(t.ARRAY_BUFFER,i._webgl.refinement.positionBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(v),t.STATIC_DRAW),r=0;r&lt;_;r++)p=(s=m[r])._cf.textureProperties.node,f=s.requirePingPong()?t.UNSIGNED_BYTE:x,s._webgl={},s._webgl.fbo=x3dom.Utils.initFBO(t,s._vf.dimensions[0],s._vf.dimensions[1],f,p&amp;&amp;p._vf.generateMipMaps,s._vf.depthMap||!s.requirePingPong()),s._cleanupGLObjects=function(e){e||t.deleteTexture(this._webgl.fbo.tex),this._webgl.fbo.dtex&amp;&amp;t.deleteTexture(this._webgl.fbo.dtex),this._webgl.fbo.rbo&amp;&amp;t.deleteFramebuffer(this._webgl.fbo.rbo),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(this._webgl.fbo.fbo),this._webgl.fbo.rbo=null,this._webgl.fbo.fbo=null},s.requirePingPong()&amp;&amp;(c=s._vf.dimensions[0]+"x"+s._vf.dimensions[1],void 0===i._webgl.refinement[c]&amp;&amp;(i._webgl.refinement[c]=x3dom.Utils.initFBO(t,s._vf.dimensions[0],s._vf.dimensions[1],f,!1,!1)),s._webgl.texture=null);e._last_mat_view=x3dom.fields.SFMatrix4f.identity(),e._last_mat_proj=x3dom.fields.SFMatrix4f.identity(),e._last_mat_scene=x3dom.fields.SFMatrix4f.identity(),this._calledViewpointChangedHandler=!1}var T=i.getEnvironment();T.checkSanity();var S=i.getBackground();this.setupScene(t,S),this.numFaces=0,this.numCoords=0,this.numDrawCalls=0;var w=e.getProjectionMatrix(),M=e.getViewMatrix();if(!this._calledViewpointChangedHandler||!e._last_mat_view.equals(M)){var E=i.getViewpoint(),F="viewpointChanged";try{if(E._xmlNode&amp;&amp;(E._xmlNode["on"+F]||E._xmlNode.hasAttribute("on"+F)||E._listeners[F])){var C=E.getCurrentTransform(),A=(C=C.inverse().mult(M)).inverse(),R=new x3dom.fields.Quaternion(0,0,1,0);R.setValue(A);var I=A.e3(),N={target:E._xmlNode,type:F,matrix:C,position:I,orientation:R.toAxisAngle(),cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0},preventDefault:function(){this.cancelBubble=!0}};E.callEvtHandler("on"+F,N),this._calledViewpointChangedHandler=!0}}catch(ee){x3dom.debug.logException(ee)}}e._last_mat_view=M,e._last_mat_proj=w;var P=w.mult(M);if(e._last_mat_scene=P,i.drawableCollection=null,!i.drawableCollection){var D={viewArea:e,sortTrans:T._vf.sortTrans,viewMatrix:M,projMatrix:w,sceneMatrix:P,frustumCulling:!0,smallFeatureThreshold:T._smallFeatureThreshold,context:this,gl:t};i.drawableCollection=new x3dom.DrawableCollection(D),x3dom.Utils.startMeasure("traverse"),i.collectDrawableObjects(x3dom.fields.SFMatrix4f.identity(),i.drawableCollection,!0,!1,0,[]);var V=x3dom.Utils.stopMeasure("traverse");this.x3dElem.runtime.addMeasurement("TRAVERSE",V)}x3dom.Utils.startMeasure("sorting"),i.drawableCollection.sort();var L=x3dom.Utils.stopMeasure("sorting");this.x3dElem.runtime.addMeasurement("SORT",L);var O,k=e.getLights(),B=k.length,U=[],z=[],G=0;x3dom.Utils.startMeasure("shadow");for(var X=0;X&lt;B;X++)if(k[X]._vf.shadowIntensity&gt;0){var j=e.getLightMatrix()[X];$=i._webgl.fboShadow[G];var H=Math.max(0,Math.min(1,k[X]._vf.shadowOffset));if(x3dom.isa(k[X],x3dom.nodeTypes.PointLight))for(O=e.getWCtoLCMatricesPointLight(j,k[X],w),a=0;a&lt;6;a++)this.renderShadowPass(t,e,O[a],M,$[a],H,!1);else{var W=Math.max(1,Math.min(k[X]._vf.shadowCascades,6));for(O=e.getWCtoLCMatricesCascaded(j,k[X],w),a=0;a&lt;W;a++)this.renderShadowPass(t,e,O[a],M,$[a],H,!1)}G++,U[U.length]=O,z[z.length]=j}if(G&gt;0||x3dom.SSAO.isEnabled(i)){this.renderShadowPass(t,e,P,M,i._webgl.fboScene,0,!0);var q=x3dom.Utils.stopMeasure("shadow");this.x3dElem.runtime.addMeasurement("SHADOW",q)}else this.x3dElem.runtime.removeMeasurement("SHADOW");for(O=e.getWCtoLCMatrix(e.getLightMatrix()[0]),r=0;r&lt;_;r++)this.renderRTPass(t,e,m[r]);for(x3dom.Utils.startMeasure("render"),this.stateManager.viewport(0,0,this.canvas.width,this.canvas.height),S._webgl.render(t,M,w),x3dom.nodeTypes.PopGeometry.numRenderedVerts=0,x3dom.nodeTypes.PopGeometry.numRenderedTris=0,d=i.drawableCollection.length,T._vf.smallFeatureCulling&amp;&amp;T._lowPriorityThreshold&lt;1&amp;&amp;e.isMovingOrAnimating()&amp;&amp;!(d=Math.floor(d*T._lowPriorityThreshold))&amp;&amp;i.drawableCollection.length&amp;&amp;(d=1),this.stateManager.unsetProgram(),a=0;a&lt;d;a++){var Y=i.drawableCollection.get(a);this.renderShape(Y,e,k,B,M,P,O,w,t)}if(G&gt;0&amp;&amp;this.renderShadows(t,e,o,U,z,M,w,P),this.stateManager.disable(t.BLEND),this.stateManager.disable(t.DEPTH_TEST),e._numRenderedNodes=d,x3dom.SSAO.isEnabled(i)&amp;&amp;x3dom.SSAO.renderSSAO(this.stateManager,t,i,this.canvas),void 0!==e._visDbgBuf&amp;&amp;e._visDbgBuf){var Z=i._vf.pickMode.toLowerCase();0!=Z.indexOf("idbuf")&amp;&amp;"color"!=Z&amp;&amp;"texcoord"!=Z||(this.stateManager.viewport(0,3*this.canvas.height/4,this.canvas.width/4,this.canvas.height/4),i._fgnd._webgl.render(t,i._webgl.fboPick.tex)),(G&gt;0||x3dom.SSAO.isEnabled(i))&amp;&amp;(this.stateManager.viewport(this.canvas.width/4,3*this.canvas.height/4,this.canvas.width/4,this.canvas.height/4),i._fgnd._webgl.render(t,i._webgl.fboScene.tex));var Q=3,K=2;for(a=0;a&lt;G;a++){var $=i._webgl.fboShadow[a];for(h=0;h&lt;$.length;h++)this.stateManager.viewport(K*this.canvas.width/4,Q*this.canvas.height/4,this.canvas.width/4,this.canvas.height/4),i._fgnd._webgl.render(t,$[h].tex),K&lt;2?K++:(K=0,Q--)}for(r=0;r&lt;_;r++)(s=m[r])._webgl.fbo.fbo&amp;&amp;(this.stateManager.viewport(r*this.canvas.width/8,5*this.canvas.height/8,this.canvas.width/8,this.canvas.height/8),i._fgnd._webgl.render(t,s._webgl.fbo.tex))}t.finish();var J=x3dom.Utils.stopMeasure("render");this.x3dElem.runtime.addMeasurement("RENDER",J),this.x3dElem.runtime.addMeasurement("DRAW",d?J/d:0),this.x3dElem.runtime.addInfo("#NODES:",i.drawableCollection.numberOfNodes),this.x3dElem.runtime.addInfo("#SHAPES:",e._numRenderedNodes),this.x3dElem.runtime.addInfo("#DRAWS:",this.numDrawCalls),this.x3dElem.runtime.addInfo("#POINTS:",this.numCoords),this.x3dElem.runtime.addInfo("#TRIS:",this.numFaces)}},e.prototype.renderPingPongPass=function(e,t,i){var s=t._scene,r=i._vf.dimensions[0]+"x"+i._vf.dimensions[1],o=s._webgl.refinement[r];if(0!=i._currLoadLevel||s._webgl.refinement.stamps[0]&amp;&amp;s._webgl.refinement.stamps[1]||(s._webgl.refinement.stamps[0]=this.cache.getTexture2D(e,i._nameSpace.doc,i._nameSpace.getURL(i._vf.stamp0),!1,!1,!1,!1),s._webgl.refinement.stamps[1]=this.cache.getTexture2D(e,i._nameSpace.doc,i._nameSpace.getURL(i._vf.stamp1),!1,!1,!1,!1)),i._currLoadLevel&lt;i._loadLevel){i._currLoadLevel++,i._webgl.texture&amp;&amp;e.deleteTexture(i._webgl.texture);var n=i._vf.url[0]+"/"+i._currLoadLevel+"."+i._vf.format;i._webgl.texture=x3dom.Utils.createTexture2D(e,i._nameSpace.doc,i._nameSpace.getURL(n),!1,!1,!1,!1),i._vf.iterations%2===0?i._currLoadLevel%2!==0?i._repeat.x*=2:i._repeat.y*=2:i._currLoadLevel%2===0?i._repeat.x*=2:i._repeat.y*=2}if(i._webgl.texture.ready&amp;&amp;s._webgl.refinement.stamps[0].ready&amp;&amp;s._webgl.refinement.stamps[1].ready){this.stateManager.bindFramebuffer(e.FRAMEBUFFER,o.fbo),this.stateManager.viewport(0,0,o.width,o.height),this.stateManager.disable(e.BLEND),this.stateManager.disable(e.CULL_FACE),this.stateManager.disable(e.DEPTH_TEST),e.clearColor(0,0,0,1),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);var a=this.cache.getShader(e,x3dom.shader.TEXTURE_REFINEMENT);this.stateManager.useProgram(a),e.bindBuffer(e.ARRAY_BUFFER,s._webgl.refinement.positionBuffer),e.vertexAttribPointer(a.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(a.position),a.stamp=0,e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,s._webgl.refinement.stamps[(i._currLoadLevel+1)%2]),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),i._currLoadLevel&gt;1&amp;&amp;(a.lastTex=1,e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,i._webgl.fbo.tex),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)),a.curTex=2,e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,i._webgl.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),a.mode=i._currLoadLevel-1,a.repeat=i._repeat.toGL(),e.drawArrays(e.TRIANGLES,0,6),this.stateManager.bindFramebuffer(e.FRAMEBUFFER,i._webgl.fbo.fbo),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),a.mode=0,a.curTex=2,e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,o.tex),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.drawArrays(e.TRIANGLES,0,6),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.disableVertexAttribArray(a.position),this.stateManager.bindFramebuffer(e.FRAMEBUFFER,null),this.stateManager.viewport(0,0,this.canvas.width,this.canvas.height),i._vf.autoRefinement&amp;&amp;i.nextLevel(),i._currLoadLevel==i._vf.maxLevel&amp;&amp;i._currLoadLevel++,i._webgl.fbo.mipMap&amp;&amp;(e.bindTexture(e.TEXTURE_2D,i._webgl.fbo.tex),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)),i.requirePingPong()||(e.deleteTexture(i._webgl.texture),delete i._webgl.texture,i._cleanupGLObjects(!0)),i._renderedImage++}},e.prototype.renderRTPass=function(e,t,i){if(x3dom.isa(i,x3dom.nodeTypes.RefinementTexture))i.requirePingPong()&amp;&amp;this.renderPingPongPass(e,t,i);else{switch(i._vf.update.toUpperCase()){case"NONE":return;case"NEXT_FRAME_ONLY":if(!i._needRenderUpdate)return;i._needRenderUpdate=!1}var s,r,o=t._scene,n=null,a=i.getViewMatrix(),h=i.getProjectionMatrix(),d=h.mult(a),l=t.getLightMatrix()[0],u=t.getWCtoLCMatrix(l),f=i._cf.excludeNodes.nodes.length,c=new Array(f);for(s=0;s&lt;f;s++){var m=i._cf.excludeNodes.nodes[s]._vf.render;c[s]=void 0===m?-1:!0===m?1:0,i._cf.excludeNodes.nodes[s]._vf.render=!1}this.stateManager.bindFramebuffer(e.FRAMEBUFFER,i._webgl.fbo.fbo),this.stateManager.viewport(0,0,i._webgl.fbo.width,i._webgl.fbo.height),null===i._cf.background.node?(e.clearColor(0,0,0,1),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)):i._cf.background.node===o.getBackground()?(n=o.getBackground())._webgl.render(e,a,h):(n=i._cf.background.node,this.setupScene(e,n),n._webgl.render(e,a,h)),this.stateManager.depthFunc(e.LEQUAL),this.stateManager.enable(e.DEPTH_TEST),this.stateManager.enable(e.CULL_FACE),this.stateManager.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE),this.stateManager.enable(e.BLEND);var _,p=t.getLights(),x=p.length,g=i._cf.scene.node;if(g&amp;&amp;g!==o){var v={viewArea:t,sortTrans:o.getEnvironment()._vf.sortTrans,viewMatrix:a,projMatrix:h,sceneMatrix:d,frustumCulling:!1,smallFeatureThreshold:1,context:this,gl:e};if(g.numberOfNodes=0,g.drawableCollection=new x3dom.DrawableCollection(v),g.collectDrawableObjects(x3dom.fields.SFMatrix4f.identity(),g.drawableCollection,!0,!1,0,[]),g.drawableCollection.sort(),r=g.drawableCollection.length,i._vf.showNormals)this.renderNormals(e,g,o._webgl.normalShader,a,d);else for(this.stateManager.unsetProgram(),s=0;s&lt;r;s++)(_=g.drawableCollection.get(s)).shape._vf.render&amp;&amp;this.renderShape(_,t,p,x,a,d,u,h,e)}else if(r=o.drawableCollection.length,i._vf.showNormals)this.renderNormals(e,o,o._webgl.normalShader,a,d);else for(this.stateManager.unsetProgram(),s=0;s&lt;r;s++)_=o.drawableCollection.get(s),this.renderShape(_,t,p,x,a,d,u,h,e);for(this.stateManager.disable(e.BLEND),this.stateManager.disable(e.DEPTH_TEST),e.flush(),this.stateManager.bindFramebuffer(e.FRAMEBUFFER,null),i._webgl.fbo.mipMap&amp;&amp;(e.bindTexture(e.TEXTURE_2D,i._webgl.fbo.tex),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)),s=0;s&lt;f;s++)0!==c[s]&amp;&amp;(i._cf.excludeNodes.nodes[s]._vf.render=!0)}},e.prototype.renderNormals=function(e,t,i,s,r){if(i&amp;&amp;t){this.stateManager.depthFunc(e.LEQUAL),this.stateManager.enable(e.DEPTH_TEST),this.stateManager.enable(e.CULL_FACE),this.stateManager.disable(e.BLEND),this.stateManager.useProgram(i);for(var o=x3dom.fields.SFVec3f.NullVector.toGL(),n=x3dom.fields.SFVec3f.OneVector.toGL(),a=0,h=t.drawableCollection.length;a&lt;h;a++){var d=t.drawableCollection.get(a),l=d.transform,u=d.shape,f=u._webgl;if(f&amp;&amp;u&amp;&amp;u._vf.render){var c=u._cf.geometry.node,m=c._mesh,_=s.mult(l).inverse();i.normalMatrix=_.transpose().toGL(),i.modelViewProjectionMatrix=r.mult(l).toGL(),i.imageGeometry=f.imageGeometry,f.coordType!=e.FLOAT?(0!=f.popGeometry||4==m._numPosComponents&amp;&amp;x3dom.Utils.isUnsignedType(c._vf.coordType)?i.bgCenter=c.getMin().toGL():i.bgCenter=c._vf.position.toGL(),i.bgSize=c._vf.size.toGL(),i.bgPrecisionMax=c.getPrecisionMax("coordType")):(i.bgCenter=o,i.bgSize=n,i.bgPrecisionMax=1),f.normalType!=e.FLOAT?i.bgPrecisionNorMax=c.getPrecisionMax("normalType"):i.bgPrecisionNorMax=1,u.isSolid()?(this.stateManager.enable(e.CULL_FACE),u.isCCW()?this.stateManager.frontFace(e.CCW):this.stateManager.frontFace(e.CW)):this.stateManager.disable(e.CULL_FACE);for(var p=0,x=f.positions.length;p&lt;x;p++){var g,v,y,b=6*p;if(0!=f.externalGeometry){var T=u.meshes[p];T.bindVertexAttribPointer(e,i),T.render(e)}else if(void 0===i.position||!f.buffers[b+1]||!f.indexes[p])continue;if(f.buffers[b]&amp;&amp;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.buffers[b]),this.setVertexAttribPointerPosition(e,u,b,p),this.setVertexAttribPointerNormal(e,u,b,p),f.binaryGeometry&gt;0||f.popGeometry&gt;0)for(g=0,y=0,v=c._vf.vertexCount.length;g&lt;v;g++)e.drawElements(f.primType[g],c._vf.vertexCount[g],f.indexType,x3dom.Utils.getByteAwareOffset(y,f.indexType,e)),y+=c._vf.vertexCount[g];else if(f.binaryGeometry&lt;0||f.popGeometry&lt;0||f.imageGeometry)for(g=0,y=0,v=c._vf.vertexCount.length;g&lt;v;g++)e.drawArrays(f.primType[g],y,c._vf.vertexCount[g]),y+=c._vf.vertexCount[g];else if(c.hasIndexOffset()){var S=u.tessellationProperties();for(g=0,v=S.length;g&lt;v;g++)e.drawElements(f.primType,S[g].count,f.indexType,S[g].offset*x3dom.Utils.getOffsetMultiplier(f.indexType,e))}else 0==f.indexes[p].length?e.drawArrays(f.primType,0,f.positions[p].length/3):e.drawElements(f.primType,f.indexes[p].length,f.indexType,0);e.disableVertexAttribArray(i.position),void 0!==i.normal&amp;&amp;e.disableVertexAttribArray(i.normal)}}}}},e.prototype.shutdown=function(e){var t=this.ctx3d,i=e._scene;if(null!=t&amp;&amp;i){var s=i.getBackground();void 0!==s._webgl.position&amp;&amp;(t.deleteBuffer(s._webgl.buffers[1]),t.deleteBuffer(s._webgl.buffers[0]));var r=i._fgnd;void 0!==r._webgl.position&amp;&amp;(t.deleteBuffer(r._webgl.buffers[1]),t.deleteBuffer(r._webgl.buffers[0]));for(var o=i.drawableCollection?i.drawableCollection.length:0,n=0;n&lt;o;n++){var a=i.drawableCollection.get(n).shape;a._cleanupGLObjects&amp;&amp;a._cleanupGLObjects(!0)}this.cache.Release(t)}},e.prototype.renderShadows=function(e,t,i,s,r,o,n,a){var h=t._scene,d=x3dom.caps.MAX_TEXTURE_IMAGE_UNITS;if(!(d&lt;7)){var l,u,f,c,m,_=1,p=[0];for(f=0;f&lt;i.length;f++){var x=i[f]._vf.shadowFilterSize;for(u=(l=h._webgl.fboShadow[f]).length,c=0;c&lt;u;c++)this.blurTex(e,h,l[c],x);(_+=6)&gt;d&amp;&amp;(p[p.length]=f,_=7)}p[p.length]=i.length;var g=p.length-1,v=n.inverse(),y=a.inverse();this.stateManager.enable(e.BLEND),this.stateManager.blendFunc(e.DST_COLOR,e.ZERO);for(var b=0;b&lt;g;b++){var T=p[b],S=p[b+1],w=[];for(m=T;m&lt;S;m++)w[w.length]=i[m];var M,E,F=this.cache.getShadowRenderingShader(e,w);this.stateManager.useProgram(F),e.bindBuffer(e.ARRAY_BUFFER,h._webgl.ppBuffer),e.vertexAttribPointer(F.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(F.position),F.sceneMap=0,e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,h._webgl.fboScene.tex),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),F.inverseProj=v.toGL(),F.inverseViewProj=y.toGL();for(var C=0,A=0,R=w.length;A&lt;R;A++){for(E=r[A+T],M=s[A+T],l=h._webgl.fboShadow[A+T],u=M.length,f=0;f&lt;u;f++)e.activeTexture(e.TEXTURE1+C),e.bindTexture(e.TEXTURE_2D,l[f].tex),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),F["light"+A+"_"+f+"_ShadowMap"]=C+1,F["light"+A+"_"+f+"_Matrix"]=M[f].toGL(),C++;if(F["light"+A+"_ViewMatrix"]=E.toGL(),!x3dom.isa(w[A],x3dom.nodeTypes.PointLight))for(c=0;c&lt;u;c++){var I=Math.max(1,Math.min(w[A]._vf.shadowCascades,6)),N=Math.max(0,Math.min(w[A]._vf.shadowSplitFactor,1)),P=Math.max(0,Math.min(w[A]._vf.shadowSplitOffset,1)),D=t.getShadowSplitDepths(I,N,P,!1,n);F["light"+A+"_"+c+"_Split"]=D[c+1]}var V=o.mult(w[A].getCurrentTransform());x3dom.isa(w[A],x3dom.nodeTypes.DirectionalLight)?(F["light"+A+"_Type"]=0,F["light"+A+"_On"]=w[A]._vf.on?1:0,F["light"+A+"_Direction"]=V.multMatrixVec(w[A]._vf.direction).toGL(),F["light"+A+"_Attenuation"]=[1,1,1],F["light"+A+"_Location"]=[1,1,1],F["light"+A+"_Radius"]=0,F["light"+A+"_BeamWidth"]=0,F["light"+A+"_CutOffAngle"]=0,F["light"+A+"_ShadowIntensity"]=w[A]._vf.shadowIntensity,F["light"+A+"_ShadowCascades"]=w[A]._vf.shadowCascades,F["light"+A+"_ShadowOffset"]=Math.max(0,Math.min(1,w[A]._vf.shadowOffset))):x3dom.isa(w[A],x3dom.nodeTypes.PointLight)?(F["light"+A+"_Type"]=1,F["light"+A+"_On"]=w[A]._vf.on?1:0,F["light"+A+"_Direction"]=[1,1,1],F["light"+A+"_Attenuation"]=w[A]._vf.attenuation.toGL(),F["light"+A+"_Location"]=V.multMatrixPnt(w[A]._vf.location).toGL(),F["light"+A+"_Radius"]=w[A]._vf.radius,F["light"+A+"_BeamWidth"]=0,F["light"+A+"_CutOffAngle"]=0,F["light"+A+"_ShadowIntensity"]=w[A]._vf.shadowIntensity,F["light"+A+"_ShadowOffset"]=Math.max(0,Math.min(1,w[A]._vf.shadowOffset))):x3dom.isa(w[A],x3dom.nodeTypes.SpotLight)&amp;&amp;(F["light"+A+"_Type"]=2,F["light"+A+"_On"]=w[A]._vf.on?1:0,F["light"+A+"_Direction"]=V.multMatrixVec(w[A]._vf.direction).toGL(),F["light"+A+"_Attenuation"]=w[A]._vf.attenuation.toGL(),F["light"+A+"_Location"]=V.multMatrixPnt(w[A]._vf.location).toGL(),F["light"+A+"_Radius"]=w[A]._vf.radius,F["light"+A+"_BeamWidth"]=w[A]._vf.beamWidth,F["light"+A+"_CutOffAngle"]=w[A]._vf.cutOffAngle,F["light"+A+"_ShadowIntensity"]=w[A]._vf.shadowIntensity,F["light"+A+"_ShadowCascades"]=w[A]._vf.shadowCascades,F["light"+A+"_ShadowOffset"]=Math.max(0,Math.min(1,w[A]._vf.shadowOffset)))}e.drawArrays(e.TRIANGLES,0,6);var L=C+1;for(m=0;m&lt;L;m++)e.activeTexture(e.TEXTURE0+m),e.bindTexture(e.TEXTURE_2D,null);e.disableVertexAttribArray(F.position)}this.stateManager.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)}},e.prototype.blurTex=function(e,t,i,s){if(!(s&lt;=0)){s=s&lt;5?3:s&lt;7?5:7;for(var r=i.width,o=i.height,n=null,a=0,h=t._webgl.fboBlur.length;a&lt;h;a++)if(o==t._webgl.fboBlur[a].height){n=t._webgl.fboBlur[a];break}this.stateManager.bindFramebuffer(e.FRAMEBUFFER,n.fbo),this.stateManager.viewport(0,0,r,o),this.stateManager.enable(e.BLEND),this.stateManager.blendFunc(e.ONE,e.ZERO),this.stateManager.disable(e.CULL_FACE),this.stateManager.disable(e.DEPTH_TEST),e.clearColor(1,1,1,0),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);var d=this.cache.getShader(e,x3dom.shader.BLUR);this.stateManager.useProgram(d),e.bindBuffer(e.ARRAY_BUFFER,t._webgl.ppBuffer),e.vertexAttribPointer(d.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(d.position),d.pixelSizeHor=1/r,d.pixelSizeVert=1/o,d.filterSize=s,d.horizontal=!0,d.texture=0,e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i.tex),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.drawArrays(e.TRIANGLES,0,6),this.stateManager.bindFramebuffer(e.FRAMEBUFFER,i.fbo),e.clearColor(1,1,1,0),e.clearDepth(1),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),d.horizontal=!1,e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n.tex),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.drawArrays(e.TRIANGLES,0,6),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.disableVertexAttribArray(d.position),e.flush(),this.stateManager.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),this.stateManager.bindFramebuffer(e.FRAMEBUFFER,null),this.stateManager.viewport(0,0,this.canvas.width,this.canvas.height)}},e.prototype.setVertexAttribPointerPosition=function(e,t,i,s){var r=t._webgl.shader;if(void 0!==r.position&amp;&amp;t._webgl.buffers[i+1]){var o=t._cf.geometry.node;e.bindBuffer(e.ARRAY_BUFFER,t._webgl.buffers[i+1]),e.vertexAttribPointer(r.position,o._mesh._numPosComponents,t._webgl.coordType,!1,t._coordStrideOffset[0],t._coordStrideOffset[1]),e.enableVertexAttribArray(r.position)}},e.prototype.setVertexAttribPointerNormal=function(e,t,i,s){var r=t._webgl.shader;if(void 0!==r.normal&amp;&amp;t._webgl.buffers[i+2]){var o=t._cf.geometry.node;e.bindBuffer(e.ARRAY_BUFFER,t._webgl.buffers[i+2]),e.vertexAttribPointer(r.normal,o._mesh._numNormComponents,t._webgl.normalType,!1,t._normalStrideOffset[0],t._normalStrideOffset[1]),e.enableVertexAttribArray(r.normal)}},e.prototype.setVertexAttribPointerTexCoord=function(e,t,i,s){var r=t._webgl.shader;if(void 0!==r.texcoord&amp;&amp;t._webgl.buffers[i+3]){var o=t._cf.geometry.node;e.bindBuffer(e.ARRAY_BUFFER,t._webgl.buffers[i+3]),e.vertexAttribPointer(r.texcoord,o._mesh._numTexComponents,t._webgl.texCoordType,!1,t._texCoordStrideOffset[0],t._texCoordStrideOffset[1]),e.enableVertexAttribArray(r.texcoord)}},e.prototype.setVertexAttribPointerColor=function(e,t,i,s){var r=t._webgl.shader;if(void 0!==r.color&amp;&amp;t._webgl.buffers[i+4]){var o=t._cf.geometry.node;e.bindBuffer(e.ARRAY_BUFFER,t._webgl.buffers[i+4]),e.vertexAttribPointer(r.color,o._mesh._numColComponents,t._webgl.colorType,!1,t._colorStrideOffset[0],t._colorStrideOffset[1]),e.enableVertexAttribArray(r.color)}},function(t,i,s,r,o){var n=["webgl","experimental-webgl","moz-webgl","webkit-3d"];r&amp;&amp;(n=["experimental-webgl2"].concat(n));for(var a=null,h=o.getElementsByTagName("Environment"),d={alpha:!0,depth:!0,stencil:!0,antialias:!!!(h&amp;&amp;h[0]&amp;&amp;h[0].hasAttribute("SSAO")&amp;&amp;"true"===h[0].getAttribute("SSAO").toLowerCase()),premultipliedAlpha:!1,preserveDrawingBuffer:!0,failIfMajorPerformanceCaveat:!0},l=0;l&lt;n.length;l++)try{if((a=t.getContext(n[l],d))||(x3dom.caps.RENDERMODE="SOFTWARE",d.failIfMajorPerformanceCaveat=!1,a=t.getContext(n[l],d)),a){var u=new e(a,t,"webgl",o);try{x3dom.caps.VENDOR=a.getParameter(a.VENDOR),x3dom.caps.VERSION=a.getParameter(a.VERSION),x3dom.caps.RENDERER=a.getParameter(a.RENDERER),x3dom.caps.SHADING_LANGUAGE_VERSION=a.getParameter(a.SHADING_LANGUAGE_VERSION),x3dom.caps.RED_BITS=a.getParameter(a.RED_BITS),x3dom.caps.GREEN_BITS=a.getParameter(a.GREEN_BITS),x3dom.caps.BLUE_BITS=a.getParameter(a.BLUE_BITS),x3dom.caps.ALPHA_BITS=a.getParameter(a.ALPHA_BITS),x3dom.caps.DEPTH_BITS=a.getParameter(a.DEPTH_BITS),x3dom.caps.MAX_VERTEX_ATTRIBS=a.getParameter(a.MAX_VERTEX_ATTRIBS),x3dom.caps.MAX_VERTEX_TEXTURE_IMAGE_UNITS=a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x3dom.caps.MAX_VARYING_VECTORS=a.getParameter(a.MAX_VARYING_VECTORS),x3dom.caps.MAX_VERTEX_UNIFORM_VECTORS=a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS),x3dom.caps.MAX_COMBINED_TEXTURE_IMAGE_UNITS=a.getParameter(a.MAX_COMBINED_TEXTURE_IMAGE_UNITS),x3dom.caps.MAX_TEXTURE_SIZE=a.getParameter(a.MAX_TEXTURE_SIZE),x3dom.caps.MAX_TEXTURE_IMAGE_UNITS=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),x3dom.caps.MAX_CUBE_MAP_TEXTURE_SIZE=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE),x3dom.caps.COMPRESSED_TEXTURE_FORMATS=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),x3dom.caps.MAX_RENDERBUFFER_SIZE=a.getParameter(a.MAX_RENDERBUFFER_SIZE),x3dom.caps.MAX_VIEWPORT_DIMS=a.getParameter(a.MAX_VIEWPORT_DIMS),x3dom.caps.ALIASED_LINE_WIDTH_RANGE=a.getParameter(a.ALIASED_LINE_WIDTH_RANGE),x3dom.caps.ALIASED_POINT_SIZE_RANGE=a.getParameter(a.ALIASED_POINT_SIZE_RANGE),x3dom.caps.SAMPLES=a.getParameter(a.SAMPLES),x3dom.caps.INDEX_UINT=a.getExtension("OES_element_index_uint"),x3dom.caps.FP_TEXTURES=a.getExtension("OES_texture_float"),x3dom.caps.FPL_TEXTURES=a.getExtension("OES_texture_float_linear"),x3dom.caps.STD_DERIVATIVES=a.getExtension("OES_standard_derivatives"),x3dom.caps.DRAW_BUFFERS=a.getExtension("WEBGL_draw_buffers"),x3dom.caps.DEPTH_TEXTURE=a.getExtension("WEBGL_depth_texture"),x3dom.caps.DEBUGRENDERINFO=a.getExtension("WEBGL_debug_renderer_info"),x3dom.caps.EXTENSIONS=a.getSupportedExtensions(),x3dom.Utils.isWebGL2Enabled()&amp;&amp;(x3dom.caps.DEPTH_TEXTURE=null),x3dom.caps.DEBUGRENDERINFO?(x3dom.caps.UNMASKED_RENDERER_WEBGL=a.getParameter(x3dom.caps.DEBUGRENDERINFO.UNMASKED_RENDERER_WEBGL),x3dom.caps.UNMASKED_VENDOR_WEBGL=a.getParameter(x3dom.caps.DEBUGRENDERINFO.UNMASKED_VENDOR_WEBGL)):(x3dom.caps.UNMASKED_RENDERER_WEBGL="",x3dom.caps.UNMASKED_VENDOR_WEBGL="");var f=x3dom.caps.EXTENSIONS.toString().replace(/,/g,", ");x3dom.debug.logInfo(n[l]+" context found\nVendor: "+x3dom.caps.VENDOR+" "+x3dom.caps.UNMASKED_VENDOR_WEBGL+", Renderer: "+x3dom.caps.RENDERER+" "+x3dom.caps.UNMASKED_RENDERER_WEBGL+", Version: "+x3dom.caps.VERSION+", ShadingLangV.: "+x3dom.caps.SHADING_LANGUAGE_VERSION+", MSAA samples: "+x3dom.caps.SAMPLES+"\nExtensions: "+f),x3dom.caps.INDEX_UINT&amp;&amp;(x3dom.Utils.maxIndexableCoords=4294967295),x3dom.caps.MOBILE=function(e){return/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}(navigator.userAgent||navigator.vendor||window.opera),(x3dom.caps.RENDERER.indexOf("PowerVR")&gt;=0||navigator.appVersion.indexOf("Mobile")&gt;-1||x3dom.caps.MAX_VARYING_VECTORS&lt;=8||x3dom.caps.MAX_VERTEX_TEXTURE_IMAGE_UNITS&lt;2)&amp;&amp;(x3dom.caps.MOBILE=!0),x3dom.caps.MOBILE?i?(x3dom.caps.MOBILE=!1,x3dom.debug.logWarning("Detected mobile graphics card! But being forced to desktop shaders which might not work!")):x3dom.debug.logWarning("Detected mobile graphics card! Using low quality shaders without ImageGeometry support!"):s&amp;&amp;(x3dom.caps.MOBILE=!0,x3dom.debug.logWarning("Detected desktop graphics card! But being forced to mobile shaders with lower quality!"))}catch(c){x3dom.debug.logWarning("Your browser probably supports an older WebGL version. Please try the old mobile runtime instead:\nhttp://www.x3dom.org/x3dom/src_mobile/x3dom.js"),u=null}return u}}catch(m){x3dom.debug.logWarning(m)}return null}}(),x3dom.NodeNameSpace=function(e,t){this.name=e,this.doc=t,this.baseURL="",this.defMap={},this.parent=null,this.childSpaces=[]},x3dom.NodeNameSpace.prototype.addNode=function(e,t){this.defMap[t]=e,e._nameSpace=this},x3dom.NodeNameSpace.prototype.removeNode=function(e){var t=e?this.defMap[e]:null;t&amp;&amp;(delete this.defMap[e],t._nameSpace=null)},x3dom.NodeNameSpace.prototype.getNamedNode=function(e){return this.defMap[e]},x3dom.NodeNameSpace.prototype.getNamedElement=function(e){var t=this.defMap[e];return t?t._xmlNode:null},x3dom.NodeNameSpace.prototype.addSpace=function(e){this.childSpaces.push(e),e.parent=this},x3dom.NodeNameSpace.prototype.removeSpace=function(e){e.parent=null;for(var t=0;t&lt;this.childSpaces.length;t++)this.childSpaces[t]==e&amp;&amp;this.childSpaces.splice(t,1)},x3dom.NodeNameSpace.prototype.setBaseURL=function(e){var t=e.lastIndexOf("/");this.baseURL=t&gt;=0?e.substr(0,t+1):"",x3dom.debug.logInfo("setBaseURL: "+this.baseURL)},x3dom.NodeNameSpace.prototype.getURL=function(e){return void 0!==e&amp;&amp;e.length?"/"===e[0]||e.indexOf(":")&gt;=0?e:this.baseURL+e:""},x3dom.hasElementAttribute=function(e){var t=this.__hasAttribute(e);return!t&amp;&amp;e&amp;&amp;(t=this.__hasAttribute(e.toLowerCase())),t},x3dom.getElementAttribute=function(e){var t=this.__getAttribute(e);return!t&amp;&amp;""!=t&amp;&amp;e&amp;&amp;(t=this.__getAttribute(e.toLowerCase())),t||!this._x3domNode?t:this._x3domNode._vf[e]},x3dom.setElementAttribute=function(e,t){this.__setAttribute(e,t);var i=this._x3domNode;i&amp;&amp;(i.updateField(e,t),i._nameSpace.doc.needRender=!0)},x3dom.getFieldValue=function(e){var t=this._x3domNode;if(t&amp;&amp;void 0!==t._vf[e]){var i=t._vf[e];return i instanceof Object&amp;&amp;"copy"in i?t._vf[e].copy():t._vf[e]}return null},x3dom.setFieldValue=function(e,t){var i=this._x3domNode;i&amp;&amp;void 0!==i._vf[e]&amp;&amp;(i._vf[e]=t instanceof Object&amp;&amp;"copy"in t?t.copy():t,i.fieldChanged(e),i._nameSpace.doc.needRender=!0)},x3dom.requestFieldRef=function(e){var t=this._x3domNode;return t&amp;&amp;t._vf[e]?t._vf[e]:null},x3dom.releaseFieldRef=function(e){var t=this._x3domNode;t&amp;&amp;t._vf[e]&amp;&amp;(t.fieldChanged(e),t._nameSpace.doc.needRender=!0)},x3dom.NodeNameSpace.prototype.setupTree=function(e,t){var i=null;if(t=t||null,x3dom.isX3DElement(e)){if(e._x3domNode)return x3dom.debug.logWarning("Tree is already initialized"),null;if(void 0===e.tagName||e.__addEventListener||e.__removeEventListener||(e.__addEventListener=e.addEventListener,e.addEventListener=function(e,t,i){this._x3domNode._listeners[e]||(this._x3domNode._listeners[e]=[]),this._x3domNode._listeners[e].push(t),this.__addEventListener(e,t,i)},e.__removeEventListener=e.removeEventListener,e.removeEventListener=function(e,t,i){var s=this._x3domNode._listeners[e];if(s)for(var r=0;r&lt;s.length;r++)s[r]==t&amp;&amp;s.splice(r,1);this.__removeEventListener(e,t,i)}),e.hasAttribute("USE")||e.hasAttribute("use")){if(e.hasAttribute("USE")||e.setAttribute("USE",e.getAttribute("use")),!(i=this.defMap[e.getAttribute("USE")])){var s=e.getAttribute("USE").split("__");if(s.length&gt;=2){for(var r=this;r;)r.name==s[0]&amp;&amp;(i=r.defMap[s[1]]),r=i?null:r.parent;i||(i=null,x3dom.debug.logWarning("Could not USE: "+e.getAttribute("USE")))}}return i&amp;&amp;(e._x3domNode=i),i}if("route"===e.localName.toLowerCase()){var o=e,n=o.getAttribute("fromNode")||o.getAttribute("fromnode"),a=o.getAttribute("toNode")||o.getAttribute("tonode"),h=this.defMap[n],d=this.defMap[a];return h&amp;&amp;d?(n=o.getAttribute("fromField")||o.getAttribute("fromfield"),a=o.getAttribute("toField")||o.getAttribute("tofield"),h.setupRoute(n,d,a),o._nodeNameSpace=this):x3dom.debug.logWarning("Broken route - can't find all DEFs for "+n+" -&gt; "+a),null}e.requestFieldRef=x3dom.requestFieldRef,e.releaseFieldRef=x3dom.releaseFieldRef,e.getFieldValue=x3dom.getFieldValue,e.setFieldValue=x3dom.setFieldValue;var l=x3dom.nodeTypesLC[e.localName.toLowerCase()];if(void 0!==l){!1===x3dom.userAgentFeature.supportsDOMAttrModified&amp;&amp;e instanceof Element&amp;&amp;(e.setAttribute&amp;&amp;!e.__setAttribute&amp;&amp;(e.__setAttribute=e.setAttribute,e.setAttribute=x3dom.setElementAttribute),e.getAttribute&amp;&amp;!e.__getAttribute&amp;&amp;(e.__getAttribute=e.getAttribute,e.getAttribute=x3dom.getElementAttribute),e.hasAttribute&amp;&amp;!e.__hasAttribute&amp;&amp;(e.__hasAttribute=e.hasAttribute,e.hasAttribute=x3dom.hasElementAttribute));var u={doc:this.doc,xmlNode:e,nameSpace:this};i=new l(u),e.hasAttribute("DEF")?(i._DEF=e.getAttribute("DEF"),this.defMap[i._DEF]=i):e.hasAttribute("id")&amp;&amp;(i._DEF=e.getAttribute("id"),this.defMap[i._DEF]=i),void 0===e.highlight&amp;&amp;(e.highlight=function(e,t){var i=x3dom.fields.SFColor.parse(t);this._x3domNode.highlight(e,i),this._x3domNode._nameSpace.doc.needRender=!0}),i._xmlNode=e,e._x3domNode=i;var f=this;return Array.forEach(e.childNodes,(function(e){var t=f.setupTree(e,i);t&amp;&amp;i.addChild(t,e.getAttribute("containerField"))})),i.nodeChanged(),i}x3dom.debug.logWarning("Unrecognised X3D element &amp;lt;"+e.localName+"&amp;gt;.")}else e.localName&amp;&amp;(t&amp;&amp;"x3dommetagroup"==e.localName.toLowerCase()?Array.forEach(e.childNodes,function(e){var i=this.setupTree(e,t);i&amp;&amp;t.addChild(i,e.getAttribute("containerField"))}.bind(this)):(x3dom.debug.logWarning("Unrecognised X3D element &amp;lt;"+e.localName+"&amp;gt;."),i=null));return i},x3dom.registerNodeType("X3DNode","Core",defineClass(null,(function(e){this._xmlNode=null,this._DEF=null,this._nameSpace=e&amp;&amp;e.nameSpace?e.nameSpace:null,this._vf={},this._vfFieldTypes={},this._cf={},this._cfFieldTypes={},this._fieldWatchers={},this._routes={},this._listeners={},this._parentNodes=[],this._childNodes=[],this.addField_SFNode("metadata",x3dom.nodeTypes.X3DMetadataObject)}),{type:function(){return this.constructor},typeName:function(){return this.constructor._typeName},addChild:function(e,t){if(e){var i=null;if(t)i=this._cf[t];else for(var s in this._cf)if(this._cf.hasOwnProperty(s)){var r=this._cf[s];if(x3dom.isa(e,r.type)){i=r;break}}if(i&amp;&amp;i.addLink(e))return e._parentNodes.push(this),this._childNodes.push(e),e.parentAdded(this),!0}return!1},removeChild:function(e){if(e)for(var t in this._cf){if(this._cf.hasOwnProperty(t))if(this._cf[t].rmLink(e)){for(var i=e._parentNodes.length-1;i&gt;=0;i--)e._parentNodes[i]===this&amp;&amp;(e._parentNodes.splice(i,1),e.parentRemoved(this));for(var s=this._childNodes.length-1;s&gt;=0;s--)if(this._childNodes[s]===e)return e.onRemove(),this._childNodes.splice(s,1),!0}}return!1},onRemove:function(){},parentAdded:function(e){},parentRemoved:function(e){for(var t=0,i=this._childNodes.length;t&lt;i;t++)this._childNodes[t]&amp;&amp;this._childNodes[t].parentRemoved(this)},getCurrentTransform:function(){return this._parentNodes.length&gt;=1?this.transformMatrix(this._parentNodes[0].getCurrentTransform()):x3dom.fields.SFMatrix4f.identity()},transformMatrix:function(e){return e},getVolume:function(){return null},invalidateVolume:function(){},invalidateCache:function(){},volumeValid:function(){return!1},collectDrawableObjects:function(e,t,i,s,r,o){},highlight:function(e,t){this._vf.hasOwnProperty("diffuseColor")&amp;&amp;(e?(void 0===this._actDiffuseColor&amp;&amp;(this._actDiffuseColor=new x3dom.fields.SFColor,this._highlightOn=!1),this._highlightOn||(this._actDiffuseColor.setValues(this._vf.diffuseColor),this._highlightOn=!0),this._vf.diffuseColor.setValues(t)):void 0!==this._actDiffuseColor&amp;&amp;(this._vf.diffuseColor.setValues(this._actDiffuseColor),this._highlightOn=!1,delete this._actDiffuseColor));for(var i=0,s=this._childNodes.length;i&lt;s;i++)this._childNodes[i]&amp;&amp;this._childNodes[i].highlight(e,t)},findX3DDoc:function(){return this._nameSpace.doc},doIntersect:function(e){for(var t=!1,i=0;i&lt;this._childNodes.length;i++)this._childNodes[i]&amp;&amp;(t=this._childNodes[i].doIntersect(e)||t);return t},postMessage:function(e,t){this._vf[e]=t;var i=this._fieldWatchers[e],s=this;i&amp;&amp;Array.forEach(i,(function(e){e.call(s,t)}));var r={target:s._xmlNode,type:"outputchange",fieldName:e,value:t};this.callEvtHandler("onoutputchange",r)},updateField:function(e,t){var i=this._vf[e];if(void 0===i){for(var s in this._vf)if(s.toLowerCase()==e){e=s,i=this._vf[e];break}if(void 0===i&amp;&amp;0==e.indexOf("set_")){var r=e.substr("set_".length,e.length-1);void 0!==this._vf[r]&amp;&amp;(e=r,i=this._vf[e])}void 0===i&amp;&amp;(i=null,this._vf[e]=i)}if(null!==i){try{this._vf[e].setValueByStr(t)}catch(o){try{switch((typeof this._vf[e]).toString()){case"number":this._vf[e]="number"==typeof t?t:+t;break;case"boolean":this._vf[e]="boolean"==typeof t?t:"true"==t.toLowerCase();break;case"string":this._vf[e]=t}}catch(n){x3dom.debug.logError("updateField: setValueByStr() NYI for "+typeof i)}}this.fieldChanged(e)}},setupRoute:function(e,t,i){var s,r="set_",o="_changed";this._vf[e]||(0===e.indexOf(r)?(s=e.substr(r.length,e.length-1),this._vf[s]&amp;&amp;(e=s)):e.indexOf(o)&gt;0&amp;&amp;(s=e.substr(0,e.length-o.length),this._vf[s]&amp;&amp;(e=s))),t._vf[i]||(0===i.indexOf(r)?(s=i.substr(r.length,i.length-1),t._vf[s]&amp;&amp;(i=s)):i.indexOf(o)&gt;0&amp;&amp;(s=i.substr(0,i.length-o.length),t._vf[s]&amp;&amp;(i=s)));var n=this._DEF+"&amp;"+e+"&amp;"+t._DEF+"&amp;"+i;this._routes[n]||(this._fieldWatchers[e]||(this._fieldWatchers[e]=[]),this._fieldWatchers[e].push((function(e){t.postMessage(i,e)})),t._fieldWatchers[i]||(t._fieldWatchers[i]=[]),t._fieldWatchers[i].push((function(e){t._vf[i]=e,t.fieldChanged(i)})),this._routes[n]={from:this._fieldWatchers[e].length-1,to:t._fieldWatchers[i].length-1})},removeRoute:function(e,t,i){var s,r="set_",o="_changed";this._vf[e]||(0===e.indexOf(r)?(s=e.substr(r.length,e.length-1),this._vf[s]&amp;&amp;(e=s)):e.indexOf(o)&gt;0&amp;&amp;(s=e.substr(0,e.length-o.length),this._vf[s]&amp;&amp;(e=s))),t._vf[i]||(0===i.indexOf(r)?(s=i.substr(r.length,i.length-1),t._vf[s]&amp;&amp;(i=s)):i.indexOf(o)&gt;0&amp;&amp;(s=i.substr(0,i.length-o.length),t._vf[s]&amp;&amp;(i=s)));var n=this._DEF+"&amp;"+e+"&amp;"+t._DEF+"&amp;"+i;this._routes[n]&amp;&amp;(this._fieldWatchers[e].splice(this._routes[n].from,1),t._fieldWatchers[i].splice(this._routes[n].to,1),delete this._routes[n])},fieldChanged:function(e){},nodeChanged:function(){},callEvtHandler:function(e,t){if(!this._xmlNode)return t.cancelBubble;try{var i=this._xmlNode[e];if(t.target=this._xmlNode,"function"===typeof i)i.call(this._xmlNode,t);else{var s=this._xmlNode.getAttribute(e);new Function("event",s).call(this._xmlNode,t)}var r=this._listeners[t.type];if(r)for(var o=0;o&lt;r.length;o++)r[o].call(this._xmlNode,t)}catch(n){x3dom.debug.logException(n)}return t.cancelBubble},initSetter:function(e,t){if(e&amp;&amp;t){var i=t.toLowerCase();if(e.__defineSetter__&amp;&amp;e.__defineGetter__?(e.__defineSetter__(t,(function(i){e.setAttribute(t,i)})),e.__defineGetter__(t,(function(){return e.getAttribute(t)})),i!=t&amp;&amp;(e.__defineSetter__(i,(function(i){e.setAttribute(t,i)})),e.__defineGetter__(i,(function(){return e.getAttribute(t)})))):Object.defineProperty(e,t,{set:function(i){e.setAttribute(t,i)},get:function(){return e.getAttribute(t)},configurable:!0,enumerable:!0}),this._vf[t]&amp;&amp;!e.attributes[t]&amp;&amp;!e.attributes[t.toLowerCase()]){var s="";try{s=this._vf[t].toGL?this._vf[t].toGL().toString():this._vf[t].toString()}catch(r){s=this._vf[t].toString()}s||(s=""),e.setAttribute(t,s)}}},addField_SFInt32:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?parseInt(e.xmlNode.getAttribute(t),10):i,e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFInt32"},addField_SFFloat:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?+e.xmlNode.getAttribute(t):i,e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFFloat"},addField_SFDouble:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?+e.xmlNode.getAttribute(t):i,e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFDouble"},addField_SFTime:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?+e.xmlNode.getAttribute(t):i,e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFTime"},addField_SFBool:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?"true"===e.xmlNode.getAttribute(t).toLowerCase():i,e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFBool"},addField_SFString:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?e.xmlNode.getAttribute(t):i,e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFString"},addField_SFColor:function(e,t,i,s,r){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.SFColor.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.SFColor(i,s,r),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFColor"},addField_SFColorRGBA:function(e,t,i,s,r,o){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.SFColorRGBA.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.SFColorRGBA(i,s,r,o),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFColorRGBA"},addField_SFVec2f:function(e,t,i,s){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.SFVec2f.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.SFVec2f(i,s),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFVec2f"},addField_SFVec3f:function(e,t,i,s,r){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.SFVec3f.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.SFVec3f(i,s,r),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFVec3f"},addField_SFVec4f:function(e,t,i,s,r,o){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.SFVec4f.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.SFVec4f(i,s,r,o),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFVec4f"},addField_SFVec3d:function(e,t,i,s,r){this.addField_SFVec3f(e,t,i,s,r),this._vfFieldTypes[t]="SFVec3d"},addField_SFRotation:function(e,t,i,s,r,o){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.Quaternion.parseAxisAngle(e.xmlNode.getAttribute(t)):x3dom.fields.Quaternion.axisAngle(new x3dom.fields.SFVec3f(i,s,r),o),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFRotation"},addField_SFMatrix4f:function(e,t,i,s,r,o,n,a,h,d,l,u,f,c,m,_,p,x){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.SFMatrix4f.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.SFMatrix4f(i,s,r,o,n,a,h,d,l,u,f,c,m,_,p,x),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFMatrix4f"},addField_SFImage:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.SFImage.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.SFImage(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="SFImage"},addField_MFString:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFString.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFString(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFString"},addField_MFBoolean:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFBoolean.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFBoolean(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFBoolean"},addField_MFInt32:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFInt32.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFInt32(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFInt32"},addField_MFFloat:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFFloat.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFFloat(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFFloat"},addField_MFDouble:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFFloat.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFFloat(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFDouble"},addField_MFColor:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFColor.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFColor(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFColor"},addField_MFColorRGBA:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFColorRGBA.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFColorRGBA(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFColorRGBA"},addField_MFVec2f:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFVec2f.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFVec2f(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFVec2f"},addField_MFVec3f:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFVec3f.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFVec3f(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFVec3f"},addField_MFVec3d:function(e,t,i){this.addField_MFVec3f(e,t,i),this._vfFieldTypes[t]="MFVec3d"},addField_MFRotation:function(e,t,i){this._vf[t]=e&amp;&amp;e.xmlNode&amp;&amp;e.xmlNode.hasAttribute(t)?x3dom.fields.MFRotation.parse(e.xmlNode.getAttribute(t)):new x3dom.fields.MFRotation(i),e&amp;&amp;e.xmlNode&amp;&amp;this.initSetter(e.xmlNode,t),this._vfFieldTypes[t]="MFRotation"},addField_SFNode:function(e,t){this._cf[e]=new x3dom.fields.SFNode(t),this._cfFieldTypes[e]="SFNode"},addField_MFNode:function(e,t){this._cf[e]=new x3dom.fields.MFNode(t),this._cfFieldTypes[e]="MFNode"}})),x3dom.registerNodeType("X3DMetadataObject","Core",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.X3DMetadataObject.superClass.call(this,e),this.addField_SFString(e,"name",""),this.addField_SFString(e,"reference","")}))),x3dom.registerNodeType("MetadataBoolean","Core",defineClass(x3dom.nodeTypes.X3DMetadataObject,(function(e){x3dom.nodeTypes.MetadataBoolean.superClass.call(this,e),this.addField_MFBoolean(e,"value",[])}))),x3dom.registerNodeType("MetadataDouble","Core",defineClass(x3dom.nodeTypes.X3DMetadataObject,(function(e){x3dom.nodeTypes.MetadataDouble.superClass.call(this,e),this.addField_MFDouble(e,"value",[])}))),x3dom.registerNodeType("MetadataFloat","Core",defineClass(x3dom.nodeTypes.X3DMetadataObject,(function(e){x3dom.nodeTypes.MetadataFloat.superClass.call(this,e),this.addField_MFFloat(e,"value",[])}))),x3dom.registerNodeType("MetadataInteger","Core",defineClass(x3dom.nodeTypes.X3DMetadataObject,(function(e){x3dom.nodeTypes.MetadataInteger.superClass.call(this,e),this.addField_MFInt32(e,"value",[])}))),x3dom.registerNodeType("MetadataSet","Core",defineClass(x3dom.nodeTypes.X3DMetadataObject,(function(e){x3dom.nodeTypes.MetadataSet.superClass.call(this,e),this.addField_MFNode("value",x3dom.nodeTypes.X3DMetadataObject)}))),x3dom.registerNodeType("MetadataString","Core",defineClass(x3dom.nodeTypes.X3DMetadataObject,(function(e){x3dom.nodeTypes.MetadataString.superClass.call(this,e),this.addField_MFString(e,"value",[])}))),x3dom.registerNodeType("Field","Core",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.Field.superClass.call(this,e),this.addField_SFString(e,"name",""),this.addField_SFString(e,"type",""),this.addField_SFString(e,"value","")}),{fieldChanged:function(e){var t=this;"value"===e&amp;&amp;Array.forEach(this._parentNodes,(function(e){e.fieldChanged(t._vf.name)}))}})),x3dom.registerNodeType("X3DChildNode","Core",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.X3DChildNode.superClass.call(this,e)}))),x3dom.registerNodeType("X3DBindableNode","Core",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DBindableNode.superClass.call(this,e),this.addField_SFBool(e,"bind",!1),this.addField_SFString(e,"description",""),this.addField_SFBool(e,"isActive",!1),this._autoGen=!(!e||!e.autoGen),this._autoGen&amp;&amp;(this._vf.description="default"+this.constructor.superClass._typeName),this._stack=null,this._bindAnimation=!0}),{bind:function(e){this._stack?e?this._stack.push(this):this._stack.pop(this):x3dom.debug.logError("No BindStack in "+this.typeName()+"Bindable")},activate:function(e){this.postMessage("isActive",!0),x3dom.debug.logInfo("activate "+this.typeName()+"Bindable "+this._DEF+"/"+this._vf.description)},deactivate:function(e){this.postMessage("isActive",!1),x3dom.debug.logInfo("deactivate "+this.typeName()+"Bindable "+this._DEF+"/"+this._vf.description)},fieldChanged:function(e){e.indexOf("bind")&gt;=0&amp;&amp;this.bind(this._vf.bind)},nodeChanged:function(){this._stack=this._nameSpace.doc._bindableBag.addBindable(this)}})),x3dom.registerNodeType("X3DInfoNode","Core",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DInfoNode.superClass.call(this,e)}))),x3dom.registerNodeType("WorldInfo","Core",defineClass(x3dom.nodeTypes.X3DInfoNode,(function(e){x3dom.nodeTypes.WorldInfo.superClass.call(this,e),this.addField_MFString(e,"info",[]),this.addField_SFString(e,"title",""),x3dom.debug.logInfo(this._vf.info),x3dom.debug.logInfo(this._vf.title)}))),x3dom.registerNodeType("X3DSensorNode","Core",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DSensorNode.superClass.call(this,e),this.addField_SFBool(e,"enabled",!0)}))),x3dom.registerNodeType("Param","Core",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.Param.superClass.call(this,e),x3dom.debug.logWarning('DEPRECATED: Param element needs to be child of X3D element [&lt;a href="http://x3dom.org/docs/latest/configuration.html"&gt;DOCS&lt;/a&gt;]')}))),x3dom.registerNodeType("X3DBoundedObject","Grouping",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DBoundedObject.superClass.call(this,e),this.addField_SFBool(e,"render",!0),this.addField_SFVec3f(e,"bboxCenter",0,0,0),this.addField_SFVec3f(e,"bboxSize",-1,-1,-1),this._graph={boundedNode:this,localMatrix:x3dom.fields.SFMatrix4f.identity(),globalMatrix:null,volume:new x3dom.fields.BoxVolume,lastVolume:new x3dom.fields.BoxVolume,worldVolume:new x3dom.fields.BoxVolume,center:new x3dom.fields.SFVec3f(0,0,0),coverage:-1,needCulling:!0}}),{fieldChanged:function(e){this._vf.hasOwnProperty(e)&amp;&amp;this.invalidateVolume()},nodeChanged:function(){this.invalidateVolume()},parentAdded:function(e){this.invalidateVolume()},getVolume:function(){var e=this._graph.volume;if(!this.volumeValid()&amp;&amp;this._vf.render)for(var t=0,i=this._childNodes.length;t&lt;i;t++){var s=this._childNodes[t];if(s&amp;&amp;!0===s._vf.render){var r=s.getVolume();r&amp;&amp;r.isValid()&amp;&amp;e.extendBounds(r.min,r.max)}}if(!e.equals(this._graph.lastVolume)){this._graph.lastVolume=x3dom.fields.BoxVolume.copy(e);var o={target:this._xmlNode,type:"volumechanged",volume:x3dom.fields.BoxVolume.copy(e)};this.callEvtHandler("onvolumechanged",o)}return e},invalidateVolume:function(){var e=this._graph;e.volume.invalidate(),e.worldVolume.invalidate(),e.globalMatrix=null;for(var t=0,i=this._parentNodes.length;t&lt;i;t++){var s=this._parentNodes[t];s&amp;&amp;s.invalidateVolume()}},invalidateCache:function(){var e=this._graph;e.worldVolume.invalidate(),e.globalMatrix=null},cacheInvalid:function(){return null==this._graph.globalMatrix||!this._graph.worldVolume.isValid()},volumeValid:function(){return this._graph.volume.isValid()},graphState:function(){return this._graph},forceUpdateCoverage:function(){return!1}})),x3dom.registerNodeType("X3DGroupingNode","Grouping",defineClass(x3dom.nodeTypes.X3DBoundedObject,(function(e){x3dom.nodeTypes.X3DGroupingNode.superClass.call(this,e),this.addField_MFNode("children",x3dom.nodeTypes.X3DChildNode)}),{collectDrawableObjects:function(e,t,i,s,r,o){if(i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),!((r=t.cull(e,this.graphState(),i,r))&lt;0)){var n,a;i?(this._graph.globalMatrix||(this._graph.globalMatrix=this.transformMatrix(e)),a=this._graph.globalMatrix):a=this.transformMatrix(e);var h=this._childNodes.length;if(x3dom.nodeTypes.ClipPlane.count&gt;0){for(var d=[],l=0;l&lt;h;l++)(n=this._childNodes[l])&amp;&amp;x3dom.isa(n,x3dom.nodeTypes.ClipPlane)&amp;&amp;n._vf.on&amp;&amp;n._vf.enabled&amp;&amp;d.push({plane:n,trafo:a});o=d.concat(o)}for(var u=0;u&lt;h;u++)(n=this._childNodes[u])&amp;&amp;n.collectDrawableObjects(a,t,i,s,r,o)}}})),x3dom.registerNodeType("Switch","Grouping",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.Switch.superClass.call(this,e),this.addField_SFInt32(e,"whichChoice",-1)}),{fieldChanged:function(e){"whichChoice"==e&amp;&amp;this.invalidateVolume()},getVolume:function(){var e=this._graph.volume;if(!this.volumeValid()&amp;&amp;this._vf.render&amp;&amp;this._vf.whichChoice&gt;=0&amp;&amp;this._vf.whichChoice&lt;this._childNodes.length){var t=this._childNodes[this._vf.whichChoice],i=t&amp;&amp;!0===t._vf.render?t.getVolume():null;i&amp;&amp;i.isValid()&amp;&amp;e.extendBounds(i.min,i.max)}return e},collectDrawableObjects:function(e,t,i,s,r,o){var n,a;(i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),this._vf.whichChoice&lt;0||this._vf.whichChoice&gt;=this._childNodes.length||(r=t.cull(e,this.graphState(),i,r))&lt;0)||(i?(this._graph.globalMatrix||(this._graph.globalMatrix=this.transformMatrix(e)),a=this._graph.globalMatrix):a=this.transformMatrix(e),(n=this._childNodes[this._vf.whichChoice])&amp;&amp;n.collectDrawableObjects(a,t,i,s,r,o))},doIntersect:function(e){if(this._vf.whichChoice&lt;0||this._vf.whichChoice&gt;=this._childNodes.length)return!1;var t=this._childNodes[this._vf.whichChoice];return!!t&amp;&amp;t.doIntersect(e)}})),x3dom.registerNodeType("X3DTransformNode","Grouping",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.X3DTransformNode.superClass.call(this,e),e?e.doc._nodeBag.trans.push(this):x3dom.debug.logWarning("X3DTransformNode: No runtime context found!"),this._trafo=null,this._needCssStyleUpdates=!0}),{tick:function(e){var t=this._xmlNode;if(t&amp;&amp;(t.ontransform||t.hasAttribute("ontransform")||this._listeners.transform)){var i=this.getCurrentTransform(),s={target:t,type:"transform",worldX:i._03,worldY:i._13,worldZ:i._23,cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0}};this.callEvtHandler("ontransform",s)}if(this._needCssStyleUpdates&amp;&amp;t){var r=x3dom.getStyle(t,"-webkit-transform")||x3dom.getStyle(t,"-moz-transform")||x3dom.getStyle(t,"-ms-transform")||x3dom.getStyle(t,"transform");if(r&amp;&amp;"none"!=r)return this._trafo.setValueByStr(r),this.invalidateVolume(),!0;this._needCssStyleUpdates=!1}return!1},transformMatrix:function(e){return e.mult(this._trafo)},getVolume:function(){var e=this._graph.volume;if(!this.volumeValid()&amp;&amp;this._vf.render){this._graph.localMatrix=this._trafo;for(var t=0,i=this._childNodes.length;t&lt;i;t++){var s=this._childNodes[t];if(s&amp;&amp;!0===s._vf.render){var r=s.getVolume();r&amp;&amp;r.isValid()&amp;&amp;e.extendBounds(r.min,r.max)}}e.isValid()&amp;&amp;e.transform(this._trafo)}return e},doIntersect:function(e){var t=!1,i=this._trafo.inverse(),s=new x3dom.fields.SFVec3f(e.pos.x,e.pos.y,e.pos.z),r=new x3dom.fields.SFVec3f(e.dir.x,e.dir.y,e.dir.z);e.pos=i.multMatrixPnt(e.pos),e.dir=i.multMatrixVec(e.dir),e.hitObject&amp;&amp;(e.dist*=e.dir.length());for(var o=0;o&lt;this._childNodes.length;o++)this._childNodes[o]&amp;&amp;(t=this._childNodes[o].doIntersect(e)||t);return e.pos.setValues(s),e.dir.setValues(r),t&amp;&amp;(e.hitPoint=this._trafo.multMatrixPnt(e.hitPoint),e.dist*=e.dir.length()),t},parentRemoved:function(e){var t,i;if(0==this._parentNodes.length){var s=this.findX3DDoc();for(t=0,i=s._nodeBag.trans.length;t&lt;i;t++)s._nodeBag.trans[t]===this&amp;&amp;s._nodeBag.trans.splice(t,1)}for(t=0,i=this._childNodes.length;t&lt;i;t++)this._childNodes[t]&amp;&amp;this._childNodes[t].parentRemoved(this)}})),x3dom.registerNodeType("Transform","Grouping",defineClass(x3dom.nodeTypes.X3DTransformNode,(function(e){x3dom.nodeTypes.Transform.superClass.call(this,e),this.addField_SFVec3f(e,"center",0,0,0),this.addField_SFVec3f(e,"translation",0,0,0),this.addField_SFRotation(e,"rotation",0,0,1,0),this.addField_SFVec3f(e,"scale",1,1,1),this.addField_SFRotation(e,"scaleOrientation",0,0,1,0),this._trafo=x3dom.fields.SFMatrix4f.translation(this._vf.translation.add(this._vf.center)).mult(this._vf.rotation.toMatrix()).mult(this._vf.scaleOrientation.toMatrix()).mult(x3dom.fields.SFMatrix4f.scale(this._vf.scale)).mult(this._vf.scaleOrientation.toMatrix().inverse()).mult(x3dom.fields.SFMatrix4f.translation(this._vf.center.negate()))}),{fieldChanged:function(e){"center"==e||"translation"==e||"rotation"==e||"scale"==e||"scaleOrientation"==e?(this._trafo=x3dom.fields.SFMatrix4f.translation(this._vf.translation.add(this._vf.center)).mult(this._vf.rotation.toMatrix()).mult(this._vf.scaleOrientation.toMatrix()).mult(x3dom.fields.SFMatrix4f.scale(this._vf.scale)).mult(this._vf.scaleOrientation.toMatrix().inverse()).mult(x3dom.fields.SFMatrix4f.translation(this._vf.center.negate())),this.invalidateVolume()):"render"==e&amp;&amp;this.invalidateVolume()}})),x3dom.registerNodeType("MatrixTransform","Grouping",defineClass(x3dom.nodeTypes.X3DTransformNode,(function(e){x3dom.nodeTypes.MatrixTransform.superClass.call(this,e),this.addField_SFMatrix4f(e,"matrix",1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this._trafo=this._vf.matrix.transpose()}),{fieldChanged:function(e){"matrix"==e?(this._trafo=this._vf.matrix.transpose(),this.invalidateVolume()):"render"==e&amp;&amp;this.invalidateVolume()}})),x3dom.registerNodeType("Group","Grouping",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.Group.superClass.call(this,e)}))),x3dom.registerNodeType("Block","Grouping",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.Block.superClass.call(this,e),this.addField_MFString(e,"nameSpaceName",[])}))),x3dom.registerNodeType("StaticGroup","Grouping",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.StaticGroup.superClass.call(this,e),x3dom.debug.logWarning("StaticGroup erroneously also bakes parent transforms, if happens use Group node!"),this.addField_SFBool(e,"debug",!1),this.addField_SFBool(e,"showDebugBoxVolumes",!1),this.addField_SFString(e,"bvhType","jsBIH"),this.addField_SFInt32(e,"maxObjectsPerNode",1),this.addField_SFInt32(e,"maxDepth",-1),this.addField_SFFloat(e,"minRelativeBBoxSize",.01),this.needBvhRebuild=!0,this.drawableCollection=null,this.bvh=null}),{getMaxDepth:function(){return-1==this._vf.maxDepth?"jsBIH"==this._vf.bvhType?50:4:this._vf.maxDepth},collectDrawableObjects:function(e,t,i,s,r,o){if(i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),!((r=t.cull(e,this.graphState(),i,r))&lt;0)){var n,a;if(i?(this._graph.globalMatrix||(this._graph.globalMatrix=this.transformMatrix(e)),a=this._graph.globalMatrix):a=this.transformMatrix(e),this.needBvhRebuild){var h={viewArea:t.viewarea,sortTrans:t.sortTrans,viewMatrix:t.viewMatrix,projMatrix:t.projMatrix,sceneMatrix:t.sceneMatrix,frustumCulling:!1,smallFeatureThreshold:0,context:t.context};this.drawableCollection=new x3dom.DrawableCollection(h);var d,l=this._childNodes.length;for(d=0;d&lt;l;d++)(n=this._childNodes[d])&amp;&amp;n.collectDrawableObjects(a,this.drawableCollection,i,s,r,o);this.drawableCollection.concat();var u=this._nameSpace.doc._scene,f=new x3dom.bvh.Settings(this._vf.debug,this._vf.showDebugBoxVolumes,this._vf.bvhType,this._vf.maxObjectsPerNode,this.getMaxDepth(),this._vf.minRelativeBBoxSize);for(this.bvh="jsBIH"==this._vf.bvhType?new x3dom.bvh.BIH(u,f):new x3dom.bvh.Culler(this.drawableCollection,u,f),(this._vf.debug||this._vf.showDebugBoxVolumes)&amp;&amp;(this.bvh=new x3dom.bvh.DebugDecorator(this.bvh,u,f)),l=this.drawableCollection.length,d=0;d&lt;l;d++)this.bvh.addDrawable(this.drawableCollection.get(d));this.bvh.compile(),this._vf.debug&amp;&amp;this.bvh.showCompileStats(),this.needBvhRebuild=!1}x3dom.Utils.startMeasure("bvhTraverse"),this.bvh.collectDrawables(t);var c=x3dom.Utils.stopMeasure("bvhTraverse");this._nameSpace.doc.ctx.x3dElem.runtime.addMeasurement("BVH",c),this.bvh.showTraverseStats(this._nameSpace.doc.ctx.x3dElem.runtime)}}})),x3dom.registerNodeType("RemoteSelectionGroup","Grouping",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.RemoteSelectionGroup.superClass.call(this,e),this.addField_MFString(e,"url",["ws://localhost:35668/cstreams/0"]),this.addField_MFString(e,"label",[]),this.addField_SFInt32(e,"maxRenderedIds",-1),this.addField_SFBool(e,"reconnect",!0),this.addField_SFFloat(e,"scaleRenderedIdsOnMove",1),this.addField_SFBool(e,"enableCulling",!0),this.addField_MFString(e,"invisibleNodes",[]),this._idList=[],this._websocket=null,this._nameObjMap={},this._createTime=[],this._visibleList=[],e?this.initializeSocket():x3dom.debug.logWarning("RemoteSelectionGroup: No runtime context found!")}),{initializeSocket:function(){var e=this;if("WebSocket"in window){var t="ws://localhost:35668/cstreams/0";this._vf.url.length&amp;&amp;this._vf.url[0].length&amp;&amp;(t=this._vf.url[0]),this._websocket=new WebSocket(t),this._websocket._lastMsg=null,this._websocket._lastData="",this._websocket.onopen=function(t){x3dom.debug.logInfo("WS Connected");var i=e._nameSpace.doc._viewarea.getViewMatrix();this._lastMsg=i.toGL().toString(),i=e._nameSpace.doc._viewarea.getProjectionMatrix(),this._lastMsg+=","+i.toGL().toString(),this.send(this._lastMsg),x3dom.debug.logInfo("WS Sent: "+this._lastMsg),this._lastMsg="",this._lastData=""},this._websocket.onclose=function(t){x3dom.debug.logInfo("WS Disconnected"),e._vf.reconnect&amp;&amp;window.setTimeout((function(){e.initializeSocket()}),2e3)},this._websocket.onmessage=function(t){if(e._vf.maxRenderedIds&lt;0)e._idList=x3dom.fields.MFString.parse(t.data);else if(e._vf.maxRenderedIds&gt;0){e._idList=[];for(var i=x3dom.fields.MFString.parse(t.data),s=Math.min(i.length,Math.abs(e._vf.maxRenderedIds)),r=0;r&lt;s;++r)e._idList[r]=i[r]}0!=e._vf.maxRenderedIds&amp;&amp;this._lastData!=t.data&amp;&amp;(this._lastData=t.data,e._nameSpace.doc.needRender=!0,e.invalidateVolume())},this._websocket.onerror=function(e){x3dom.debug.logError(e.data)},this._websocket.updateCamera=function(){var t=e._nameSpace.doc._viewarea.getViewMatrix(),i=t.toGL().toString();i+=","+(t=e._nameSpace.doc._viewarea.getProjectionMatrix()).toGL().toString(),null!=this._lastMsg&amp;&amp;this._lastMsg!=i&amp;&amp;(this._lastMsg=i,this.send(i))}}else x3dom.debug.logError("Browser has no WebSocket support!")},nodeChanged:function(){var e=this._vf.label.length;this._nameObjMap={},this._createTime=new Array(e),this._visibleList=new Array(e);for(var t=0;t&lt;e;++t){var i=this._childNodes[t];i&amp;&amp;x3dom.isa(i,x3dom.nodeTypes.X3DShapeNode)?(this._nameObjMap[this._vf.label[t]]={shape:i,pos:t},this._visibleList[t]=!0):(this._visibleList[t]=!1,x3dom.debug.logError("Invalid children: "+this._vf.label[t])),this._createTime[t]=0}this.invalidateVolume(),x3dom.debug.logInfo("RemoteSelectionGroup has "+e+" entries.")},fieldChanged:function(e){if("url"==e)this._websocket&amp;&amp;(this._websocket.close(),this._websocket=null),this.initializeSocket();else if("invisibleNodes"==e){for(var t=0,i=this._vf.label.length;t&lt;i;++t){var s=this._childNodes[t];if(s&amp;&amp;x3dom.isa(s,x3dom.nodeTypes.X3DShapeNode)){this._visibleList[t]=!0;for(var r=0,o=this._vf.invisibleNodes.length;r&lt;o;++r){var n=this._vf.invisibleNodes[r],a=n.lastIndexOf("*"),h=!1;if(a&gt;0&amp;&amp;(n=n.substring(0,a),h=!0),!(n.length&lt;=1)&amp;&amp;(h&amp;&amp;0==this._vf.label[t].indexOf(n)||this._vf.label[t]==n)){this._visibleList[t]=!1;break}}}else this._visibleList[t]=!1}this.invalidateVolume()}else"render"==e&amp;&amp;this.invalidateVolume()},getNumRenderedObjects:function(e,t){var i=e;if(this._vf.maxRenderedIds&gt;0){var s=Math.max(this._vf.maxRenderedIds,16),r=1;t&amp;&amp;(r=Math.min(this._vf.scaleRenderedIdsOnMove,1)),s=Math.max(Math.round(r*s),0),i=Math.min(i,s)}return i},collectDrawableObjects:function(e,t,i,s,r,o){if(i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),!((r=t.cull(e,this.graphState(),i,r))&lt;=0)){var n,a,h=this._nameSpace.doc._viewarea.isMovingOrAnimating(),d=(new Date).getTime(),l=this._childNodes.length;if(this._vf.enableCulling){if(this._websocket&amp;&amp;this._websocket.updateCamera(),this._vf.label.length){for(a=this.getNumRenderedObjects(this._idList.length,h),n=0;n&lt;a;n++){var u=this._nameObjMap[this._idList[n]];u&amp;&amp;u.shape?(u.shape.collectDrawableObjects(e,t,i,s,r,o),this._createTime[u.pos]=d):x3dom.debug.logError("Invalid label: "+this._idList[n])}for(n=0;n&lt;this._childNodes.length;n++)this._childNodes[n]&amp;&amp;!h&amp;&amp;this._createTime[n]&gt;0&amp;&amp;d-this._createTime[n]&gt;1e4&amp;&amp;this._childNodes[n]._cleanupGLObjects&amp;&amp;(this._childNodes[n]._cleanupGLObjects(!0),this._createTime[n]=0)}}else{a=this.getNumRenderedObjects(l,h);var f=0;for(n=0;n&lt;l;n++){var c=this._childNodes[n];if(c){var m=!0;this._visibleList[n]&amp;&amp;f&lt;a&amp;&amp;c.collectDrawableObjects(e,t,i,s,r,o)&amp;&amp;(this._createTime[n]=d,f++,m=!1),m&amp;&amp;!h&amp;&amp;this._createTime[n]&gt;0&amp;&amp;d-this._createTime[n]&gt;1e4&amp;&amp;c._cleanupGLObjects&amp;&amp;(c._cleanupGLObjects(!0),this._createTime[n]=0)}}}}}})),x3dom.registerNodeType("Scene","Grouping",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.Scene.superClass.call(this,e),this.addField_SFString(e,"pickMode","idBuf"),this.addField_SFBool(e,"doPickPass",!0),this.addField_SFString(e,"shadowObjectIdMapping",""),this._lastMin=new x3dom.fields.SFVec3f(0,0,0),this._lastMax=new x3dom.fields.SFVec3f(1,1,1),this._shadowIdMap=null,this.loadMapping(),this._multiPartMap=null}),{fieldChanged:function(e){"shadowObjectIdMapping"==e&amp;&amp;this.loadMapping()},updateVolume:function(){var e=this.getVolume();e.isValid()&amp;&amp;(this._lastMin=x3dom.fields.SFVec3f.copy(e.min),this._lastMax=x3dom.fields.SFVec3f.copy(e.max))},loadMapping:function loadMapping(){if(this._shadowIdMap=null,0!=this._vf.shadowObjectIdMapping.length){var that=this,xhr=new XMLHttpRequest;xhr.open("GET",this._nameSpace.getURL(this._vf.shadowObjectIdMapping),!0),x3dom.RequestManager.addRequest(xhr),xhr.onload=function(){that._shadowIdMap=eval("("+xhr.response+")"),that._shadowIdMap&amp;&amp;that._shadowIdMap.mapping?x3dom.debug.assert(that._shadowIdMap.maxID&lt;=that._shadowIdMap.mapping.length,"Too few ID map entries in "+that._vf.shadowObjectIdMapping+", length of mapping array is only "+that._shadowIdMap.mapping.length+" instead of "+that._shadowIdMap.ids.length+"!"):x3dom.debug.logWarning("Invalid ID map: "+that._vf.shadowObjectIdMapping)}}}})),x3dom.BindableStack=function(e,t,i,s){this._doc=e,this._type=t,this._defaultType=i,this._defaultRoot=null,this._getter=s,this._bindBag=[],this._bindStack=[]},x3dom.BindableStack.prototype.top=function(){return this._bindStack.length&gt;0?this._bindStack[this._bindStack.length-1]:null},x3dom.BindableStack.prototype.push=function(e){var t=this.top();t!==e&amp;&amp;(t&amp;&amp;t.deactivate(),this._bindStack.push(e),e.activate(t))},x3dom.BindableStack.prototype.replaceTop=function(e){var t=this.top();t!==e&amp;&amp;t&amp;&amp;(t.deactivate(),this._bindStack[this._bindStack.length-1]=e,e.activate(t))},x3dom.BindableStack.prototype.pop=function(e){var t;return e&amp;&amp;e!==(t=this.top())?null:((t=this._bindStack.pop())&amp;&amp;t.deactivate(),t)},x3dom.BindableStack.prototype.switchTo=function(e){var t=this.getActive(),i=this._bindBag.length,s=0,r=0,o=-1;if(!(i&lt;=1)){switch(e){case"first":s=this._bindBag[0];break;case"last":s=this._bindBag[i-1];break;default:for(r=0;r&lt;i;r++)if(this._bindBag[r]==t){o=r;break}if(o&gt;=0)for(r=o;!s&amp;&amp;(r="next"==e?r&lt;i-1?r+1:0:r&gt;0?r-1:i-1)!=o;)this._bindBag[r]._vf.description.length&gt;=0&amp;&amp;(s=this._bindBag[r])}s?this.replaceTop(s):x3dom.debug.logWarning("Cannot switch bindable; no other bindable with description found.")}},x3dom.BindableStack.prototype.getActive=function(){if(0===this._bindStack.length){if(0===this._bindBag.length)if(this._defaultRoot){x3dom.debug.logInfo("create new "+this._defaultType._typeName+" for "+this._type._typeName+"-stack");var e=new this._defaultType({doc:this._doc,nameSpace:this._defaultRoot._nameSpace,autoGen:!0});this._defaultRoot.addChild(e),e.nodeChanged()}else x3dom.debug.logError("stack without defaultRoot");else x3dom.debug.logInfo("activate first "+this._type._typeName+" for "+this._type._typeName+"-stack");this._bindStack.push(this._bindBag[0]),this._bindBag[0].activate()}return this._bindStack[this._bindStack.length-1]},x3dom.BindableBag=function(e){this._stacks=[],this.addType("X3DViewpointNode","Viewpoint","getViewpoint",e),this.addType("X3DNavigationInfoNode","NavigationInfo","getNavigationInfo",e),this.addType("X3DBackgroundNode","Background","getBackground",e),this.addType("X3DFogNode","Fog","getFog",e),this.addType("X3DEnvironmentNode","Environment","getEnvironment",e)},x3dom.BindableBag.prototype.addType=function(e,t,i,s){var r=x3dom.nodeTypes[e],o=x3dom.nodeTypes[t];if(r&amp;&amp;o){var n=new x3dom.BindableStack(s,r,o,i);this._stacks.push(n)}else x3dom.debug.logWarning("Invalid Bindable type/defaultType: "+e+"/"+o)},x3dom.BindableBag.prototype.setRefNode=function(e){Array.forEach(this._stacks,(function(t){t._defaultRoot=e,e[t._getter]=function(){return t.getActive()}}))},x3dom.BindableBag.prototype.addBindable=function(e){for(var t=0,i=this._stacks.length;t&lt;i;t++){var s=this._stacks[t];if(x3dom.isa(e,s._type)){x3dom.debug.logInfo("register "+e.typeName()+"Bindable "+e._DEF+"/"+e._vf.description),s._bindBag.push(e);var r=s.top();if(r&amp;&amp;r._autoGen){s.replaceTop(e);for(var o=0,n=s._bindBag.length;o&lt;n;o++)if(s._bindBag[o]===r){s._bindBag.splice(o,1);break}s._defaultRoot.removeChild(r)}return s}}return x3dom.debug.logError(e.typeName()+" is not a valid bindable"),null},x3dom.registerNodeType("X3DGeometryNode","Rendering",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.X3DGeometryNode.superClass.call(this,e),this.addField_SFBool(e,"solid",!0),this.addField_SFBool(e,"ccw",!0),this.addField_SFBool(e,"useGeoCache",!0),this.addField_SFBool(e,"lit",!0),this._mesh=new x3dom.Mesh(this)}),{getVolume:function(){return this._mesh.getVolume()},invalidateVolume:function(){this._mesh.invalidate()},getCenter:function(){return this._mesh.getCenter()},getDiameter:function(){return this._mesh.getDiameter()},doIntersect:function(e){return this._mesh.doIntersect(e)},forceUpdateCoverage:function(){return!1},hasIndexOffset:function(){return!1},getColorTexture:function(){return null},getColorTextureURL:function(){return null},parentAdded:function(e){x3dom.isa(e,x3dom.nodeTypes.X3DShapeNode)&amp;&amp;(e._cleanupGLObjects&amp;&amp;e._cleanupGLObjects(!0),e.setAllDirty(),e.invalidateVolume())},needLighting:function(){var e=this._mesh._primType.indexOf("TRIANGLE")&gt;=0;return this._vf.lit&amp;&amp;e}})),x3dom.registerNodeType("Mesh","Rendering",defineClass(x3dom.nodeTypes.X3DGeometryNode,(function(e){x3dom.nodeTypes.Mesh.superClass.call(this,e),this.addField_SFString(e,"primType","triangle"),this.addField_MFInt32(e,"index",[]),this.addField_MFNode("vertexAttributes",x3dom.nodeTypes.X3DVertexAttributeNode)}),{nodeChanged:function(){var e,t=(new Date).getTime(),i=this._cf.vertexAttributes.nodes.length;for(e=0;e&lt;i;e++){var s=this._cf.vertexAttributes.nodes[e]._vf.name;switch(s.toLowerCase()){case"position":this._mesh._positions[0]=this._cf.vertexAttributes.nodes[e]._vf.value.toGL();break;case"normal":this._mesh._normals[0]=this._cf.vertexAttributes.nodes[e]._vf.value.toGL();break;case"texcoord":this._mesh._texCoords[0]=this._cf.vertexAttributes.nodes[e]._vf.value.toGL();break;case"color":this._mesh._colors[0]=this._cf.vertexAttributes.nodes[e]._vf.value.toGL();break;default:this._mesh._dynamicFields[s]={},this._mesh._dynamicFields[s].numComponents=this._cf.vertexAttributes.nodes[e]._vf.numComponents,this._mesh._dynamicFields[s].value=this._cf.vertexAttributes.nodes[e]._vf.value.toGL()}}this._mesh._indices[0]=this._vf.index.toGL(),this.invalidateVolume(),this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3;var r=(new Date).getTime()-t;x3dom.debug.logWarning("Mesh load time: "+r+" ms")}})),x3dom.registerNodeType("PointSet","Rendering",defineClass(x3dom.nodeTypes.X3DGeometryNode,(function(e){x3dom.nodeTypes.PointSet.superClass.call(this,e),this.addField_SFNode("coord",x3dom.nodeTypes.X3DCoordinateNode),this.addField_SFNode("color",x3dom.nodeTypes.X3DColorNode),this._mesh._primType="POINTS"}),{nodeChanged:function(){var e=(new Date).getTime(),t=this._cf.coord.node;x3dom.debug.assert(t,"PointSet without coord node!");var i=t.getPoints(),s=3,r=this._cf.color.node,o=new x3dom.fields.MFColor;r&amp;&amp;(o=r._vf.color,x3dom.debug.assert(i.length==o.length,"Size of color and coord array differs!"),x3dom.isa(r,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(s=4)),this._mesh._numColComponents=s,this._mesh._lit=!1,this._mesh._indices[0]=[],this._mesh._positions[0]=i.toGL(),this._mesh._colors[0]=o.toGL(),this._mesh._normals[0]=[],this._mesh._texCoords[0]=[],this.invalidateVolume(),this._mesh._numCoords=this._mesh._positions[0].length/3;(new Date).getTime()},fieldChanged:function(e){var t=null;"coord"==e?(t=this._cf.coord.node.getPoints(),this._mesh._positions[0]=t.toGL(),this.invalidateVolume(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}))):"color"==e&amp;&amp;(t=this._cf.color.node._vf.color,this._mesh._colors[0]=t.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0})))}})),x3dom.registerNodeType("X3DComposedGeometryNode","Rendering",defineClass(x3dom.nodeTypes.X3DGeometryNode,(function(e){x3dom.nodeTypes.X3DComposedGeometryNode.superClass.call(this,e),this.addField_SFBool(e,"colorPerVertex",!0),this.addField_SFBool(e,"normalPerVertex",!0),this.addField_SFString(e,"normalUpdateMode","fast"),this.addField_MFNode("attrib",x3dom.nodeTypes.X3DVertexAttributeNode),this.addField_SFNode("coord",x3dom.nodeTypes.X3DCoordinateNode),this.addField_SFNode("normal",x3dom.nodeTypes.Normal),this.addField_SFNode("color",x3dom.nodeTypes.X3DColorNode),this.addField_SFNode("texCoord",x3dom.nodeTypes.X3DTextureCoordinateNode)}),{handleAttribs:function(){var e,t=this._cf.attrib.nodes.length;for(e=0;e&lt;t;e++){var i=this._cf.attrib.nodes[e]._vf.name;switch(i.toLowerCase()){case"position":this._mesh._positions[0]=this._cf.attrib.nodes[e]._vf.value.toGL();break;case"normal":this._mesh._normals[0]=this._cf.attrib.nodes[e]._vf.value.toGL();break;case"texcoord":this._mesh._texCoords[0]=this._cf.attrib.nodes[e]._vf.value.toGL();break;case"color":this._mesh._colors[0]=this._cf.attrib.nodes[e]._vf.value.toGL();break;default:this._mesh._dynamicFields[i]={},this._mesh._dynamicFields[i].numComponents=this._cf.attrib.nodes[e]._vf.numComponents,this._mesh._dynamicFields[i].value=this._cf.attrib.nodes[e]._vf.value.toGL()}}}})),x3dom.registerNodeType("LineSet","Rendering",defineClass(x3dom.nodeTypes.X3DGeometryNode,(function(e){x3dom.nodeTypes.LineSet.superClass.call(this,e),this.addField_MFInt32(e,"vertexCount",[]),this.addField_MFNode("attrib",x3dom.nodeTypes.X3DVertexAttributeNode),this.addField_SFNode("coord",x3dom.nodeTypes.X3DCoordinateNode),this.addField_SFNode("color",x3dom.nodeTypes.X3DColorNode),this._mesh._primType="LINES",x3dom.Utils.needLineWidth=!0}),{nodeChanged:function(){var e=this._cf.coord.node;x3dom.debug.assert(e);var t=e.getPoints();this._mesh._positions[0]=t.toGL();var i=this._cf.color.node;if(i){var s=i._vf.color;this._mesh._colors[0]=s.toGL(),this._mesh._numColComponents=3,x3dom.isa(i,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(this._mesh._numColComponents=4)}var r=0;this._mesh._indices[0]=[];for(var o=0,n=this._vf.vertexCount.length;o&lt;n;o++){var a=this._vf.vertexCount[o];if(a&lt;2){x3dom.debug.logError("LineSet.vertexCount must not be smaller than 2!");break}for(var h=a-2;h&gt;=0;h--)this._mesh._indices[0].push(r++,r),0==h&amp;&amp;r++}},fieldChanged:function(e){if("coord"==e){var t=this._cf.coord.node.getPoints();this._mesh._positions[0]=t.toGL(),this.invalidateVolume(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}))}else if("color"==e){var i=this._cf.color.node._vf.color;this._mesh._colors[0]=i.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0}))}}})),x3dom.registerNodeType("IndexedLineSet","Rendering",defineClass(x3dom.nodeTypes.X3DGeometryNode,(function(e){x3dom.nodeTypes.IndexedLineSet.superClass.call(this,e),this.addField_SFBool(e,"colorPerVertex",!0),this.addField_MFNode("attrib",x3dom.nodeTypes.X3DVertexAttributeNode),this.addField_SFNode("coord",x3dom.nodeTypes.X3DCoordinateNode),this.addField_SFNode("color",x3dom.nodeTypes.X3DColorNode),this.addField_MFInt32(e,"coordIndex",[]),this.addField_MFInt32(e,"colorIndex",[]),this._mesh._primType="LINES",x3dom.Utils.needLineWidth=!0}),{_buildGeometry:function(){var e,t,i=(new Date).getTime(),s=this._vf.coordIndex,r=this._vf.colorIndex,o=!1,n=!1,a=this._vf.colorPerVertex;r.length==s.length&amp;&amp;(n=!0);var h=this._cf.coord.node;x3dom.debug.assert(h),e=h.getPoints();var d,l,u,f,c,m,_,p,x=3,g=this._cf.color.node;if(g?(o=!0,t=g._vf.color,x3dom.isa(g,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(x=4)):o=!1,this._mesh._indices[0]=[],this._mesh._positions[0]=[],this._mesh._colors[0]=[],o&amp;&amp;n||e.length&gt;x3dom.Utils.maxIndexableCoords){for(l=0,u=0,f=0,d=0;d&lt;s.length;++d)if(!(s[d]&gt;e.length-1))if(-1!==s[d])switch(n&amp;&amp;x3dom.debug.assert(-1!=r[d]),l){case 0:c=+s[d],_=n&amp;&amp;a?+r[d]:c,l=1;break;case 1:m=+s[d],p=n&amp;&amp;a?+r[d]:n&amp;&amp;!a?+r[f]:m,this._mesh._indices[0].push(u++,u++),this._mesh._positions[0].push(e[c].x),this._mesh._positions[0].push(e[c].y),this._mesh._positions[0].push(e[c].z),this._mesh._positions[0].push(e[m].x),this._mesh._positions[0].push(e[m].y),this._mesh._positions[0].push(e[m].z),o&amp;&amp;(a||(_=p),this._mesh._colors[0].push(t[_].r),this._mesh._colors[0].push(t[_].g),this._mesh._colors[0].push(t[_].b),this._mesh._colors[0].push(t[p].r),this._mesh._colors[0].push(t[p].g),this._mesh._colors[0].push(t[p].b)),l=2,f++;break;case 2:c=m,_=p,m=+s[d],p=n&amp;&amp;a?+r[d]:n&amp;&amp;!a?+r[f]:m,this._mesh._indices[0].push(u++,u++),this._mesh._positions[0].push(e[c].x),this._mesh._positions[0].push(e[c].y),this._mesh._positions[0].push(e[c].z),this._mesh._positions[0].push(e[m].x),this._mesh._positions[0].push(e[m].y),this._mesh._positions[0].push(e[m].z),o&amp;&amp;(a||(_=p),this._mesh._colors[0].push(t[_].r),this._mesh._colors[0].push(t[_].g),this._mesh._colors[0].push(t[_].b),this._mesh._colors[0].push(t[p].r),this._mesh._colors[0].push(t[p].g),this._mesh._colors[0].push(t[p].b)),f++}else l=0;e.length&gt;x3dom.Utils.maxIndexableCoords&amp;&amp;this._mesh.splitMesh(2)}else{var v=s.length;for(l=0,d=0;d&lt;v;++d)if(-1!=s[d])switch(l){case 0:c=+s[d],l=1;break;case 1:m=+s[d],l=2,this._mesh._indices[0].push(c,m);break;case 2:c=m,m=+s[d],this._mesh._indices[0].push(c,m)}else l=0;this._mesh._positions[0]=e.toGL(),o&amp;&amp;(this._mesh._colors[0]=t.toGL(),this._mesh._numColComponents=x)}for(this.invalidateVolume(),this._mesh._numCoords=0,d=0;d&lt;this._mesh._indices.length;d++)this._mesh._numCoords+=this._mesh._positions[d].length/3;(new Date).getTime()},nodeChanged:function(){this._buildGeometry()},fieldChanged:function(e){"coord"==e?(this._buildGeometry(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}))):"color"==e?(this._buildGeometry(),Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0}))):"coordIndex"==e?(this._buildGeometry(),Array.forEach(this._parentNodes,(function(e){e._dirty.indexes=!0,e.invalidateVolume()}))):"colorIndex"==e&amp;&amp;(this._buildGeometry(),Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0,e.invalidateVolume()})))}})),x3dom.registerNodeType("IndexedTriangleSet","Rendering",defineClass(x3dom.nodeTypes.X3DComposedGeometryNode,(function(e){x3dom.nodeTypes.IndexedTriangleSet.superClass.call(this,e),this.addField_MFInt32(e,"index",[])}),{nodeChanged:function(){var e=(new Date).getTime();this.handleAttribs();var t,i,s,r,o=this._vf.colorPerVertex,n=this._vf.normalPerVertex,a=this._vf.ccw,h=this._vf.index,d=!1,l=!1,u=!1,f=this._cf.coord.node;x3dom.debug.assert(f),t=f._vf.point;var c=this._cf.normal.node;c?(d=!0,i=c._vf.vector):d=!1;var m="",_=2,p=this._cf.texCoord.node;x3dom.isa(p,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;p._cf.texCoord.nodes.length&amp;&amp;(p=p._cf.texCoord.nodes[0]),p?p._vf.point?(l=!0,s=p._vf.point,x3dom.isa(p,x3dom.nodeTypes.TextureCoordinate3D)&amp;&amp;(_=3)):p._vf.mode&amp;&amp;(m=p._vf.mode):l=!1;var x,g,v,y,b,T,S,w,M,E,F,C,A,R,I,N,P,D=3,V=this._cf.color.node;for(V?(u=!0,r=V._vf.color,x3dom.isa(V,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(D=4)):u=!1,this._mesh._indices[0]=[],this._mesh._positions[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[],this._mesh._colors[0]=[];t.length%3&gt;0;)t.push(t.length-1);if(b=t.length,!n||!o||b&gt;x3dom.Utils.maxIndexableCoords){for(g=0,v=0,y=0,this._mesh._multiIndIndices=[],this._mesh._posSize=t.length,x=0;x&lt;h.length;++x)switch(x&gt;0&amp;&amp;x%3===0&amp;&amp;(g=0,y++),g){case 0:T=+h[x],n?M=T:n||(M=y),C=T,o?I=T:o||(I=y),g=1;break;case 1:S=+h[x],n?E=S:n||(E=y),A=S,o?N=S:o||(N=y),g=2;break;case 2:w=+h[x],n?F=w:n||(F=y),R=w,o?P=w:o||(P=y),g=3,this._mesh._indices[0].push(v++,v++,v++),this._mesh._positions[0].push(t[T].x),this._mesh._positions[0].push(t[T].y),this._mesh._positions[0].push(t[T].z),this._mesh._positions[0].push(t[S].x),this._mesh._positions[0].push(t[S].y),this._mesh._positions[0].push(t[S].z),this._mesh._positions[0].push(t[w].x),this._mesh._positions[0].push(t[w].y),this._mesh._positions[0].push(t[w].z),d?(this._mesh._normals[0].push(i[M].x),this._mesh._normals[0].push(i[M].y),this._mesh._normals[0].push(i[M].z),this._mesh._normals[0].push(i[E].x),this._mesh._normals[0].push(i[E].y),this._mesh._normals[0].push(i[E].z),this._mesh._normals[0].push(i[F].x),this._mesh._normals[0].push(i[F].y),this._mesh._normals[0].push(i[F].z)):this._mesh._multiIndIndices.push(T,S,w),u&amp;&amp;(this._mesh._colors[0].push(r[I].r),this._mesh._colors[0].push(r[I].g),this._mesh._colors[0].push(r[I].b),4===D&amp;&amp;this._mesh._colors[0].push(r[I].a),this._mesh._colors[0].push(r[N].r),this._mesh._colors[0].push(r[N].g),this._mesh._colors[0].push(r[N].b),4===D&amp;&amp;this._mesh._colors[0].push(r[N].a),this._mesh._colors[0].push(r[P].r),this._mesh._colors[0].push(r[P].g),this._mesh._colors[0].push(r[P].b),4===D&amp;&amp;this._mesh._colors[0].push(r[P].a)),l&amp;&amp;(this._mesh._texCoords[0].push(s[C].x),this._mesh._texCoords[0].push(s[C].y),3===_&amp;&amp;this._mesh._texCoords[0].push(s[C].z),this._mesh._texCoords[0].push(s[A].x),this._mesh._texCoords[0].push(s[A].y),3===_&amp;&amp;this._mesh._texCoords[0].push(s[A].z),this._mesh._texCoords[0].push(s[R].x),this._mesh._texCoords[0].push(s[R].y),3===_&amp;&amp;this._mesh._texCoords[0].push(s[R].z))}d||this._mesh.calcNormals(n?Math.PI:0),l||this._mesh.calcTexCoords(m),this._mesh.splitMesh()}else{for(y=0,x=0;x&lt;h.length;x++)x&gt;0&amp;&amp;x%3===0&amp;&amp;y++,this._mesh._indices[0].push(h[x]),!n&amp;&amp;d&amp;&amp;(this._mesh._normals[0].push(i[y].x),this._mesh._normals[0].push(i[y].y),this._mesh._normals[0].push(i[y].z)),!o&amp;&amp;u&amp;&amp;(this._mesh._colors[0].push(r[y].r),this._mesh._colors[0].push(r[y].g),this._mesh._colors[0].push(r[y].b),4===D&amp;&amp;this._mesh._colors[0].push(r[y].a));this._mesh._positions[0]=t.toGL(),d?this._mesh._normals[0]=i.toGL():this._mesh.calcNormals(n?Math.PI:0,a),l?(this._mesh._texCoords[0]=s.toGL(),this._mesh._numTexComponents=_):this._mesh.calcTexCoords(m),u&amp;&amp;o&amp;&amp;(this._mesh._colors[0]=r.toGL(),this._mesh._numColComponents=D)}for(this.invalidateVolume(),this._mesh._numFaces=0,this._mesh._numCoords=0,x=0;x&lt;this._mesh._indices.length;x++)this._mesh._numFaces+=this._mesh._indices[x].length/3,this._mesh._numCoords+=this._mesh._positions[x].length/3;(new Date).getTime()},fieldChanged:function(e){var t=this._cf.coord.node._vf.point;if(t.length&gt;x3dom.Utils.maxIndexableCoords)x3dom.debug.logWarning("IndexedTriangleSet: fieldChanged with too many coordinates not yet implemented!");else if("coord"==e)this._mesh._positions[0]=t.toGL(),this.invalidateVolume(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}));else if("color"==e){if(t=this._cf.color.node._vf.color,this._vf.colorPerVertex)this._mesh._colors[0]=t.toGL();else if(!this._vf.colorPerVertex){var i=0,s=3;x3dom.isa(this._cf.color.node,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(s=4),this._mesh._colors[0]=[];for(var r=this._vf.index,o=0;o&lt;r.length;++o)o&gt;0&amp;&amp;o%3===0&amp;&amp;i++,this._mesh._colors[0].push(t[i].r),this._mesh._colors[0].push(t[i].g),this._mesh._colors[0].push(t[i].b),4===s&amp;&amp;this._mesh._colors[0].push(t[i].a)}Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0}))}else if("normal"==e){if(t=this._cf.normal.node._vf.vector,this._vf.normalPerVertex)this._mesh._normals[0]=t.toGL();else if(!this._vf.normalPerVertex){r=this._vf.index;this._mesh._normals[0]=[];for(i=0,o=0;o&lt;r.length;++o)o&gt;0&amp;&amp;o%3===0&amp;&amp;i++,this._mesh._normals[0].push(t[i].x),this._mesh._normals[0].push(t[i].y),this._mesh._normals[0].push(t[i].z)}Array.forEach(this._parentNodes,(function(e){e._dirty.normals=!0}))}else if("texCoord"==e){var n=this._cf.texCoord.node;x3dom.isa(n,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;n._cf.texCoord.nodes.length&amp;&amp;(n=n._cf.texCoord.nodes[0]),t=n._vf.point,this._mesh._texCoords[0]=t.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.texcoords=!0}))}}})),x3dom.registerNodeType("IndexedTriangleStripSet","Rendering",defineClass(x3dom.nodeTypes.X3DComposedGeometryNode,(function(e){x3dom.nodeTypes.IndexedTriangleStripSet.superClass.call(this,e),this.addField_MFInt32(e,"index",[]),this._hasIndexOffset=!1,this._indexOffset=null}),{hasIndexOffset:function(){return this._hasIndexOffset},nodeChanged:function(){this.handleAttribs();var e,t,i,s,r=!1,o=!1,n=!1,a=this._vf.colorPerVertex,h=this._vf.normalPerVertex,d=this._vf.index;d.length&amp;&amp;-1!=d[d.length-1]&amp;&amp;d.push(-1);var l=this._cf.coord.node;x3dom.debug.assert(l),e=l._vf.point;var u=this._cf.normal.node;u?(r=!0,t=u._vf.vector):r=!1;var f="",c=2,m=this._cf.texCoord.node;x3dom.isa(m,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;m._cf.texCoord.nodes.length&amp;&amp;(m=m._cf.texCoord.nodes[0]),m?m._vf.point?(o=!0,i=m._vf.point,x3dom.isa(m,x3dom.nodeTypes.TextureCoordinate3D)&amp;&amp;(c=3)):m._vf.mode&amp;&amp;(f=m._vf.mode):o=!1,this._mesh._numTexComponents=c;var _=3,p=this._cf.color.node;p?(n=!0,s=p._vf.color,x3dom.isa(p,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(_=4)):n=!1,this._mesh._numColComponents=_,this._mesh._indices[0]=[],this._mesh._positions[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[],this._mesh._colors[0]=[],this.invalidateVolume(),this._mesh._numFaces=0,this._mesh._numCoords=0;var x=0,g=0;if(r&amp;&amp;e.length&lt;=x3dom.Utils.maxIndexableCoords){this._hasIndexOffset=!0,this._indexOffset=[],this._mesh._primType="TRIANGLESTRIP";var v=[0];for(D=0;D&lt;d.length;D++)-1==d[D]?(x++,v.push(this._mesh._indices[0].length)):(this._mesh._indices[0].push(+d[D]),h||(this._mesh._normals[0].push(t[x].x),this._mesh._normals[0].push(t[x].y),this._mesh._normals[0].push(t[x].z)),a||(this._mesh._colors[0].push(s[x].r),this._mesh._colors[0].push(s[x].g),this._mesh._colors[0].push(s[x].b),4===_&amp;&amp;this._mesh._colors[0].push(s[x].a)));for(this._mesh._positions[0]=e.toGL(),h&amp;&amp;(this._mesh._normals[0]=t.toGL()),o?(this._mesh._texCoords[0]=i.toGL(),this._mesh._numTexComponents=c):x3dom.debug.logWarning("IndexedTriangleStripSet: no texCoords given and won't calculate!"),n&amp;&amp;(a&amp;&amp;(this._mesh._colors[0]=s.toGL()),this._mesh._numColComponents=_),D=1;D&lt;v.length;D++){var y=v[D]-v[D-1];this._indexOffset.push({count:y,offset:2*v[D-1]}),this._mesh._numFaces+=y-2}this._mesh._numCoords=this._mesh._positions[0].length/3}else{var b,T,S,w,M,E,F,C,A,R,I,N;this._hasIndexOffset=!1;for(var P=!1,D=1;D&lt;d.length-2;++D)-1!=d[D+1]?(P?(b=d[D],T=d[D-1],S=d[D+1]):(b=d[D-1],T=d[D],S=d[D+1]),P=!P,h?(w=b,M=T,E=S):h||(w=M=E=x),F=b,C=T,A=S,a?(R=b,I=T,N=S):a||(R=I=N=x),this._mesh._indices[0].push(g++,g++,g++),this._mesh._positions[0].push(e[b].x),this._mesh._positions[0].push(e[b].y),this._mesh._positions[0].push(e[b].z),this._mesh._positions[0].push(e[T].x),this._mesh._positions[0].push(e[T].y),this._mesh._positions[0].push(e[T].z),this._mesh._positions[0].push(e[S].x),this._mesh._positions[0].push(e[S].y),this._mesh._positions[0].push(e[S].z),r&amp;&amp;(this._mesh._normals[0].push(t[w].x),this._mesh._normals[0].push(t[w].y),this._mesh._normals[0].push(t[w].z),this._mesh._normals[0].push(t[M].x),this._mesh._normals[0].push(t[M].y),this._mesh._normals[0].push(t[M].z),this._mesh._normals[0].push(t[E].x),this._mesh._normals[0].push(t[E].y),this._mesh._normals[0].push(t[E].z)),n&amp;&amp;(this._mesh._colors[0].push(s[R].r),this._mesh._colors[0].push(s[R].g),this._mesh._colors[0].push(s[R].b),4===_&amp;&amp;this._mesh._colors[0].push(s[R].a),this._mesh._colors[0].push(s[I].r),this._mesh._colors[0].push(s[I].g),this._mesh._colors[0].push(s[I].b),4===_&amp;&amp;this._mesh._colors[0].push(s[I].a),this._mesh._colors[0].push(s[N].r),this._mesh._colors[0].push(s[N].g),this._mesh._colors[0].push(s[N].b),4===_&amp;&amp;this._mesh._colors[0].push(s[N].a)),o&amp;&amp;(this._mesh._texCoords[0].push(i[F].x),this._mesh._texCoords[0].push(i[F].y),3===c&amp;&amp;this._mesh._texCoords[0].push(i[F].z),this._mesh._texCoords[0].push(i[C].x),this._mesh._texCoords[0].push(i[C].y),3===c&amp;&amp;this._mesh._texCoords[0].push(i[C].z),this._mesh._texCoords[0].push(i[A].x),this._mesh._texCoords[0].push(i[A].y),3===c&amp;&amp;this._mesh._texCoords[0].push(i[A].z))):(D+=2,x++);for(r||this._mesh.calcNormals(Math.PI),o||this._mesh.calcTexCoords(f),this._mesh.splitMesh(),this.invalidateVolume(),D=0;D&lt;this._mesh._indices.length;D++)this._mesh._numFaces+=this._mesh._indices[D].length/3,this._mesh._numCoords+=this._mesh._positions[D].length/3}},fieldChanged:function(e){if("coord"==e||"normal"==e||"texCoord"==e||"color"==e){var t=this._cf.coord.node._vf.point;if(null===this._cf.normal.node||t.length&gt;x3dom.Utils.maxIndexableCoords){if("coord"==e){this._mesh._positions[0]=[],this._mesh._indices[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[];var i,s,r,o,n=!1,a=!1,h=!1,d=this._vf.colorPerVertex,l=this._vf.normalPerVertex,u=this._vf.index,f=this._cf.coord.node;x3dom.debug.assert(f),i=f._vf.point;var c=this._cf.normal.node;c?(n=!0,s=c._vf.vector):n=!1;var m="",_=2,p=this._cf.texCoord.node;x3dom.isa(p,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;p._cf.texCoord.nodes.length&amp;&amp;(p=p._cf.texCoord.nodes[0]),p?p._vf.point?(a=!0,r=p._vf.point,x3dom.isa(p,x3dom.nodeTypes.TextureCoordinate3D)&amp;&amp;(_=3)):p._vf.mode&amp;&amp;(m=p._vf.mode):a=!1,this._mesh._numTexComponents=_;var x=3,g=this._cf.color.node;g?(h=!0,o=g._vf.color,x3dom.isa(g,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(x=4)):h=!1,this._mesh._numColComponents=x,this._mesh._indices[0]=[],this._mesh._positions[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[],this._mesh._colors[0]=[];var v,y,b,T,S,w,M,E,F,C=0,A=0,R=!1;if(n||a||h){for(var I=1;I&lt;u.length-2;++I)-1!=u[I+1]?(R?(v=u[I],y=u[I-1],b=u[I+1]):(v=u[I-1],y=u[I],b=u[I+1]),R=!R,l?(V=v,T=y,S=b):l||(V=T=S=C),O=v,w=y,M=b,d?(P=v,E=y,F=b):d||(P=E=F=C),this._mesh._indices[0].push(A++,A++,A++),this._mesh._positions[0].push(i[v].x),this._mesh._positions[0].push(i[v].y),this._mesh._positions[0].push(i[v].z),this._mesh._positions[0].push(i[y].x),this._mesh._positions[0].push(i[y].y),this._mesh._positions[0].push(i[y].z),this._mesh._positions[0].push(i[b].x),this._mesh._positions[0].push(i[b].y),this._mesh._positions[0].push(i[b].z),n&amp;&amp;(this._mesh._normals[0].push(s[V].x),this._mesh._normals[0].push(s[V].y),this._mesh._normals[0].push(s[V].z),this._mesh._normals[0].push(s[T].x),this._mesh._normals[0].push(s[T].y),this._mesh._normals[0].push(s[T].z),this._mesh._normals[0].push(s[S].x),this._mesh._normals[0].push(s[S].y),this._mesh._normals[0].push(s[S].z)),h&amp;&amp;(this._mesh._colors[0].push(o[P].r),this._mesh._colors[0].push(o[P].g),this._mesh._colors[0].push(o[P].b),4===x&amp;&amp;this._mesh._colors[0].push(o[P].a),this._mesh._colors[0].push(o[E].r),this._mesh._colors[0].push(o[E].g),this._mesh._colors[0].push(o[E].b),4===x&amp;&amp;this._mesh._colors[0].push(o[E].a),this._mesh._colors[0].push(o[F].r),this._mesh._colors[0].push(o[F].g),this._mesh._colors[0].push(o[F].b),4===x&amp;&amp;this._mesh._colors[0].push(o[F].a)),a&amp;&amp;(this._mesh._texCoords[0].push(r[O].x),this._mesh._texCoords[0].push(r[O].y),3===_&amp;&amp;this._mesh._texCoords[0].push(r[O].z),this._mesh._texCoords[0].push(r[w].x),this._mesh._texCoords[0].push(r[w].y),3===_&amp;&amp;this._mesh._texCoords[0].push(r[w].z),this._mesh._texCoords[0].push(r[M].x),this._mesh._texCoords[0].push(r[M].y),3===_&amp;&amp;this._mesh._texCoords[0].push(r[M].z))):(I+=2,C++);n||this._mesh.calcNormals(Math.PI),a||this._mesh.calcTexCoords(m),this._mesh.splitMesh()}else{for(R=!1,I=1;I&lt;u.length;++I)-1!=u[I+1]?(R?(this._mesh._indices[0].push(u[I]),this._mesh._indices[0].push(u[I-1]),this._mesh._indices[0].push(u[I+1])):(this._mesh._indices[0].push(u[I-1]),this._mesh._indices[0].push(u[I]),this._mesh._indices[0].push(u[I+1])),R=!R):I+=2;this._mesh._positions[0]=i.toGL(),n?this._mesh._normals[0]=s.toGL():this._mesh.calcNormals(Math.PI),a?(this._mesh._texCoords[0]=r.toGL(),this._mesh._numTexComponents=_):this._mesh.calcTexCoords(m),h&amp;&amp;(this._mesh._colors[0]=o.toGL(),this._mesh._numColComponents=x)}for(this.invalidateVolume(),this._mesh._numFaces=0,this._mesh._numCoords=0,I=0;I&lt;this._mesh._indices.length;I++)this._mesh._numFaces+=this._mesh._indices[I].length/3,this._mesh._numCoords+=this._mesh._positions[I].length/3;Array.forEach(this._parentNodes,(function(e){e.setAllDirty(),e.invalidateVolume()}))}else if("color"==e){var N=this._cf.color.node._vf.color,P=(C=0,E=F=0);x=3;x3dom.isa(this._cf.color.node,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(x=4),this._mesh._colors[0]=[];u=this._vf.index,R=!1;for(I=1;I&lt;u.length-2;++I)-1!=u[I+1]?(this._vf.colorPerVertex?(R?(P=u[I],E=u[I-1],F=u[I+1]):(P=u[I-1],E=u[I],F=u[I+1]),R=!R):this._vf.colorPerVertex||(P=E=F=C),this._mesh._colors[0].push(N[P].r),this._mesh._colors[0].push(N[P].g),this._mesh._colors[0].push(N[P].b),4===x&amp;&amp;this._mesh._colors[0].push(N[P].a),this._mesh._colors[0].push(N[E].r),this._mesh._colors[0].push(N[E].g),this._mesh._colors[0].push(N[E].b),4===x&amp;&amp;this._mesh._colors[0].push(N[E].a),this._mesh._colors[0].push(N[F].r),this._mesh._colors[0].push(N[F].g),this._mesh._colors[0].push(N[F].b),4===x&amp;&amp;this._mesh._colors[0].push(N[F].a)):(I+=2,C++);Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0}))}else if("normal"==e){var D=this._cf.normal.node._vf.vector,V=(C=0,T=S=0);this._mesh._normals[0]=[];u=this._vf.index,R=!1;for(I=1;I&lt;u.length-2;++I)-1!=u[I+1]?(this._vf.normalPerVertex?(R?(V=u[I],T=u[I-1],S=u[I+1]):(V=u[I-1],T=u[I],S=u[I+1]),R=!R):this._vf.normalPerVertex||(V=T=S=C),this._mesh._normals[0].push(D[V].x),this._mesh._normals[0].push(D[V].y),this._mesh._normals[0].push(D[V].z),this._mesh._normals[0].push(D[T].x),this._mesh._normals[0].push(D[T].y),this._mesh._normals[0].push(D[T].z),this._mesh._normals[0].push(D[S].x),this._mesh._normals[0].push(D[S].y),this._mesh._normals[0].push(D[S].z)):(I+=2,C++);Array.forEach(this._parentNodes,(function(e){e._dirty.normals=!0}))}else if("texCoord"==e){p=this._cf.texCoord.node;x3dom.isa(p,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;p._cf.texCoord.nodes.length&amp;&amp;(p=p._cf.texCoord.nodes[0]);var L=p._vf.point,O=w=M=0;_=2;x3dom.isa(p,x3dom.nodeTypes.TextureCoordinate3D)&amp;&amp;(_=3),this._mesh._texCoords[0]=[];u=this._vf.index,R=!1;for(I=1;I&lt;u.length-2;++I)-1!=u[I+1]?(R?(O=u[I],w=u[I-1],M=u[I+1]):(O=u[I-1],w=u[I],M=u[I+1]),R=!R,this._mesh._texCoords[0].push(L[O].x),this._mesh._texCoords[0].push(L[O].y),3===_&amp;&amp;this._mesh._texCoords[0].push(L[O].z),this._mesh._texCoords[0].push(L[w].x),this._mesh._texCoords[0].push(L[w].y),3===_&amp;&amp;this._mesh._texCoords[0].tex(N[w].z),this._mesh._texCoords[0].push(L[M].x),this._mesh._texCoords[0].push(L[M].y),3===_&amp;&amp;this._mesh._texCoords[0].push(L[M].z)):I+=2;Array.forEach(this._parentNodes,(function(e){e._dirty.texcoords=!0}))}}else if("coord"==e)this._mesh._positions[0]=t.toGL(),this.invalidateVolume(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}));else if("color"==e){if(t=this._cf.color.node._vf.color,this._vf.colorPerVertex)this._mesh._colors[0]=t.toGL();else if(!this._vf.colorPerVertex){C=0,x=3;x3dom.isa(this._cf.color.node,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(x=4),this._mesh._colors[0]=[];u=this._vf.index;for(I=0;I&lt;u.length;++I)-1!=u[I]?(this._mesh._colors[0].push(t[C].r),this._mesh._colors[0].push(t[C].g),this._mesh._colors[0].push(t[C].b),4===x&amp;&amp;this._mesh._colors[0].push(t[C].a)):C++}Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0}))}else if("normal"==e){if(t=this._cf.normal.node._vf.vector,this._vf.normalPerVertex)this._mesh._normals[0]=t.toGL();else if(!this._vf.normalPerVertex){u=this._vf.index;this._mesh._normals[0]=[];C=0;for(I=0;I&lt;u.length;++I)-1!=u[I]?(this._mesh._normals[0].push(t[C].x),this._mesh._normals[0].push(t[C].y),this._mesh._normals[0].push(t[C].z)):C++}Array.forEach(this._parentNodes,(function(e){e._dirty.normals=!0}))}else if("texCoord"==e){p=this._cf.texCoord.node;x3dom.isa(p,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;p._cf.texCoord.nodes.length&amp;&amp;(p=p._cf.texCoord.nodes[0]),t=p._vf.point,this._mesh._texCoords[0]=t.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.texcoords=!0}))}}else x3dom.debug.logWarning("IndexedTriangleStripSet: fieldChanged for "+e+" not yet implemented!")}})),x3dom.registerNodeType("TriangleSet","Rendering",defineClass(x3dom.nodeTypes.X3DComposedGeometryNode,(function(e){x3dom.nodeTypes.TriangleSet.superClass.call(this,e)}),{_buildGeometry:function(){var e,t,i,s,r=this._vf.colorPerVertex,o=this._vf.normalPerVertex,n=this._vf.ccw,a=!1,h=!1,d=!1,l=this._cf.coord.node;if(x3dom.debug.assert(l),!l||l._vf.point.length&lt;3)this._vf.render=!1;else{e=l._vf.point;var u=this._cf.normal.node;u?(a=!0,t=u._vf.vector):a=!1;var f="",c=2,m=this._cf.texCoord.node;x3dom.isa(m,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;m._cf.texCoord.nodes.length&amp;&amp;(m=m._cf.texCoord.nodes[0]),m?m._vf.point?(h=!0,i=m._vf.point,x3dom.isa(m,x3dom.nodeTypes.TextureCoordinate3D)&amp;&amp;(c=3)):m._vf.mode&amp;&amp;(f=m._vf.mode):h=!1;var _=3,p=this._cf.color.node;for(p?(d=!0,s=p._vf.color,x3dom.isa(p,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(_=4)):d=!1;e.length%3&gt;0;)e.pop();this._mesh._indices[0]=new Array(e.length),this._mesh._positions[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[],this._mesh._colors[0]=[];var x,g=e.length/3,v=0;for(x=0;x&lt;g;x++)this._mesh._indices[0][v]=v++,this._mesh._indices[0][v]=v++,this._mesh._indices[0][v]=v++,!o&amp;&amp;a&amp;&amp;(this._mesh._normals[0].push(t[x].x),this._mesh._normals[0].push(t[x].y),this._mesh._normals[0].push(t[x].z)),!r&amp;&amp;d&amp;&amp;(this._mesh._colors[0].push(s[x].r),this._mesh._colors[0].push(s[x].g),this._mesh._colors[0].push(s[x].b),4===_&amp;&amp;this._mesh._colors[0].push(s[x].a));this._mesh._positions[0]=e.toGL(),a?this._mesh._normals[0]=t.toGL():this._mesh.calcNormals(o?Math.PI:0,n),h?(this._mesh._texCoords[0]=i.toGL(),this._mesh._numTexComponents=c):this._mesh.calcTexCoords(f),d&amp;&amp;r&amp;&amp;(this._mesh._colors[0]=s.toGL(),this._mesh._numColComponents=_),this._mesh._numFaces=g,this._mesh._numCoords=e.length,this.invalidateVolume()}},nodeChanged:function(){this._buildGeometry()},fieldChanged:function(e){"coord"==e?(this._buildGeometry(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}))):"color"==e?(this._buildGeometry(),Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0}))):"normal"==e?(this._buildGeometry(),Array.forEach(this._parentNodes,(function(e){e._dirty.normals=!0}))):"texCoord"==e&amp;&amp;(this._buildGeometry(),Array.forEach(this._parentNodes,(function(e){e._dirty.texcoords=!0})))}})),x3dom.registerNodeType("X3DGeometricPropertyNode","Rendering",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.X3DGeometricPropertyNode.superClass.call(this,e)}))),x3dom.registerNodeType("X3DCoordinateNode","Rendering",defineClass(x3dom.nodeTypes.X3DGeometricPropertyNode,(function(e){x3dom.nodeTypes.X3DCoordinateNode.superClass.call(this,e)}),{fieldChanged:function(e){"coord"!==e&amp;&amp;"point"!==e||Array.forEach(this._parentNodes,(function(e){e.fieldChanged("coord")}))},parentAdded:function(e){e._mesh&amp;&amp;e._cf.coord.node!==this&amp;&amp;e.fieldChanged("coord")}})),x3dom.registerNodeType("Coordinate","Rendering",defineClass(x3dom.nodeTypes.X3DCoordinateNode,(function(e){x3dom.nodeTypes.Coordinate.superClass.call(this,e),this.addField_MFVec3f(e,"point",[])}),{getPoints:function(){return this._vf.point}})),x3dom.registerNodeType("Normal","Rendering",defineClass(x3dom.nodeTypes.X3DGeometricPropertyNode,(function(e){x3dom.nodeTypes.Normal.superClass.call(this,e),this.addField_MFVec3f(e,"vector",[])}),{fieldChanged:function(e){"normal"!==e&amp;&amp;"vector"!==e||Array.forEach(this._parentNodes,(function(e){e.fieldChanged("normal")}))},parentAdded:function(e){e._mesh&amp;&amp;e._cf.normal.node!==this&amp;&amp;e.fieldChanged("normal")}})),x3dom.registerNodeType("X3DColorNode","Rendering",defineClass(x3dom.nodeTypes.X3DGeometricPropertyNode,(function(e){x3dom.nodeTypes.X3DColorNode.superClass.call(this,e)}),{fieldChanged:function(e){"color"===e&amp;&amp;Array.forEach(this._parentNodes,(function(e){e.fieldChanged("color")}))},parentAdded:function(e){e._mesh&amp;&amp;e._cf.color.node!==this&amp;&amp;e.fieldChanged("color")}})),x3dom.registerNodeType("Color","Rendering",defineClass(x3dom.nodeTypes.X3DColorNode,(function(e){x3dom.nodeTypes.Color.superClass.call(this,e),this.addField_MFColor(e,"color",[])}))),x3dom.registerNodeType("ColorRGBA","Rendering",defineClass(x3dom.nodeTypes.X3DColorNode,(function(e){x3dom.nodeTypes.ColorRGBA.superClass.call(this,e),this.addField_MFColorRGBA(e,"color",[])}))),x3dom.registerNodeType("ParticleSet","Rendering",defineClass(x3dom.nodeTypes.PointSet,(function(e){x3dom.nodeTypes.ParticleSet.superClass.call(this,e),this.addField_SFString(e,"mode","ViewDirQuads"),this.addField_SFString(e,"drawOrder","Any"),this.addField_SFNode("normal",x3dom.nodeTypes.Normal),this.addField_MFVec3f(e,"size",[]),this.addField_MFInt32(e,"index",[]),this.addField_MFFloat(e,"textureZ",[]),this._mesh._primType="POINTS"}),{drawOrder:function(){return this._vf.drawOrder.toLowerCase()},nodeChanged:function(){var e=this._cf.coord.node;x3dom.debug.assert(e,"ParticleSet without coord node!");var t=e.getPoints(),i=3,s=this._cf.color.node,r=new x3dom.fields.MFColor;s&amp;&amp;(r=s._vf.color,x3dom.debug.assert(t.length==r.length,"Size of color and coord array differs!"),x3dom.isa(s,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(i=4));var o=this._cf.normal.node,n=new x3dom.fields.MFVec3f;o&amp;&amp;(n=o._vf.vector);var a=[];if("any"!=this.drawOrder()&amp;&amp;0==(a=this._vf.index.toGL()).length){var h,d=t.length;for(a=new Array(d),h=0;h&lt;d;h++)a[h]=h}this._mesh._numColComponents=i,this._mesh._lit=!1,this._mesh._indices[0]=a,this._mesh._positions[0]=t.toGL(),this._mesh._colors[0]=r.toGL(),this._mesh._normals[0]=n.toGL(),this._mesh._texCoords[0]=[],this.invalidateVolume(),this._mesh._numCoords=this._mesh._positions[0].length/3},fieldChanged:function(e){var t=null;if("index"==e)this._mesh._indices[0]=this._vf.index.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.indexes=!0}));else if("size"==e)Array.forEach(this._parentNodes,(function(e){e._dirty.specialAttribs=!0}));else if("coord"==e){t=this._cf.coord.node.getPoints(),this._mesh._positions[0]=t.toGL();var i=[];if("any"!=this.drawOrder()&amp;&amp;0==(i=this._vf.index.toGL()).length){var s,r=t.length;for(i=new Array(r),s=0;s&lt;r;s++)i[s]=s}this._mesh._indices[0]=i,this.invalidateVolume(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e._dirty.indexes=!0,e.invalidateVolume()}))}else"color"==e&amp;&amp;(t=this._cf.color.node._vf.color,this._mesh._colors[0]=t.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0})))}})),x3dom.registerNodeType("ClipPlane","Rendering",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.ClipPlane.superClass.call(this,e),this.addField_SFBool(e,"enabled",!0),this.addField_SFVec4f(e,"plane",0,1,0,0),this.addField_SFFloat(e,"cappingStrength",0),this.addField_SFColor(e,"cappingColor",1,1,1),this.addField_SFBool(e,"on",!0)}),{fieldChanged:function(e){},nodeChanged:function(){x3dom.nodeTypes.ClipPlane.count++},onRemove:function(){x3dom.nodeTypes.ClipPlane.count--},parentAdded:function(e){},parentRemoved:function(e){}})),x3dom.nodeTypes.ClipPlane.count=0,x3dom.registerNodeType("X3DAppearanceNode","Shape",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.X3DAppearanceNode.superClass.call(this,e)}))),x3dom.registerNodeType("Appearance","Shape",defineClass(x3dom.nodeTypes.X3DAppearanceNode,(function(e){x3dom.nodeTypes.Appearance.superClass.call(this,e),this.addField_SFNode("material",x3dom.nodeTypes.X3DMaterialNode),this.addField_SFNode("texture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("textureTransform",x3dom.nodeTypes.X3DTextureTransformNode),this.addField_SFNode("lineProperties",x3dom.nodeTypes.LineProperties),this.addField_SFNode("colorMaskMode",x3dom.nodeTypes.ColorMaskMode),this.addField_SFNode("blendMode",x3dom.nodeTypes.BlendMode),this.addField_SFNode("depthMode",x3dom.nodeTypes.DepthMode),this.addField_MFNode("shaders",x3dom.nodeTypes.X3DShaderNode),this.addField_SFString(e,"sortType","auto"),this.addField_SFInt32(e,"sortKey",0),this.addField_SFFloat(e,"alphaClipThreshold",.1),this._shader=null}),{fieldChanged:function(e){"alphaClipThreshold"==e&amp;&amp;Array.forEach(this._parentNodes,(function(e){e.setAppDirty()}))},nodeChanged:function(){this._cf.material.node,this._cf.shaders.nodes.length?this._shader=this._cf.shaders.nodes[0]:this._shader&amp;&amp;(this._shader=null),Array.forEach(this._parentNodes,(function(e){e.setAppDirty()})),this.checkSortType()},checkSortType:function(){"auto"==this._vf.sortType&amp;&amp;(this._cf.material.node&amp;&amp;(this._cf.material.node._vf.transparency&gt;0||this._cf.material.node._vf.backTransparency&amp;&amp;this._cf.material.node._vf.backTransparency&gt;0)||this._cf.texture.node&amp;&amp;this._cf.texture.node._vf.url.length&amp;&amp;this._cf.texture.node._vf.url[0].toLowerCase().indexOf(".png")&gt;=0?this._vf.sortType="transparent":this._vf.sortType="opaque")},texTransformMatrix:function(){return null===this._cf.textureTransform.node?x3dom.fields.SFMatrix4f.identity():this._cf.textureTransform.node.texTransformMatrix()},parentAdded:function(e){this!=x3dom.nodeTypes.Appearance._defaultNode&amp;&amp;e.setAppDirty()}})),x3dom.nodeTypes.Appearance.defaultNode=function(){return x3dom.nodeTypes.Appearance._defaultNode||(x3dom.nodeTypes.Appearance._defaultNode=new x3dom.nodeTypes.Appearance,x3dom.nodeTypes.Appearance._defaultNode.nodeChanged()),x3dom.nodeTypes.Appearance._defaultNode},x3dom.registerNodeType("X3DAppearanceChildNode","Shape",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.X3DAppearanceChildNode.superClass.call(this,e)}))),x3dom.registerNodeType("BlendMode","Shape",defineClass(x3dom.nodeTypes.X3DAppearanceChildNode,(function(e){x3dom.nodeTypes.BlendMode.superClass.call(this,e),this.addField_SFString(e,"srcFactor","src_alpha"),this.addField_SFString(e,"destFactor","one_minus_src_alpha"),this.addField_SFColor(e,"color",1,1,1),this.addField_SFFloat(e,"colorTransparency",0),this.addField_SFString(e,"alphaFunc","none"),this.addField_SFFloat(e,"alphaFuncValue",0),this.addField_SFString(e,"equation","none")}))),x3dom.registerNodeType("DepthMode","Shape",defineClass(x3dom.nodeTypes.X3DAppearanceChildNode,(function(e){x3dom.nodeTypes.DepthMode.superClass.call(this,e),this.addField_SFBool(e,"enableDepthTest",!0),this.addField_SFString(e,"depthFunc","none"),this.addField_SFBool(e,"readOnly",!1),this.addField_SFFloat(e,"zNearRange",-1),this.addField_SFFloat(e,"zFarRange",-1)}))),x3dom.registerNodeType("ColorMaskMode","Shape",defineClass(x3dom.nodeTypes.X3DAppearanceChildNode,(function(e){x3dom.nodeTypes.ColorMaskMode.superClass.call(this,e),this.addField_SFBool(e,"maskR",!0),this.addField_SFBool(e,"maskG",!0),this.addField_SFBool(e,"maskB",!0),this.addField_SFBool(e,"maskA",!0)}))),x3dom.registerNodeType("LineProperties","Shape",defineClass(x3dom.nodeTypes.X3DAppearanceChildNode,(function(e){x3dom.nodeTypes.LineProperties.superClass.call(this,e),this.addField_SFBool(e,"applied",!0),this.addField_SFInt32(e,"linetype",1),this.addField_SFFloat(e,"linewidthScaleFactor",0)}))),x3dom.registerNodeType("X3DMaterialNode","Shape",defineClass(x3dom.nodeTypes.X3DAppearanceChildNode,(function(e){x3dom.nodeTypes.X3DMaterialNode.superClass.call(this,e)}))),x3dom.registerNodeType("Material","Shape",defineClass(x3dom.nodeTypes.X3DMaterialNode,(function(e){x3dom.nodeTypes.Material.superClass.call(this,e),this.addField_SFFloat(e,"ambientIntensity",.2),this.addField_SFColor(e,"diffuseColor",.8,.8,.8),this.addField_SFColor(e,"emissiveColor",0,0,0),this.addField_SFFloat(e,"shininess",.2),this.addField_SFColor(e,"specularColor",0,0,0),this.addField_SFFloat(e,"transparency",0)}),{fieldChanged:function(e){"ambientIntensity"!=e&amp;&amp;"diffuseColor"!=e&amp;&amp;"emissiveColor"!=e&amp;&amp;"shininess"!=e&amp;&amp;"specularColor"!=e&amp;&amp;"transparency"!=e||Array.forEach(this._parentNodes,(function(e){Array.forEach(e._parentNodes,(function(e){e._dirty.material=!0})),e.checkSortType()}))}})),x3dom.nodeTypes.Material.defaultNode=function(){return x3dom.nodeTypes.Material._defaultNode||(x3dom.nodeTypes.Material._defaultNode=new x3dom.nodeTypes.Material,x3dom.nodeTypes.Material._defaultNode.nodeChanged()),x3dom.nodeTypes.Material._defaultNode},x3dom.registerNodeType("TwoSidedMaterial","Shape",defineClass(x3dom.nodeTypes.Material,(function(e){x3dom.nodeTypes.TwoSidedMaterial.superClass.call(this,e),this.addField_SFFloat(e,"backAmbientIntensity",.2),this.addField_SFColor(e,"backDiffuseColor",.8,.8,.8),this.addField_SFColor(e,"backEmissiveColor",0,0,0),this.addField_SFFloat(e,"backShininess",.2),this.addField_SFColor(e,"backSpecularColor",0,0,0),this.addField_SFFloat(e,"backTransparency",0),this.addField_SFBool(e,"separateBackColor",!1)}),{fieldChanged:function(e){"ambientIntensity"!=e&amp;&amp;"diffuseColor"!=e&amp;&amp;"emissiveColor"!=e&amp;&amp;"shininess"!=e&amp;&amp;"specularColor"!=e&amp;&amp;"transparency"!=e&amp;&amp;"backAmbientIntensity"!=e&amp;&amp;"backDiffuseColor"!=e&amp;&amp;"backEmissiveColor"!=e&amp;&amp;"backShininess"!=e&amp;&amp;"backSpecularColor"!=e&amp;&amp;"backTransparency"!=e&amp;&amp;"separateBackColor"!=e||Array.forEach(this._parentNodes,(function(e){Array.forEach(e._parentNodes,(function(e){e._dirty.material=!0})),e.checkSortType()}))}})),x3dom.registerNodeType("X3DShapeNode","Shape",defineClass(x3dom.nodeTypes.X3DBoundedObject,(function(e){x3dom.nodeTypes.X3DShapeNode.superClass.call(this,e),this.addField_SFBool(e,"isPickable",!0),this.addField_SFInt32(e,"idOffset",0),this.addField_SFNode("appearance",x3dom.nodeTypes.X3DAppearanceNode),this.addField_SFNode("geometry",x3dom.nodeTypes.X3DGeometryNode),this._objectID=0,this._shaderProperties=null,this._clipPlanes=[],this._cleanupGLObjects=null,this._dirty={positions:!0,normals:!0,texcoords:!0,colors:!0,specialAttribs:!0,indexes:!0,texture:!0,material:!0,text:!0,shader:!0,ids:!0},this._coordStrideOffset=[0,0],this._normalStrideOffset=[0,0],this._texCoordStrideOffset=[0,0],this._colorStrideOffset=[0,0],this._idStrideOffset=[0,0],this._tessellationProperties=[]}),{collectDrawableObjects:function(e,t,i,s,r,o){var n=this.graphState();return i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),!(!this._cf.geometry.node||t.cull(e,n,i,r)&lt;=0)&amp;&amp;(i&amp;&amp;!this._graph.globalMatrix&amp;&amp;(this._graph.globalMatrix=e),this._clipPlanes.length!=o.length&amp;&amp;(this._dirty.shader=!0),this._clipPlanes=o,t.addShape(this,e,n),!0)},getVolume:function(){var e=this._graph.volume;if(!this.volumeValid()&amp;&amp;this._vf.render){var t=this._cf.geometry.node,i=t?t.getVolume():null;i&amp;&amp;i.isValid()&amp;&amp;e.extendBounds(i.min,i.max)}return e},getCenter:function(){var e=this._cf.geometry.node;return e?e.getCenter():new x3dom.fields.SFVec3f(0,0,0)},getDiameter:function(){var e=this._cf.geometry.node;return e?e.getDiameter():0},doIntersect:function(e){return this._cf.geometry.node.doIntersect(e)},forceUpdateCoverage:function(){var e=this._cf.geometry.node;return!!e&amp;&amp;e.forceUpdateCoverage()},tessellationProperties:function(){var e=this._cf.geometry.node;return e&amp;&amp;e._indexOffset?e._indexOffset:this._tessellationProperties},isLit:function(){return this._cf.geometry.node._vf.lit},isSolid:function(){var e=this._cf.appearance.node&amp;&amp;this._cf.appearance.node._cf.material.node&amp;&amp;x3dom.isa(this._cf.appearance.node._cf.material.node,x3dom.nodeTypes.TwoSidedMaterial);return this._cf.geometry.node._vf.solid&amp;&amp;!e},isCCW:function(){return this._cf.geometry.node._vf.ccw},parentRemoved:function(e){for(var t=0,i=this._childNodes.length;t&lt;i;t++){var s=this._childNodes[t];s&amp;&amp;s.parentRemoved(this)}e&amp;&amp;e.invalidateVolume(),this._parentNodes.length&gt;0&amp;&amp;this.invalidateVolume(),this._cleanupGLObjects&amp;&amp;this._cleanupGLObjects()},unsetDirty:function(){this._dirty.positions=!1,this._dirty.normals=!1,this._dirty.texcoords=!1,this._dirty.colors=!1,this._dirty.specialAttribs=!1,this._dirty.indexes=!1,this._dirty.texture=!1,this._dirty.material=!1,this._dirty.text=!1,this._dirty.shader=!1},unsetGeoDirty:function(){this._dirty.positions=!1,this._dirty.normals=!1,this._dirty.texcoords=!1,this._dirty.colors=!1,this._dirty.specialAttribs=!1,this._dirty.indexes=!1},setAllDirty:function(){this._dirty.positions=!0,this._dirty.normals=!0,this._dirty.texcoords=!0,this._dirty.colors=!0,this._dirty.specialAttribs=!0,this._dirty.indexes=!0,this._dirty.texture=!0,this._dirty.material=!0,this._dirty.text=!0,this._dirty.shader=!0,this.invalidateVolume()},setAppDirty:function(){this._dirty.texture=!0,this._dirty.material=!0,this._dirty.shader=!0},setGeoDirty:function(){this._dirty.positions=!0,this._dirty.normals=!0,this._dirty.texcoords=!0,this._dirty.colors=!0,this._dirty.specialAttribs=!0,this._dirty.indexes=!0,this.invalidateVolume()},getShaderProperties:function(e){return(null==this._shaderProperties||1==this._dirty.shader||void 0!==this._webgl&amp;&amp;this._webgl.dirtyLighting!=x3dom.Utils.checkDirtyLighting(e)||1==x3dom.Utils.checkDirtyEnvironment(e,this._shaderProperties))&amp;&amp;(this._shaderProperties=x3dom.Utils.generateProperties(e,this),this._dirty.shader=!1,void 0!==this._webgl&amp;&amp;(this._webgl.dirtyLighting=x3dom.Utils.checkDirtyLighting(e))),this._shaderProperties},getTextures:function(){var e=[],t=this._cf.appearance.node;if(t){var i=t._cf.texture.node;i&amp;&amp;(x3dom.isa(i,x3dom.nodeTypes.MultiTexture)?e=e.concat(i.getTextures()):e.push(i));var s=t._cf.shaders.nodes[0];s&amp;&amp;x3dom.isa(s,x3dom.nodeTypes.CommonSurfaceShader)&amp;&amp;(e=e.concat(s.getTextures()))}var r=this._cf.geometry.node;return r&amp;&amp;(x3dom.isa(r,x3dom.nodeTypes.ImageGeometry)?e=e.concat(r.getTextures()):x3dom.isa(r,x3dom.nodeTypes.Text)&amp;&amp;(e=e.concat(r))),e}})),x3dom.registerNodeType("Shape","Shape",defineClass(x3dom.nodeTypes.X3DShapeNode,(function(e){x3dom.nodeTypes.Shape.superClass.call(this,e)}),{nodeChanged:function(){this._cf.appearance.node,this._cf.geometry.node?this._objectID||(this._objectID=++x3dom.nodeTypes.Shape.objectID,x3dom.nodeTypes.Shape.idMap.nodeID[this._objectID]=this):this._DEF&amp;&amp;x3dom.debug.logError("No geometry given in Shape/"+this._DEF),this.invalidateVolume()}})),x3dom.nodeTypes.Shape.shaderPartID=0,x3dom.nodeTypes.Shape.objectID=0,x3dom.nodeTypes.Shape.idMap={nodeID:{},remove:function(e){for(var t in this.nodeID)if(this.nodeID.hasOwnProperty(t)){var i=this.nodeID[t];i._objectID&amp;&amp;e._objectID&amp;&amp;i._objectID===e._objectID&amp;&amp;(delete this.nodeID[t],x3dom.debug.logInfo("Unreg "+i._objectID))}}},x3dom.registerNodeType("ExternalShape","Shape",defineClass(x3dom.nodeTypes.X3DShapeNode,(function(e){x3dom.nodeTypes.ExternalShape.superClass.call(this,e),this.addField_MFString(e,"url",[]),this._currentURLIdx=0,this._cf.geometry.node=new x3dom.nodeTypes.X3DSpatialGeometryNode(e),this.loaded=!1}),{update:function(e,t,i,s,r){var o=this;if(!(0==this._vf.url.length||this._currentURLIdx&gt;=this._vf.url.length)){var n=new XMLHttpRequest;n.open("GET",this._nameSpace.getURL(this._vf.url[this._currentURLIdx]),!0),n.responseType="arraybuffer",n.send(null),n.onerror=function(){x3dom.debug.logError('Unable to load SRC data from URL "'+o._vf.url[o._currentURLIdx]+'"')},n.onload=function(){if(200==n.status||0==n.status){var a=new x3dom.glTF.glTFLoader(n.response);if(a.header.sceneLength&gt;0){a.loaded={},a.loaded.meshes={},a.loaded.meshCount=0,o.glTF=a;var h=o._vf.url[o._currentURLIdx];if(h.includes("#")){var d=h.split("#"),l=d[d.length-1];a.getMesh(e,t,i,l)}else a.getScene(e,t,i);for(var u in a._mesh)a._mesh.hasOwnProperty(u)&amp;&amp;(o._cf.geometry.node._mesh[u]=a._mesh[u])}else o._currentURLIdx+1&lt;o._vf.url.length?(x3dom.debug.logWarning('Invalid SRC data, loaded from URL "'+o._vf.url[o._currentURLIdx]+'", trying next specified URL'),++o._currentURLIdx,o.update(e,t,i,s,r)):x3dom.debug.logError('Invalid SRC data, loaded from URL "'+o._vf.url[o._currentURLIdx]+'", no other URLs left to try.')}else o._currentURLIdx+1&lt;o._vf.url.length?(x3dom.debug.logWarning('Invalid SRC data, loaded from URL "'+o._vf.url[o._currentURLIdx]+'", trying next specified URL'),++o._currentURLIdx,o.update(e,t,i,s,r)):x3dom.debug.logError('Invalid SRC data, loaded from URL "'+o._vf.url[o._currentURLIdx]+'", no other URLs left to try.')}}},collectDrawableObjects:function(e,t,i,s,r,o){var n=this.graphState();return i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),i&amp;&amp;!this._graph.globalMatrix&amp;&amp;(this._graph.globalMatrix=e),this._clipPlanes.length!=o.length&amp;&amp;(this._dirty.shader=!0),this._clipPlanes=o,t.addShape(this,e,n),!0},getShaderProperties:function(e){var t=x3dom.Utils.generateProperties(e,this);return t.CSHADER=-1,t.LIGHTS=e.getLights().length+e._scene.getNavigationInfo()._vf.headlight,t.EMPTY_SHADER=1,t},nodeChanged:function(){this._objectID||(this._objectID=++x3dom.nodeTypes.Shape.objectID,x3dom.nodeTypes.Shape.idMap.nodeID[this._objectID]=this)}})),x3dom.registerNodeType("X3DLightNode","Lighting",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DLightNode.superClass.call(this,e),e?e.doc._nodeBag.lights.push(this):x3dom.debug.logWarning("X3DLightNode: No runtime context found!"),this._lightID=0,this._dirty=!0,this.addField_SFFloat(e,"ambientIntensity",0),this.addField_SFColor(e,"color",1,1,1),this.addField_SFFloat(e,"intensity",1),this.addField_SFBool(e,"global",!1),this.addField_SFBool(e,"on",!0),this.addField_SFFloat(e,"shadowIntensity",0),this.addField_SFInt32(e,"shadowMapSize",1024),this.addField_SFInt32(e,"shadowFilterSize",0),this.addField_SFFloat(e,"shadowOffset",0),this.addField_SFFloat(e,"zNear",-1),this.addField_SFFloat(e,"zFar",-1)}),{getViewMatrix:function(e){return x3dom.fields.SFMatrix4f.identity},nodeChanged:function(){this._lightID||(this._lightID=++x3dom.nodeTypes.X3DLightNode.lightID)},fieldChanged:function(e){this._vf.hasOwnProperty(e)&amp;&amp;(this._dirty=!0)},parentRemoved:function(e){if(1===this._parentNodes.length&amp;&amp;this._parentNodes[0]==e)for(var t=this.findX3DDoc(),i=0,s=t._nodeBag.lights.length;i&lt;s;i++)t._nodeBag.lights[i]===this&amp;&amp;t._nodeBag.lights.splice(i,1)},onRemove:function(){}})),x3dom.nodeTypes.X3DLightNode.lightID=0,x3dom.registerNodeType("DirectionalLight","Lighting",defineClass(x3dom.nodeTypes.X3DLightNode,(function(e){x3dom.nodeTypes.DirectionalLight.superClass.call(this,e),this.addField_SFVec3f(e,"direction",0,0,-1),this.addField_SFInt32(e,"shadowCascades",1),this.addField_SFFloat(e,"shadowSplitFactor",1),this.addField_SFFloat(e,"shadowSplitOffset",.1)}),{getViewMatrix:function(e){var t=this.getCurrentTransform().multMatrixVec(this._vf.direction).normalize();return x3dom.fields.Quaternion.rotateFromTo(new x3dom.fields.SFVec3f(0,0,-1),t).toMatrix().transpose().mult(x3dom.fields.SFMatrix4f.translation(e.negate()))}})),x3dom.registerNodeType("PointLight","Lighting",defineClass(x3dom.nodeTypes.X3DLightNode,(function(e){x3dom.nodeTypes.PointLight.superClass.call(this,e),this.addField_SFVec3f(e,"attenuation",1,0,0),this.addField_SFVec3f(e,"location",0,0,0),this.addField_SFFloat(e,"radius",100),this._vf.global=!0}),{getViewMatrix:function(e){var t=this.getCurrentTransform().multMatrixPnt(this._vf.location);return x3dom.fields.Quaternion.rotateFromTo(new x3dom.fields.SFVec3f(0,0,-1),e).toMatrix().transpose().mult(x3dom.fields.SFMatrix4f.translation(t.negate()))}})),x3dom.registerNodeType("SpotLight","Lighting",defineClass(x3dom.nodeTypes.X3DLightNode,(function(e){x3dom.nodeTypes.SpotLight.superClass.call(this,e),this.addField_SFVec3f(e,"direction",0,0,-1),this.addField_SFVec3f(e,"attenuation",1,0,0),this.addField_SFVec3f(e,"location",0,0,0),this.addField_SFFloat(e,"radius",100),this.addField_SFFloat(e,"beamWidth",1.5707963),this.addField_SFFloat(e,"cutOffAngle",1.5707963),this.addField_SFInt32(e,"shadowCascades",1),this.addField_SFFloat(e,"shadowSplitFactor",1),this.addField_SFFloat(e,"shadowSplitOffset",.1),this._vf.global=!0}),{getViewMatrix:function(e){var t=this.getCurrentTransform().multMatrixPnt(this._vf.location),i=this.getCurrentTransform().multMatrixVec(this._vf.direction).normalize();return x3dom.fields.Quaternion.rotateFromTo(new x3dom.fields.SFVec3f(0,0,-1),i).toMatrix().transpose().mult(x3dom.fields.SFMatrix4f.translation(t.negate()))}})),x3dom.registerNodeType("X3DFollowerNode","Followers",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DFollowerNode.superClass.call(this,e),e?e.doc._nodeBag.followers.push(this):x3dom.debug.logWarning("X3DFollowerNode: No runtime context found!"),this.addField_SFBool(e,"isActive",!1),this._eps=x3dom.fields.Eps}),{parentRemoved:function(e){if(0===this._parentNodes.length)for(var t=this.findX3DDoc(),i=0,s=t._nodeBag.followers.length;i&lt;s;i++)t._nodeBag.followers[i]===this&amp;&amp;t._nodeBag.followers.splice(i,1)},tick:function(e){return!1},stepResponse:function(e){return e&lt;=0?0:e&gt;=this._vf.duration?1:this.stepResponseCore(e/this._vf.duration)},stepResponseCore:function(e){return.5-.5*Math.cos(e*Math.PI)}})),x3dom.registerNodeType("X3DChaserNode","Followers",defineClass(x3dom.nodeTypes.X3DFollowerNode,(function(e){x3dom.nodeTypes.X3DChaserNode.superClass.call(this,e),this.addField_SFTime(e,"duration",1),this._initDone=!1,this._stepTime=0,this._currTime=0,this._bufferEndTime=0,this._numSupports=60}))),x3dom.registerNodeType("X3DDamperNode","Followers",defineClass(x3dom.nodeTypes.X3DFollowerNode,(function(e){x3dom.nodeTypes.X3DDamperNode.superClass.call(this,e),this.addField_SFTime(e,"tau",.3),this.addField_SFFloat(e,"tolerance",-1),this.addField_SFInt32(e,"order",3),this._eps=this._vf.tolerance&lt;0?this._eps:this._vf.tolerance,this._lastTick=0}))),x3dom.registerNodeType("ColorChaser","Followers",defineClass(x3dom.nodeTypes.X3DChaserNode,(function(e){x3dom.nodeTypes.ColorChaser.superClass.call(this,e),this.addField_SFColor(e,"initialDestination",.8,.8,.8),this.addField_SFColor(e,"initialValue",.8,.8,.8),this.addField_SFColor(e,"value",0,0,0),this.addField_SFColor(e,"destination",0,0,0),this._buffer=new x3dom.fields.MFColor,this._previousValue=new x3dom.fields.SFColor(0,0,0),this._value=new x3dom.fields.SFColor(0,0,0),this.initialize()}),{fieldChanged:function(e){if(e.indexOf("destination")&gt;=0)this.initialize(),this.updateBuffer(this._currTime),this._vf.isActive||this.postMessage("isActive",!0);else if(e.indexOf("value")&gt;=0){this.initialize(),this._previousValue.setValues(this._vf.value);for(var t=1;t&lt;this._buffer.length;t++)this._buffer[t].setValues(this._vf.value);this.postMessage("value",this._vf.value),this._vf.isActive||this.postMessage("isActive",!0)}},initialize:function(){if(!this._initDone){this._initDone=!0,this._vf.destination=this._vf.initialDestination,this._buffer.length=this._numSupports,this._buffer[0]=this._vf.initialDestination;for(var e=1;e&lt;this._buffer.length;e++)this._buffer[e]=this._vf.initialValue;this._previousValue=this._vf.initialValue,this._stepTime=this._vf.duration/this._numSupports;var t=!this._buffer[0].equals(this._buffer[1],this._eps);this._vf.isActive!==t&amp;&amp;this.postMessage("isActive",t)}},tick:function(e){if(this.initialize(),this._currTime=e,!this._bufferEndTime)return this._bufferEndTime=e,this._value=this._vf.initialValue,this.postMessage("value",this._value),!0;var t=this.updateBuffer(e),i=this._previousValue,s=this._buffer[this._buffer.length-1].subtract(this._previousValue),r=s.multiply(this.stepResponse((this._buffer.length-1+t)*this._stepTime));i=i.add(r);for(var o=this._buffer.length-2;o&gt;=0;o--)r=(s=this._buffer[o].subtract(this._buffer[o+1])).multiply(this.stepResponse((o+t)*this._stepTime)),i=i.add(r);return i.equals(this._value,this._eps)?this.postMessage("isActive",!1):(this._value.setValues(i),this.postMessage("value",this._value)),this._vf.isActive},updateBuffer:function(e){var t,i,s,r=(e-this._bufferEndTime)/this._stepTime;if(r&gt;=1){if(r-=i=Math.floor(r),i&lt;this._buffer.length){for(this._previousValue=this._buffer[this._buffer.length-i],t=this._buffer.length-1;t&gt;=i;t--)this._buffer[t]=this._buffer[t-i];for(t=0;t&lt;i;t++)s=t/i,this._buffer[t]=this._buffer[i].multiply(s).add(this._vf.destination.multiply(1-s))}else for(this._previousValue=i==this._buffer.length?this._buffer[0]:this._vf.destination,t=0;t&lt;this._buffer.length;t++)this._buffer[t]=this._vf.destination;this._bufferEndTime+=i*this._stepTime}return r}})),x3dom.registerNodeType("ColorDamper","Followers",defineClass(x3dom.nodeTypes.X3DDamperNode,(function(e){x3dom.nodeTypes.ColorDamper.superClass.call(this,e),this.addField_SFColor(e,"initialDestination",.8,.8,.8),this.addField_SFColor(e,"initialValue",.8,.8,.8),this.addField_SFColor(e,"value",0,0,0),this.addField_SFColor(e,"destination",0,0,0),this._value0=new x3dom.fields.SFColor(0,0,0),this._value1=new x3dom.fields.SFColor(0,0,0),this._value2=new x3dom.fields.SFColor(0,0,0),this._value3=new x3dom.fields.SFColor(0,0,0),this._value4=new x3dom.fields.SFColor(0,0,0),this._value5=new x3dom.fields.SFColor(0,0,0),this.initialize()}),{fieldChanged:function(e){"tolerance"===e?this._eps=this._vf.tolerance&lt;0?.001:this._vf.tolerance:e.indexOf("destination")&gt;=0?this._value0.equals(this._vf.destination,this._eps)||(this._value0=this._vf.destination,this._vf.isActive||this.postMessage("isActive",!0)):e.indexOf("value")&gt;=0&amp;&amp;(this._value1.setValues(this._vf.value),this._value2.setValues(this._vf.value),this._value3.setValues(this._vf.value),this._value4.setValues(this._vf.value),this._value5.setValues(this._vf.value),this._lastTick=0,this.postMessage("value",this._value5),this._vf.isActive||(this._lastTick=0,this.postMessage("isActive",!0)))},initialize:function(){this._value0.setValues(this._vf.initialDestination),this._value1.setValues(this._vf.initialValue),this._value2.setValues(this._vf.initialValue),this._value3.setValues(this._vf.initialValue),this._value4.setValues(this._vf.initialValue),this._value5.setValues(this._vf.initialValue),this._lastTick=0;var e=!this._value0.equals(this._value1,this._eps);this._vf.isActive!==e&amp;&amp;this.postMessage("isActive",e)},distance:function(e,t){var i=e.subtract(t);return Math.sqrt(i.r*i.r+i.g*i.g+i.b*i.b)},tick:function(e){if(!this._lastTick)return this._lastTick=e,!1;var t=e-this._lastTick,i=Math.exp(-t/this._vf.tau);this._value1=this._vf.order&gt;0&amp;&amp;this._vf.tau?this._value0.add(this._value1.subtract(this._value0).multiply(i)):new x3dom.fields.SFColor(this._value0.r,this._value0.g,this._value0.b),this._value2=this._vf.order&gt;1&amp;&amp;this._vf.tau?this._value1.add(this._value2.subtract(this._value1).multiply(i)):new x3dom.fields.SFColor(this._value1.r,this._value1.g,this._value1.b),this._value3=this._vf.order&gt;2&amp;&amp;this._vf.tau?this._value2.add(this._value3.subtract(this._value2).multiply(i)):new x3dom.fields.SFColor(this._value2.r,this._value2.g,this._value2.b),this._value4=this._vf.order&gt;3&amp;&amp;this._vf.tau?this._value3.add(this._value4.subtract(this._value3).multiply(i)):new x3dom.fields.SFColor(this._value3.r,this._value3.g,this._value3.b),this._value5=this._vf.order&gt;4&amp;&amp;this._vf.tau?this._value4.add(this._value5.subtract(this._value4).multiply(i)):new x3dom.fields.SFColor(this._value4.r,this._value4.g,this._value4.b);var s=this.distance(this._value1,this._value0);if(this._vf.order&gt;1){var r=this.distance(this._value2,this._value1);r&gt;s&amp;&amp;(s=r)}if(this._vf.order&gt;2){var o=this.distance(this._value3,this._value2);o&gt;s&amp;&amp;(s=o)}if(this._vf.order&gt;3){var n=this.distance(this._value4,this._value3);n&gt;s&amp;&amp;(s=n)}if(this._vf.order&gt;4){var a=this.distance(this._value5,this._value4);a&gt;s&amp;&amp;(s=a)}return s&lt;=this._eps?(this._value1.setValues(this._value0),this._value2.setValues(this._value0),this._value3.setValues(this._value0),this._value4.setValues(this._value0),this._value5.setValues(this._value0),this.postMessage("value",this._value0),this.postMessage("isActive",!1),this._lastTick=0,!1):(this.postMessage("value",this._value5),this._lastTick=e,!0)}})),x3dom.registerNodeType("OrientationChaser","Followers",defineClass(x3dom.nodeTypes.X3DChaserNode,(function(e){x3dom.nodeTypes.OrientationChaser.superClass.call(this,e),this.addField_SFRotation(e,"initialDestination",0,1,0,0),this.addField_SFRotation(e,"initialValue",0,1,0,0),this.addField_SFRotation(e,"value",0,1,0,0),this.addField_SFRotation(e,"destination",0,1,0,0),this._numSupports=30,this._buffer=new x3dom.fields.MFRotation,this._previousValue=new x3dom.fields.Quaternion(0,1,0,0),this._value=new x3dom.fields.Quaternion(0,1,0,0),this.initialize()}),{fieldChanged:function(e){if(e.indexOf("destination")&gt;=0)this.initialize(),this.updateBuffer(this._currTime),this._vf.isActive||this.postMessage("isActive",!0);else if(e.indexOf("value")&gt;=0){this.initialize(),this._previousValue.setValues(this._vf.value);for(var t=1;t&lt;this._buffer.length;t++)this._buffer[t].setValues(this._vf.value);this.postMessage("value",this._vf.value),this._vf.isActive||this.postMessage("isActive",!0)}},initialize:function(){if(!this._initDone){this._initDone=!0,this._vf.destination=x3dom.fields.Quaternion.copy(this._vf.initialDestination),this._buffer.length=this._numSupports,this._buffer[0]=x3dom.fields.Quaternion.copy(this._vf.initialDestination);for(var e=1;e&lt;this._buffer.length;e++)this._buffer[e]=x3dom.fields.Quaternion.copy(this._vf.initialValue);this._previousValue=x3dom.fields.Quaternion.copy(this._vf.initialValue),this._stepTime=this._vf.duration/this._numSupports;var t=!this._buffer[0].equals(this._buffer[1],this._eps);this._vf.isActive!==t&amp;&amp;this.postMessage("isActive",t)}},tick:function(e){if(this.initialize(),this._currTime=e,!this._bufferEndTime)return this._bufferEndTime=e,this._value=x3dom.fields.Quaternion.copy(this._vf.initialValue),this.postMessage("value",this._value),!0;var t=this.updateBuffer(e),i=x3dom.fields.Quaternion.copy(this._previousValue),s=this._previousValue.inverse().multiply(this._buffer[this._buffer.length-1]);i=i.slerp(i.multiply(s),this.stepResponse((this._buffer.length-1+t)*this._stepTime));for(var r=this._buffer.length-2;r&gt;=0;r--)s=this._buffer[r+1].inverse().multiply(this._buffer[r]),i=i.slerp(i.multiply(s),this.stepResponse((r+t)*this._stepTime));return i.equals(this._value,this._eps)?this.postMessage("isActive",!1):(i=i.normalize(i),this._value.setValues(i),this.postMessage("value",this._value)),this._vf.isActive},updateBuffer:function(e){var t,i,s,r=(e-this._bufferEndTime)/this._stepTime;if(r&gt;=1){if(r-=i=Math.floor(r),i&lt;this._buffer.length){for(this._previousValue=x3dom.fields.Quaternion.copy(this._buffer[this._buffer.length-i]),t=this._buffer.length-1;t&gt;=i;t--)this._buffer[t]=x3dom.fields.Quaternion.copy(this._buffer[t-i]);for(t=0;t&lt;i;t++)s=t/i,this._buffer[t]=this._vf.destination.slerp(this._buffer[i],s)}else for(this._previousValue=x3dom.fields.Quaternion.copy(i==this._buffer.length?this._buffer[0]:this._vf.destination),t=0;t&lt;this._buffer.length;t++)this._buffer[t]=x3dom.fields.Quaternion.copy(this._vf.destination);this._bufferEndTime+=i*this._stepTime}return r}})),x3dom.registerNodeType("OrientationDamper","Followers",defineClass(x3dom.nodeTypes.X3DDamperNode,(function(e){x3dom.nodeTypes.OrientationDamper.superClass.call(this,e),this.addField_SFRotation(e,"initialDestination",0,1,0,0),this.addField_SFRotation(e,"initialValue",0,1,0,0),this.addField_SFRotation(e,"value",0,1,0,0),this.addField_SFRotation(e,"destination",0,1,0,0),this._value0=new x3dom.fields.Quaternion(0,1,0,0),this._value1=new x3dom.fields.Quaternion(0,1,0,0),this._value2=new x3dom.fields.Quaternion(0,1,0,0),this._value3=new x3dom.fields.Quaternion(0,1,0,0),this._value4=new x3dom.fields.Quaternion(0,1,0,0),this._value5=new x3dom.fields.Quaternion(0,1,0,0),this.initialize()}),{fieldChanged:function(e){"tolerance"===e?this._eps=this._vf.tolerance&lt;0?.001:this._vf.tolerance:e.indexOf("destination")&gt;=0?this._value0.equals(this._vf.destination,this._eps)||(this._value0=this._vf.destination,this._vf.isActive||this.postMessage("isActive",!0)):e.indexOf("value")&gt;=0&amp;&amp;(this._value1.setValues(this._vf.value),this._value2.setValues(this._vf.value),this._value3.setValues(this._vf.value),this._value4.setValues(this._vf.value),this._value5.setValues(this._vf.value),this._lastTick=0,this.postMessage("value",this._value5),this._vf.isActive||(this._lastTick=0,this.postMessage("isActive",!0)))},initialize:function(){this._value0.setValues(this._vf.initialDestination),this._value1.setValues(this._vf.initialValue),this._value2.setValues(this._vf.initialValue),this._value3.setValues(this._vf.initialValue),this._value4.setValues(this._vf.initialValue),this._value5.setValues(this._vf.initialValue),this._lastTick=0;var e=!this._value0.equals(this._value1,this._eps);this._vf.isActive!==e&amp;&amp;this.postMessage("isActive",e)},tick:function(e){if(!this._lastTick)return this._lastTick=e,!1;var t=e-this._lastTick,i=Math.exp(-t/this._vf.tau);this._value1=this._vf.order&gt;0&amp;&amp;this._vf.tau?this._value0.slerp(this._value1,i):new x3dom.fields.Quaternion(this._value0.x,this._value0.y,this._value0.z,this._value0.w),this._value2=this._vf.order&gt;1&amp;&amp;this._vf.tau?this._value1.slerp(this._value2,i):new x3dom.fields.Quaternion(this._value1.x,this._value1.y,this._value1.z,this._value1.w),this._value3=this._vf.order&gt;2&amp;&amp;this._vf.tau?this._value2.slerp(this._value3,i):new x3dom.fields.Quaternion(this._value2.x,this._value2.y,this._value2.z,this._value2.w),this._value4=this._vf.order&gt;3&amp;&amp;this._vf.tau?this._value3.slerp(this._value4,i):new x3dom.fields.Quaternion(this._value3.x,this._value3.y,this._value3.z,this._value3.w),this._value5=this._vf.order&gt;4&amp;&amp;this._vf.tau?this._value4.slerp(this._value5,i):new x3dom.fields.Quaternion(this._value4.x,this._value4.y,this._value4.z,this._value4.w);var s=Math.abs(this._value1.inverse().multiply(this._value0).angle());if(this._vf.order&gt;1){var r=Math.abs(this._value2.inverse().multiply(this._value1).angle());r&gt;s&amp;&amp;(s=r)}if(this._vf.order&gt;2){var o=Math.abs(this._value3.inverse().multiply(this._value2).angle());o&gt;s&amp;&amp;(s=o)}if(this._vf.order&gt;3){var n=Math.abs(this._value4.inverse().multiply(this._value3).angle());n&gt;s&amp;&amp;(s=n)}if(this._vf.order&gt;4){var a=Math.abs(this._value5.inverse().multiply(this._value4).angle());a&gt;s&amp;&amp;(s=a)}return s&lt;=this._eps?(this._value1.setValues(this._value0),this._value2.setValues(this._value0),this._value3.setValues(this._value0),this._value4.setValues(this._value0),this._value5.setValues(this._value0),this.postMessage("value",this._value0),this.postMessage("isActive",!1),this._lastTick=0,!1):(this.postMessage("value",this._value5),this._lastTick=e,!0)}})),x3dom.registerNodeType("PositionChaser","Followers",defineClass(x3dom.nodeTypes.X3DChaserNode,(function(e){x3dom.nodeTypes.PositionChaser.superClass.call(this,e),this.addField_SFVec3f(e,"initialDestination",0,0,0),this.addField_SFVec3f(e,"initialValue",0,0,0),this.addField_SFVec3f(e,"value",0,0,0),this.addField_SFVec3f(e,"destination",0,0,0),this._buffer=new x3dom.fields.MFVec3f,this._previousValue=new x3dom.fields.SFVec3f(0,0,0),this._value=new x3dom.fields.SFVec3f(0,0,0),this.initialize()}),{fieldChanged:function(e){if(e.indexOf("destination")&gt;=0)this.initialize(),this.updateBuffer(this._currTime),this._vf.isActive||this.postMessage("isActive",!0);else if(e.indexOf("value")&gt;=0){this.initialize(),this._previousValue.setValues(this._vf.value);for(var t=1;t&lt;this._buffer.length;t++)this._buffer[t].setValues(this._vf.value);this.postMessage("value",this._vf.value),this._vf.isActive||this.postMessage("isActive",!0)}},initialize:function(){if(!this._initDone){this._initDone=!0,this._vf.destination=x3dom.fields.SFVec3f.copy(this._vf.initialDestination),this._buffer.length=this._numSupports,this._buffer[0]=x3dom.fields.SFVec3f.copy(this._vf.initialDestination);for(var e=1;e&lt;this._buffer.length;e++)this._buffer[e]=x3dom.fields.SFVec3f.copy(this._vf.initialValue);this._previousValue=x3dom.fields.SFVec3f.copy(this._vf.initialValue),this._stepTime=this._vf.duration/this._numSupports;var t=!this._buffer[0].equals(this._buffer[1],this._eps);this._vf.isActive!==t&amp;&amp;this.postMessage("isActive",t)}},tick:function(e){if(this.initialize(),this._currTime=e,!this._bufferEndTime)return this._bufferEndTime=e,this._value=x3dom.fields.SFVec3f.copy(this._vf.initialValue),this.postMessage("value",this._value),!0;var t=this.updateBuffer(e),i=x3dom.fields.SFVec3f.copy(this._previousValue),s=this._buffer[this._buffer.length-1].subtract(this._previousValue),r=s.multiply(this.stepResponse((this._buffer.length-1+t)*this._stepTime));i=i.add(r);for(var o=this._buffer.length-2;o&gt;=0;o--)r=(s=this._buffer[o].subtract(this._buffer[o+1])).multiply(this.stepResponse((o+t)*this._stepTime)),i=i.add(r);return i.equals(this._value,this._eps)?this.postMessage("isActive",!1):(this._value.setValues(i),this.postMessage("value",this._value)),this._vf.isActive},updateBuffer:function(e){var t,i,s,r=(e-this._bufferEndTime)/this._stepTime;if(r&gt;=1){if(r-=i=Math.floor(r),i&lt;this._buffer.length){for(this._previousValue=x3dom.fields.SFVec3f.copy(this._buffer[this._buffer.length-i]),t=this._buffer.length-1;t&gt;=i;t--)this._buffer[t]=x3dom.fields.SFVec3f.copy(this._buffer[t-i]);for(t=0;t&lt;i;t++)s=t/i,this._buffer[t]=this._buffer[i].multiply(s).add(this._vf.destination.multiply(1-s))}else for(this._previousValue=x3dom.fields.SFVec3f.copy(i==this._buffer.length?this._buffer[0]:this._vf.destination),t=0;t&lt;this._buffer.length;t++)this._buffer[t]=x3dom.fields.SFVec3f.copy(this._vf.destination);this._bufferEndTime+=i*this._stepTime}return r}})),x3dom.registerNodeType("PositionChaser2D","Followers",defineClass(x3dom.nodeTypes.X3DChaserNode,(function(e){x3dom.nodeTypes.PositionChaser2D.superClass.call(this,e),this.addField_SFVec2f(e,"initialDestination",0,0),this.addField_SFVec2f(e,"initialValue",0,0),this.addField_SFVec2f(e,"value",0,0),this.addField_SFVec2f(e,"destination",0,0),this._buffer=new x3dom.fields.MFVec2f,this._previousValue=new x3dom.fields.SFVec2f(0,0),this._value=new x3dom.fields.SFVec2f(0,0),this.initialize()}),{fieldChanged:function(e){if(e.indexOf("destination")&gt;=0)this.initialize(),this.updateBuffer(this._currTime),this._vf.isActive||this.postMessage("isActive",!0);else if(e.indexOf("value")&gt;=0){this.initialize(),this._previousValue.setValues(this._vf.value);for(var t=1;t&lt;this._buffer.length;t++)this._buffer[t].setValues(this._vf.value);this.postMessage("value",this._vf.value),this._vf.isActive||this.postMessage("isActive",!0)}},initialize:function(){if(!this._initDone){this._initDone=!0,this._vf.destination=x3dom.fields.SFVec2f.copy(this._vf.initialDestination),this._buffer.length=this._numSupports,this._buffer[0]=x3dom.fields.SFVec2f.copy(this._vf.initialDestination);for(var e=1;e&lt;this._buffer.length;e++)this._buffer[e]=x3dom.fields.SFVec2f.copy(this._vf.initialValue);this._previousValue=x3dom.fields.SFVec2f.copy(this._vf.initialValue),this._stepTime=this._vf.duration/this._numSupports;var t=!this._buffer[0].equals(this._buffer[1],this._eps);this._vf.isActive!==t&amp;&amp;this.postMessage("isActive",t)}},tick:function(e){if(this.initialize(),this._currTime=e,!this._bufferEndTime)return this._bufferEndTime=e,this._value=x3dom.fields.SFVec2f.copy(this._vf.initialValue),this.postMessage("value",this._value),!0;var t=this.updateBuffer(e),i=x3dom.fields.SFVec2f.copy(this._previousValue),s=this._buffer[this._buffer.length-1].subtract(this._previousValue),r=s.multiply(this.stepResponse((this._buffer.length-1+t)*this._stepTime));i=i.add(r);for(var o=this._buffer.length-2;o&gt;=0;o--)r=(s=this._buffer[o].subtract(this._buffer[o+1])).multiply(this.stepResponse((o+t)*this._stepTime)),i=i.add(r);return i.equals(this._value,this._eps)?this.postMessage("isActive",!1):(this._value.setValues(i),this.postMessage("value",this._value)),this._vf.isActive},updateBuffer:function(e){var t,i,s,r=(e-this._bufferEndTime)/this._stepTime;if(r&gt;=1){if(r-=i=Math.floor(r),i&lt;this._buffer.length){for(this._previousValue=x3dom.fields.SFVec2f.copy(this._buffer[this._buffer.length-i]),t=this._buffer.length-1;t&gt;=i;t--)this._buffer[t]=x3dom.fields.SFVec2f.copy(this._buffer[t-i]);for(t=0;t&lt;i;t++)s=t/i,this._buffer[t]=this._buffer[i].multiply(s).add(this._vf.destination.multiply(1-s))}else for(this._previousValue=x3dom.fields.SFVec2f.copy(i==this._buffer.length?this._buffer[0]:this._vf.destination),t=0;t&lt;this._buffer.length;t++)this._buffer[t]=x3dom.fields.SFVec2f.copy(this._vf.destination);this._bufferEndTime+=i*this._stepTime}return r}})),x3dom.registerNodeType("PositionDamper","Followers",defineClass(x3dom.nodeTypes.X3DDamperNode,(function(e){x3dom.nodeTypes.PositionDamper.superClass.call(this,e),this.addField_SFVec3f(e,"initialDestination",0,0,0),this.addField_SFVec3f(e,"initialValue",0,0,0),this.addField_SFVec3f(e,"value",0,0,0),this.addField_SFVec3f(e,"destination",0,0,0),this._value0=new x3dom.fields.SFVec3f(0,0,0),this._value1=new x3dom.fields.SFVec3f(0,0,0),this._value2=new x3dom.fields.SFVec3f(0,0,0),this._value3=new x3dom.fields.SFVec3f(0,0,0),this._value4=new x3dom.fields.SFVec3f(0,0,0),this._value5=new x3dom.fields.SFVec3f(0,0,0),this.initialize()}),{fieldChanged:function(e){"tolerance"===e?this._eps=this._vf.tolerance&lt;0?.001:this._vf.tolerance:e.indexOf("destination")&gt;=0?this._value0.equals(this._vf.destination,this._eps)||(this._value0=this._vf.destination,this._vf.isActive||this.postMessage("isActive",!0)):e.indexOf("value")&gt;=0&amp;&amp;(this._value1.setValues(this._vf.value),this._value2.setValues(this._vf.value),this._value3.setValues(this._vf.value),this._value4.setValues(this._vf.value),this._value5.setValues(this._vf.value),this._lastTick=0,this.postMessage("value",this._value5),this._vf.isActive||(this._lastTick=0,this.postMessage("isActive",!0)))},initialize:function(){this._value0.setValues(this._vf.initialDestination),this._value1.setValues(this._vf.initialValue),this._value2.setValues(this._vf.initialValue),this._value3.setValues(this._vf.initialValue),this._value4.setValues(this._vf.initialValue),this._value5.setValues(this._vf.initialValue),this._lastTick=0;var e=!this._value0.equals(this._value1,this._eps);this._vf.isActive!==e&amp;&amp;this.postMessage("isActive",e)},tick:function(e){if(!this._lastTick)return this._lastTick=e,!1;var t=e-this._lastTick,i=Math.exp(-t/this._vf.tau);this._value1=this._vf.order&gt;0&amp;&amp;this._vf.tau?this._value0.add(this._value1.subtract(this._value0).multiply(i)):new x3dom.fields.SFVec3f(this._value0.x,this._value0.y,this._value0.z),this._value2=this._vf.order&gt;1&amp;&amp;this._vf.tau?this._value1.add(this._value2.subtract(this._value1).multiply(i)):new x3dom.fields.SFVec3f(this._value1.x,this._value1.y,this._value1.z),this._value3=this._vf.order&gt;2&amp;&amp;this._vf.tau?this._value2.add(this._value3.subtract(this._value2).multiply(i)):new x3dom.fields.SFVec3f(this._value2.x,this._value2.y,this._value2.z),this._value4=this._vf.order&gt;3&amp;&amp;this._vf.tau?this._value3.add(this._value4.subtract(this._value3).multiply(i)):new x3dom.fields.SFVec3f(this._value3.x,this._value3.y,this._value3.z),this._value5=this._vf.order&gt;4&amp;&amp;this._vf.tau?this._value4.add(this._value5.subtract(this._value4).multiply(i)):new x3dom.fields.SFVec3f(this._value4.x,this._value4.y,this._value4.z);var s=this._value1.subtract(this._value0).length();if(this._vf.order&gt;1){var r=this._value2.subtract(this._value1).length();r&gt;s&amp;&amp;(s=r)}if(this._vf.order&gt;2){var o=this._value3.subtract(this._value2).length();o&gt;s&amp;&amp;(s=o)}if(this._vf.order&gt;3){var n=this._value4.subtract(this._value3).length();n&gt;s&amp;&amp;(s=n)}if(this._vf.order&gt;4){var a=this._value5.subtract(this._value4).length();a&gt;s&amp;&amp;(s=a)}return s&lt;=this._eps?(this._value1.setValues(this._value0),this._value2.setValues(this._value0),this._value3.setValues(this._value0),this._value4.setValues(this._value0),this._value5.setValues(this._value0),this.postMessage("value",this._value0),this.postMessage("isActive",!1),this._lastTick=0,!1):(this.postMessage("value",this._value5),this._lastTick=e,!0)}})),x3dom.registerNodeType("PositionDamper2D","Followers",defineClass(x3dom.nodeTypes.X3DDamperNode,(function(e){x3dom.nodeTypes.PositionDamper2D.superClass.call(this,e),this.addField_SFVec2f(e,"initialDestination",0,0),this.addField_SFVec2f(e,"initialValue",0,0),this.addField_SFVec2f(e,"value",0,0),this.addField_SFVec2f(e,"destination",0,0),this._value0=new x3dom.fields.SFVec2f(0,0),this._value1=new x3dom.fields.SFVec2f(0,0),this._value2=new x3dom.fields.SFVec2f(0,0),this._value3=new x3dom.fields.SFVec2f(0,0),this._value4=new x3dom.fields.SFVec2f(0,0),this._value5=new x3dom.fields.SFVec2f(0,0),this.initialize()}),{fieldChanged:function(e){"tolerance"===e?this._eps=this._vf.tolerance&lt;0?.001:this._vf.tolerance:e.indexOf("destination")&gt;=0?this._value0.equals(this._vf.destination,this._eps)||(this._value0=this._vf.destination,this._vf.isActive||this.postMessage("isActive",!0)):e.indexOf("value")&gt;=0&amp;&amp;(this._value1.setValues(this._vf.value),this._value2.setValues(this._vf.value),this._value3.setValues(this._vf.value),this._value4.setValues(this._vf.value),this._value5.setValues(this._vf.value),this._lastTick=0,this.postMessage("value",this._value5),this._vf.isActive||(this._lastTick=0,this.postMessage("isActive",!0)))},initialize:function(){this._value0.setValues(this._vf.initialDestination),this._value1.setValues(this._vf.initialValue),this._value2.setValues(this._vf.initialValue),this._value3.setValues(this._vf.initialValue),this._value4.setValues(this._vf.initialValue),this._value5.setValues(this._vf.initialValue),this._lastTick=0;var e=!this._value0.equals(this._value1,this._eps);this._vf.isActive!==e&amp;&amp;this.postMessage("isActive",e)},tick:function(e){if(!this._lastTick)return this._lastTick=e,!1;var t=e-this._lastTick,i=Math.exp(-t/this._vf.tau);this._value1=this._vf.order&gt;0&amp;&amp;this._vf.tau?this._value0.add(this._value1.subtract(this._value0).multiply(i)):new x3dom.fields.SFVec2f(this._value0.x,this._value0.y,this._value0.z),this._value2=this._vf.order&gt;1&amp;&amp;this._vf.tau?this._value1.add(this._value2.subtract(this._value1).multiply(i)):new x3dom.fields.SFVec2f(this._value1.x,this._value1.y,this._value1.z),this._value3=this._vf.order&gt;2&amp;&amp;this._vf.tau?this._value2.add(this._value3.subtract(this._value2).multiply(i)):new x3dom.fields.SFVec2f(this._value2.x,this._value2.y,this._value2.z),this._value4=this._vf.order&gt;3&amp;&amp;this._vf.tau?this._value3.add(this._value4.subtract(this._value3).multiply(i)):new x3dom.fields.SFVec2f(this._value3.x,this._value3.y,this._value3.z),this._value5=this._vf.order&gt;4&amp;&amp;this._vf.tau?this._value4.add(this._value5.subtract(this._value4).multiply(i)):new x3dom.fields.SFVec2f(this._value4.x,this._value4.y,this._value4.z);var s=this._value1.subtract(this._value0).length();if(this._vf.order&gt;1){var r=this._value2.subtract(this._value1).length();r&gt;s&amp;&amp;(s=r)}if(this._vf.order&gt;2){var o=this._value3.subtract(this._value2).length();o&gt;s&amp;&amp;(s=o)}if(this._vf.order&gt;3){var n=this._value4.subtract(this._value3).length();n&gt;s&amp;&amp;(s=n)}if(this._vf.order&gt;4){var a=this._value5.subtract(this._value4).length();a&gt;s&amp;&amp;(s=a)}return s&lt;=this._eps?(this._value1.setValues(this._value0),this._value2.setValues(this._value0),this._value3.setValues(this._value0),this._value4.setValues(this._value0),this._value5.setValues(this._value0),this.postMessage("value",this._value0),this.postMessage("isActive",!1),this._lastTick=0,!1):(this.postMessage("value",this._value5),this._lastTick=e,!0)}})),x3dom.registerNodeType("ScalarChaser","Followers",defineClass(x3dom.nodeTypes.X3DChaserNode,(function(e){x3dom.nodeTypes.ScalarChaser.superClass.call(this,e),this.addField_SFFloat(e,"initialDestination",0),this.addField_SFFloat(e,"initialValue",0),this.addField_SFFloat(e,"value",0),this.addField_SFFloat(e,"destination",0),this._buffer=[],this._previousValue=0,this._value=0,this.initialize()}),{fieldChanged:function(e){if(e.indexOf("destination")&gt;=0)this.initialize(),this.updateBuffer(this._currTime),this._vf.isActive||this.postMessage("isActive",!0);else if(e.indexOf("value")&gt;=0){this.initialize(),this._previousValue=this._vf.value;for(var t=1;t&lt;this._buffer.length;t++)this._buffer[t]=this._vf.value;this.postMessage("value",this._vf.value),this._vf.isActive||this.postMessage("isActive",!0)}},initialize:function(){if(!this._initDone){this._initDone=!0,this._vf.destination=this._vf.initialDestination,this._buffer.length=this._numSupports,this._buffer[0]=this._vf.initialDestination;for(var e=1;e&lt;this._buffer.length;e++)this._buffer[e]=this._vf.initialValue;this._previousValue=this._vf.initialValue,this._stepTime=this._vf.duration/this._numSupports;var t=Math.abs(this._buffer[0]-this._buffer[1])&gt;this._eps;this._vf.isActive!==t&amp;&amp;this.postMessage("isActive",t)}},tick:function(e){if(this.initialize(),this._currTime=e,!this._bufferEndTime)return this._bufferEndTime=e,this._value=this._vf.initialValue,this.postMessage("value",this._value),!0;var t=this.updateBuffer(e),i=this._previousValue,s=this._buffer[this._buffer.length-1]-this._previousValue,r=s*this.stepResponse((this._buffer.length-1+t)*this._stepTime);i+=r;for(var o=this._buffer.length-2;o&gt;=0;o--)i+=r=(s=this._buffer[o]-this._buffer[o+1])*this.stepResponse((o+t)*this._stepTime);return Math.abs(i-this._value)&gt;this._eps?(this._value=i,this.postMessage("value",this._value)):this.postMessage("isActive",!1),this._vf.isActive},updateBuffer:function(e){var t,i,s,r=(e-this._bufferEndTime)/this._stepTime;if(r&gt;=1){if(r-=i=Math.floor(r),i&lt;this._buffer.length){for(this._previousValue=this._buffer[this._buffer.length-i],t=this._buffer.length-1;t&gt;=i;t--)this._buffer[t]=this._buffer[t-i];for(t=0;t&lt;i;t++)s=t/i,this._buffer[t]=this._buffer[i]*s+this._vf.destination*(1-s)}else for(this._previousValue=i==this._buffer.length?this._buffer[0]:this._vf.destination,t=0;t&lt;this._buffer.length;t++)this._buffer[t]=this._vf.destination;this._bufferEndTime+=i*this._stepTime}return r}})),x3dom.registerNodeType("ScalarDamper","Followers",defineClass(x3dom.nodeTypes.X3DDamperNode,(function(e){x3dom.nodeTypes.ScalarDamper.superClass.call(this,e),this.addField_SFFloat(e,"initialDestination",0),this.addField_SFFloat(e,"initialValue",0),this.addField_SFFloat(e,"value",0),this.addField_SFFloat(e,"destination",0),this._value0=0,this._value1=0,this._value2=0,this._value3=0,this._value4=0,this._value5=0,this.initialize()}),{fieldChanged:function(e){"tolerance"===e?this._eps=this._vf.tolerance&lt;0?.001:this._vf.tolerance:e.indexOf("destination")&gt;=0?Math.abs(this._value0-this._vf.destination)&gt;this._eps&amp;&amp;(this._value0=this._vf.destination,this._vf.isActive||this.postMessage("isActive",!0)):e.indexOf("value")&gt;=0&amp;&amp;(this._value1=this._vf.value,this._value2=this._vf.value,this._value3=this._vf.value,this._value4=this._vf.value,this._value5=this._vf.value,this._lastTick=0,this.postMessage("value",this._value5),this._vf.isActive||(this._lastTick=0,this.postMessage("isActive",!0)))},initialize:function(){this._value0=this._vf.initialDestination,this._value1=this._vf.initialValue,this._value2=this._vf.initialValue,this._value3=this._vf.initialValue,this._value4=this._vf.initialValue,this._value5=this._vf.initialValue,this._lastTick=0;var e=Math.abs(this._value0-this._value1)&gt;this._eps;this._vf.isActive!==e&amp;&amp;this.postMessage("isActive",e)},tick:function(e){if(!this._lastTick)return this._lastTick=e,!1;var t=e-this._lastTick,i=Math.exp(-t/this._vf.tau);this._value1=this._vf.order&gt;0&amp;&amp;this._vf.tau?this._value0+i*(this._value1-this._value0):this._value0,this._value2=this._vf.order&gt;1&amp;&amp;this._vf.tau?this._value1+i*(this._value2-this._value1):this._value1,this._value3=this._vf.order&gt;2&amp;&amp;this._vf.tau?this._value2+i*(this._value3-this._value2):this._value2,this._value4=this._vf.order&gt;3&amp;&amp;this._vf.tau?this._value3+i*(this._value4-this._value3):this._value3,this._value5=this._vf.order&gt;4&amp;&amp;this._vf.tau?this._value4+i*(this._value5-this._value4):this._value4;var s=Math.abs(this._value1-this._value0);if(this._vf.order&gt;1){var r=Math.abs(this._value2-this._value1);r&gt;s&amp;&amp;(s=r)}if(this._vf.order&gt;2){var o=Math.abs(this._value3-this._value2);o&gt;s&amp;&amp;(s=o)}if(this._vf.order&gt;3){var n=Math.abs(this._value4-this._value3);n&gt;s&amp;&amp;(s=n)}if(this._vf.order&gt;4){var a=Math.abs(this._value5-this._value4);a&gt;s&amp;&amp;(s=a)}return s&lt;=this._eps?(this._value1=this._value0,this._value2=this._value0,this._value3=this._value0,this._value4=this._value0,this._value5=this._value0,this.postMessage("value",this._value0),this.postMessage("isActive",!1),this._lastTick=0,!1):(this.postMessage("value",this._value5),this._lastTick=e,!0)}})),x3dom.registerNodeType("CoordinateDamper","Followers",defineClass(x3dom.nodeTypes.X3DDamperNode,(function(e){x3dom.nodeTypes.CoordinateDamper.superClass.call(this,e),this.addField_MFVec3f(e,"initialDestination",[]),this.addField_MFVec3f(e,"initialValue",[]),this.addField_MFVec3f(e,"value",[]),this.addField_MFVec3f(e,"destination",[]),x3dom.debug.logWarning("CoordinateDamper NYI")}))),x3dom.registerNodeType("TexCoordDamper2D","Followers",defineClass(x3dom.nodeTypes.X3DDamperNode,(function(e){x3dom.nodeTypes.TexCoordDamper2D.superClass.call(this,e),this.addField_MFVec2f(e,"initialDestination",[]),this.addField_MFVec2f(e,"initialValue",[]),this.addField_MFVec2f(e,"value",[]),this.addField_MFVec2f(e,"destination",[]),x3dom.debug.logWarning("TexCoordDamper2D NYI")}))),x3dom.registerNodeType("X3DInterpolatorNode","Interpolation",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DInterpolatorNode.superClass.call(this,e),this.addField_MFFloat(e,"key",[]),this.addField_SFFloat(e,"set_fraction",0)}),{linearInterp:function(e,t){if(e&lt;=this._vf.key[0])return this._vf.keyValue[0];if(e&gt;=this._vf.key[this._vf.key.length-1])return this._vf.keyValue[this._vf.key.length-1];for(var i=0;i&lt;this._vf.key.length-1;++i)if(this._vf.key[i]&lt;e&amp;&amp;e&lt;=this._vf.key[i+1])return t(this._vf.keyValue[i],this._vf.keyValue[i+1],(e-this._vf.key[i])/(this._vf.key[i+1]-this._vf.key[i]));return this._vf.keyValue[0]}})),x3dom.registerNodeType("OrientationInterpolator","Interpolation",defineClass(x3dom.nodeTypes.X3DInterpolatorNode,(function(e){x3dom.nodeTypes.OrientationInterpolator.superClass.call(this,e),this.addField_MFRotation(e,"keyValue",[])}),{fieldChanged:function(e){if("set_fraction"===e){var t=this.linearInterp(this._vf.set_fraction,(function(e,t,i){return e.slerp(t,i)}));this.postMessage("value_changed",t)}}})),x3dom.registerNodeType("PositionInterpolator","Interpolation",defineClass(x3dom.nodeTypes.X3DInterpolatorNode,(function(e){x3dom.nodeTypes.PositionInterpolator.superClass.call(this,e),this.addField_MFVec3f(e,"keyValue",[])}),{fieldChanged:function(e){if("set_fraction"===e){var t=this.linearInterp(this._vf.set_fraction,(function(e,t,i){return e.multiply(1-i).add(t.multiply(i))}));this.postMessage("value_changed",t)}}})),x3dom.registerNodeType("NormalInterpolator","Interpolation",defineClass(x3dom.nodeTypes.X3DInterpolatorNode,(function(e){x3dom.nodeTypes.NormalInterpolator.superClass.call(this,e),this.addField_MFVec3f(e,"keyValue",[])}),{fieldChanged:function(e){if("set_fraction"===e){var t=this.linearInterp(this._vf.set_fraction,(function(e,t,i){return e.multiply(1-i).add(t.multiply(i)).normalize()}));this.postMessage("value_changed",t)}}})),x3dom.registerNodeType("ColorInterpolator","Interpolation",defineClass(x3dom.nodeTypes.X3DInterpolatorNode,(function(e){x3dom.nodeTypes.ColorInterpolator.superClass.call(this,e),this.addField_MFColor(e,"keyValue",[])}),{fieldChanged:function(e){if("set_fraction"===e){var t=this.linearInterp(this._vf.set_fraction,(function(e,t,i){return e.multiply(1-i).add(t.multiply(i))}));this.postMessage("value_changed",t)}}})),x3dom.registerNodeType("ScalarInterpolator","Interpolation",defineClass(x3dom.nodeTypes.X3DInterpolatorNode,(function(e){x3dom.nodeTypes.ScalarInterpolator.superClass.call(this,e),this.addField_MFFloat(e,"keyValue",[])}),{fieldChanged:function(e){if("set_fraction"===e){var t=this.linearInterp(this._vf.set_fraction,(function(e,t,i){return(1-i)*e+i*t}));this.postMessage("value_changed",t)}}})),x3dom.registerNodeType("CoordinateInterpolator","Interpolation",defineClass(x3dom.nodeTypes.X3DInterpolatorNode,(function(e){if(x3dom.nodeTypes.CoordinateInterpolator.superClass.call(this,e),this.addField_MFVec3f(e,"keyValue",[]),e&amp;&amp;e.xmlNode.hasAttribute("keyValue")){this._vf.keyValue=[];for(var t=x3dom.fields.MFVec3f.parse(e.xmlNode.getAttribute("keyValue")),i=this._vf.key.length&gt;0?this._vf.key.length:1,s=t.length/i,r=0;r&lt;i;r++){for(var o=new x3dom.fields.MFVec3f,n=0;n&lt;s;n++)o.push(t[r*s+n]);this._vf.keyValue.push(o)}}}),{fieldChanged:function(e){if("set_fraction"===e){var t=this.linearInterp(this._vf.set_fraction,(function(e,t,i){for(var s=new x3dom.fields.MFVec3f,r=0;r&lt;e.length;r++)s.push(e[r].multiply(1-i).add(t[r].multiply(i)));return s}));this.postMessage("value_changed",t)}}})),x3dom.registerNodeType("SplinePositionInterpolator","Interpolation",defineClass(x3dom.nodeTypes.X3DInterpolatorNode,(function(e){x3dom.nodeTypes.SplinePositionInterpolator.superClass.call(this,e),this.addField_MFVec3f(e,"keyValue",[]),this.addField_MFVec3f(e,"keyVelocity",[]),this.addField_SFBool(e,"closed",!1),this.addField_SFBool(e,"normalizeVelocity",!1),this.dtot=0,this.T0=[],this.T1=[],this.checkSanity=function(){this._vf.key.length==this._vf.keyValue.length&amp;&amp;(this._vf.key.length==this._vf.keyVelocity.length||2==this._vf.keyVelocity.length&amp;&amp;this._vf.key.length&gt;=2||0==this._vf.keyVelocity.length)||x3dom.debug.logWarning("SplinePositionInterpolator Node: 'key' , 'keyValue' and/or 'keyVelocity' fields have inappropriate sizes")},this.calcDtot=function(){this.dtot=0;for(var e=0;e&lt;this._vf.key.length-1;e++)this.dtot+=Math.abs(this._vf.key[e]-this._vf.key[e+1])},this.calcAdjustedKeyVelocity=function(){var e,t,i,s,r=this._vf.key.length;if(this._vf.keyVelocity.length==r)for(e=0;e&lt;r;e++)t=this._vf.keyVelocity[e],this._vf.normalizeVelocity&amp;&amp;(t=t.multiply(this.dtot/t.length())),i=0==e||e==r-1?1:2*(this._vf.key[e]-this._vf.key[e-1])/(this._vf.key[e+1]-this._vf.key[e-1]),s=0==e||e==r-1?1:2*(this._vf.key[e+1]-this._vf.key[e])/(this._vf.key[e+1]-this._vf.key[e-1]),this.T0[e]=t.multiply(i),this.T1[e]=t.multiply(s);else if(2==this._vf.keyVelocity.length&amp;&amp;r&gt;2)for(e=0;e&lt;r;e++)t=0==e?this._vf.keyVelocity[0]:e==r-1?this._vf.keyVelocity[1]:this._vf.keyValue[e+1].subtract(this._vf.keyValue[e-1]).multiply(.5),this._vf.normalizeVelocity&amp;&amp;(t=t.multiply(this.dtot/t.length())),i=0==e||e==r-1?1:2*(this._vf.key[e]-this._vf.key[e-1])/(this._vf.key[e+1]-this._vf.key[e-1]),s=0==e||e==r-1?1:2*(this._vf.key[e+1]-this._vf.key[e])/(this._vf.key[e+1]-this._vf.key[e-1]),this.T0[e]=t.multiply(i),this.T1[e]=t.multiply(s);else{var o=this._vf.closed&amp;&amp;this._vf.keyValue[0].equals(this._vf.keyValue[r-1],1e-5);for(e=0;e&lt;r;e++)0!=e&amp;&amp;e!=r-1||o?(0!=e&amp;&amp;e!=r-1||!o?(t=this._vf.keyValue[e+1].subtract(this._vf.keyValue[e-1]).multiply(.5),i=2*(this._vf.key[e]-this._vf.key[e-1])/(this._vf.key[e+1]-this._vf.key[e-1]),s=2*(this._vf.key[e+1]-this._vf.key[e])/(this._vf.key[e+1]-this._vf.key[e-1])):(t=this._vf.keyValue[1].subtract(this._vf.keyValue[r-2]).multiply(.5),0==e?(i=2*(this._vf.key[0]-this._vf.key[r-2])/(this._vf.key[1]-this._vf.key[r-2]),s=2*(this._vf.key[1]-this._vf.key[0])/(this._vf.key[1]-this._vf.key[r-2])):(i=2*(this._vf.key[r-1]-this._vf.key[r-2])/(this._vf.key[1]-this._vf.key[r-2]),s=2*(this._vf.key[1]-this._vf.key[r-1])/(this._vf.key[1]-this._vf.key[r-2])),i=2*(this._vf.key[r-1]-this._vf.key[r-2])/(this._vf.key[r-2]-this._vf.key[1]),s=2*(this._vf.key[1]-this._vf.key[0])/(this._vf.key[r-2]-this._vf.key[1])),this.T0[e]=t.multiply(i),this.T1[e]=t.multiply(s)):(this.T0[e]=new x3dom.fields.SFVec3f(0,0,0),this.T1[e]=new x3dom.fields.SFVec3f(0,0,0))}},this.checkSanity(),this.calcDtot(),this.calcAdjustedKeyVelocity()}),{fieldChanged:function(e){switch(e){case"key":case"keyValue":case"keyVelocity":this.checkSanity(),this.calcDtot(),this.calcAdjustedKeyVelocity();break;case"closed":case"normalizeVelocity":this.calcAdjustedKeyVelocity();break;case"set_fraction":var t;this._vf.key.length&gt;0&amp;&amp;(this._vf.set_fraction&lt;=this._vf.key[0]?t=x3dom.fields.SFVec3f.copy(this._vf.keyValue[0]):this._vf.set_fraction&gt;=this._vf.key[this._vf.key.length-1]&amp;&amp;(t=x3dom.fields.SFVec3f.copy(this._vf.keyValue[this._vf.key.length-1])));for(var i=0;i&lt;this._vf.key.length-1;i++)if(this._vf.key[i]&lt;this._vf.set_fraction&amp;&amp;this._vf.set_fraction&lt;=this._vf.key[i+1]){var s=(this._vf.set_fraction-this._vf.key[i])/(this._vf.key[i+1]-this._vf.key[i]),r=new x3dom.fields.SFVec4f(2*s*s*s-3*s*s+1,-2*s*s*s+3*s*s,s*s*s-2*s*s+s,s*s*s-s*s);t=new x3dom.fields.SFVec3f(r.x*this._vf.keyValue[i].x+r.y*this._vf.keyValue[i+1].x+r.z*this.T0[i].x+r.w*this.T1[i+1].x,r.x*this._vf.keyValue[i].y+r.y*this._vf.keyValue[i+1].y+r.z*this.T0[i].y+r.w*this.T1[i+1].y,r.x*this._vf.keyValue[i].z+r.y*this._vf.keyValue[i+1].z+r.z*this.T0[i].z+r.w*this.T1[i+1].z);break}void 0!==t?this.postMessage("value_changed",t):x3dom.debug.logWarning("SplinePositionInterpolator Node: value_changed is undefined!")}}})),x3dom.registerNodeType("TimeSensor","Time",defineClass(x3dom.nodeTypes.X3DSensorNode,(function(e){x3dom.nodeTypes.TimeSensor.superClass.call(this,e),e?e.doc._nodeBag.timer.push(this):x3dom.debug.logWarning("TimeSensor: No runtime context found!"),this.addField_SFTime(e,"cycleInterval",1),this.addField_SFBool(e,"loop",!1),this.addField_SFTime(e,"startTime",0),this.addField_SFTime(e,"stopTime",0),this.addField_SFTime(e,"pauseTime",0),this.addField_SFTime(e,"resumeTime",0),this.addField_SFTime(e,"cycleTime",0),this.addField_SFTime(e,"elapsedTime",0),this.addField_SFFloat(e,"fraction_changed",0),this.addField_SFBool(e,"isActive",!1),this.addField_SFBool(e,"isPaused",!1),this.addField_SFTime(e,"time",0),this.addField_SFBool(e,"first",!0),this.addField_SFFloat(e,"firstCycle",0),this._prevCycle=-1,this._lastTime=0,this._cycleStopTime=0,this._activatedTime=0,this._vf.startTime&gt;0&amp;&amp;this._updateCycleStopTime(),this._backupStartTime=this._vf.startTime,this._backupStopTime=this._vf.stopTime,this._backupCycleInterval=this._vf.cycleInterval}),{tick:function(e){if(!this._vf.enabled)return this._lastTime=e,!1;var t=this._vf.cycleInterval&gt;0&amp;&amp;e&gt;=this._vf.startTime&amp;&amp;(e&lt;this._vf.stopTime||this._vf.stopTime&lt;=this._vf.startTime)&amp;&amp;(1==this._vf.loop||0==this._vf.loop&amp;&amp;e&lt;this._cycleStopTime);if(t&amp;&amp;!this._vf.isActive&amp;&amp;(this.postMessage("isActive",!0),this._activatedTime=e),t||this._vf.isActive){this.postMessage("elapsedTime",e-this._activatedTime);var i=e&gt;=this._vf.pauseTime&amp;&amp;this._vf.pauseTime&gt;this._vf.resumeTime;if(i&amp;&amp;!this._vf.isPaused?(this.postMessage("isPaused",!0),this.postMessage("pauseTime",e)):!i&amp;&amp;this._vf.isPaused&amp;&amp;(this.postMessage("isPaused",!1),this.postMessage("resumeTime",e)),!i){var s=this._getCycleAt(e),r=Math.floor(s),o=this._vf.startTime+r*this._vf.cycleInterval,n=0;this._vf.stopTime&gt;this._vf.startTime&amp;&amp;this._lastTime&lt;this._vf.stopTime&amp;&amp;e&gt;=this._vf.stopTime?n=this._vf.stopTime:this._lastTime&lt;o&amp;&amp;e&gt;=o&amp;&amp;(n=o),n&gt;0&amp;&amp;(e=n,s=this._getCycleAt(e),r=Math.floor(s));var a=s-r;a&lt;x3dom.fields.Eps&amp;&amp;(a=this._lastTime&lt;this._vf.startTime?0:1,this.postMessage("cycleTime",e)),this.postMessage("fraction_changed",a),this.postMessage("time",e)}}return!t&amp;&amp;this._vf.isActive&amp;&amp;this.postMessage("isActive",!1),this._lastTime=e,!0},fieldChanged:function(e){if("enabled"==e)!this._vf.enabled&amp;&amp;this._vf.isActive&amp;&amp;this.postMessage("isActive",!1);else if("startTime"==e){if(this._vf.isActive)return void(this._vf.startTime=this._backupStartTime);this._backupStartTime=this._vf.startTime,this._updateCycleStopTime()}else if("stopTime"==e){if(this._vf.isActive&amp;&amp;this._vf.stopTime&lt;=this._vf.startTime)return void(this._vf.stopTime=this._backupStopTime);this._backupStopTime=this._vf.stopTime}else if("cycleInterval"==e){if(this._vf.isActive)return void(this._vf.cycleInterval=this._backupCycleInterval);this._backupCycleInterval=this._vf.cycleInterval}else"loop"==e&amp;&amp;this._updateCycleStopTime()},parentRemoved:function(e){if(0===this._parentNodes.length)for(var t=this.findX3DDoc(),i=0,s=t._nodeBag.timer.length;i&lt;s;i++)t._nodeBag.timer[i]===this&amp;&amp;t._nodeBag.timer.splice(i,1)},_getCycleAt:function(e){return Math.max(0,e-this._vf.startTime)/this._vf.cycleInterval},_updateCycleStopTime:function(){if(0==this._vf.loop){var e=(new Date).getTime()/1e3,t=Math.floor(this._getCycleAt(e))+1;this._cycleStopTime=this._vf.startTime+t*this._vf.cycleInterval}else this._cycleStopTime=0}})),x3dom.registerNodeType("X3DTimeDependentNode","Time",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DTimeDependentNode.superClass.call(this,e),this.addField_SFBool(e,"loop",!1)}))),x3dom.registerNodeType("Anchor","Networking",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.Anchor.superClass.call(this,e),this.addField_MFString(e,"url",[]),this.addField_MFString(e,"parameter",[]),this.addField_SFString(e,"description","")}),{doIntersect:function(e){for(var t=!1,i=0;i&lt;this._childNodes.length;i++)this._childNodes[i]&amp;&amp;(t=this._childNodes[i].doIntersect(e)||t);return t},handleTouch:function(){var e=this._vf.url.length?this._vf.url[0]:"",t=e.search("#"),i="";t&gt;=0&amp;&amp;(i=e.slice(t+1));var s=this._vf.parameter.length?this._vf.parameter[0]:"",r=s.search("target="),o="";r&gt;=0&amp;&amp;(o=s.slice(r+7)),x3dom.debug.logInfo("Anchor url="+e+", target="+o+", #viewpoint="+i),0!=o.length||"_self"!=o?window.open(this._nameSpace.getURL(e),o):window.location=this._nameSpace.getURL(e)}})),x3dom.registerNodeType("Inline","Networking",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.Inline.superClass.call(this,e),this.addField_MFString(e,"url",[]),this.addField_SFBool(e,"load",!0),this.addField_MFString(e,"nameSpaceName",[]),this.addField_SFBool(e,"mapDEFToID",!1),this.initDone=!1,this.count=0,this.numRetries=x3dom.nodeTypes.Inline.MaximumRetries}),{fieldChanged:function(e){if("url"==e){for(var t=0;t&lt;this._childNodes.length;t++)this.removeChild(this._childNodes[t]);if(0!=this._vf.nameSpaceName.length){var i=this._xmlNode;if(i&amp;&amp;i.hasChildNodes())for(;i.childNodes.length&gt;=1;)i.removeChild(i.firstChild)}this.loadInline()}else"render"==e&amp;&amp;this.invalidateVolume()},nodeChanged:function(){this.initDone||(this.initDone=!0,this.loadInline())},fireEvents:function(e){if(this._xmlNode&amp;&amp;(this._xmlNode["on"+e]||this._xmlNode.hasAttribute("on"+e)||this._listeners[e])){var t={target:this._xmlNode,type:e,error:"error"==e?"XMLHttpRequest Error":"",cancelBubble:!1,stopPropagation:function(){this.cancelBubble=!0}};try{var i=this._xmlNode["on"+e];if("function"===typeof i)i.call(this._xmlNode,t);else{var s=this._xmlNode.getAttribute("on"+e);new Function("event",s).call(this._xmlNode,t)}var r=this._listeners[e];if(r)for(var o=0;o&lt;r.length;o++)r[o].call(this._xmlNode,t)}catch(n){x3dom.debug.logException(n)}}},loadInline:function(){var e=this,t=new window.XMLHttpRequest;if(t.overrideMimeType&amp;&amp;t.overrideMimeType("text/xml"),t.onreadystatechange=function(){if(4!=t.readyState)return t;if(t.status===x3dom.nodeTypes.Inline.AwaitTranscoding){if(e.count&lt;e.numRetries){e.count++;var i=+t.getResponseHeader("Refresh")||5;return x3dom.debug.logInfo("XHR status: "+t.status+" - Await Transcoding ("+e.count+"/"+e.numRetries+"): Next request in "+i+" seconds"),window.setTimeout((function(){e._nameSpace.doc.downloadCount-=1,e.loadInline()}),1e3*i),t}return x3dom.debug.logError("XHR status: "+t.status+" - Await Transcoding ("+e.count+"/"+e.numRetries+"): No Retries left"),e._nameSpace.doc.downloadCount-=1,e.count=0,t}if(200!==t.status&amp;&amp;0!==t.status)return e.fireEvents("error"),x3dom.debug.logError("XHR status: "+t.status+" - XMLHttpRequest requires web server running!"),e._nameSpace.doc.downloadCount-=1,e.count=0,t;200!=t.status&amp;&amp;0!=t.status||(e.count=0),x3dom.debug.logInfo("Inline: downloading "+e._vf.url[0]+" done.");var s=null,r=null,o=null,n=null;if(void 0!==(n="Microsoft Internet Explorer"!=navigator.appName?t.responseXML:(new DOMParser).parseFromString(t.responseText,"text/xml"))&amp;&amp;null!==n?s=n.getElementsByTagName("Scene")[0]||n.getElementsByTagName("scene")[0]:e.fireEvents("error"),s){var a=0!=e._vf.nameSpaceName.length?e._vf.nameSpaceName.toString().replace(" ",""):"";o=new x3dom.NodeNameSpace(a,e._nameSpace.doc);var h=e._vf.url.length?e._vf.url[0]:"";"/"===h[0]||h.indexOf(":")&gt;=0?o.setBaseURL(h):o.setBaseURL(e._nameSpace.baseURL+h),r=o.setupTree(s),e._nameSpace.addSpace(o),0!=e._vf.nameSpaceName.length&amp;&amp;Array.forEach(s.childNodes,(function(t){t instanceof Element&amp;&amp;(setNamespace(e._vf.nameSpaceName,t,e._vf.mapDEFToID),e._xmlNode.appendChild(t))}))}else n&amp;&amp;n.localName?x3dom.debug.logError("No Scene in "+n.localName):x3dom.debug.logError("No Scene in resource");var d=x3dom.getGlobal();for(e._childNodes.length&gt;0&amp;&amp;e._childNodes[0]&amp;&amp;e._childNodes[0]._nameSpace&amp;&amp;e._nameSpace.removeSpace(e._childNodes[0]._nameSpace);0!==e._childNodes.length;)d._remover=e.removeChild(e._childNodes[0]);if(delete d._remover,r){e.addChild(r),e.invalidateVolume(),e._nameSpace.doc.downloadCount-=1,e._nameSpace.doc.needRender=!0,x3dom.debug.logInfo("Inline: added "+e._vf.url[0]+" to scene.");var l=e._nameSpace.doc._scene;l&amp;&amp;(l.invalidateVolume(),window.setTimeout((function(){e.invalidateVolume(),l.updateVolume(),e._nameSpace.doc.needRender=!0}),1e3)),e.fireEvents("load")}return r=null,o=null,s=null,n=null,t},this._vf.url.length&amp;&amp;this._vf.url[0].length){var i=this._nameSpace.getURL(this._vf.url[0]);t.open("GET",i,!0),this._nameSpace.doc.downloadCount+=1;try{x3dom.RequestManager.addRequest(t)}catch(s){this.fireEvents("error"),x3dom.debug.logError(this._vf.url[0]+": "+s)}}}})),x3dom.nodeTypes.Inline.AwaitTranscoding=202,x3dom.nodeTypes.Inline.MaximumRetries=15,x3dom.registerNodeType("MultiPart","Networking",defineClass(x3dom.nodeTypes.Inline,(function(e){x3dom.nodeTypes.MultiPart.superClass.call(this,e),this.addField_MFString(e,"urlIDMap",[]),this.addField_SFBool(e,"isPickable",!0),this.addField_SFString(e,"sortType","auto"),this.addField_SFBool(e,"solid",!1),this.addField_SFInt32(e,"sortKey",0),this.addField_SFString(e,"initialVisibility","auto"),this._idMap=null,this._inlineNamespace=null,this._highlightedParts=[],this._minId=0,this._maxId=0,this._lastId=-1,this._lastClickedId=-1,this._lastButton=0,this._identifierToPartId=[],this._identifierToAppId=[],this._visiblePartsPerShape=[],this._partVolume=[],this._partVisibility=[],this._originalColor=[],this._materials=[]}),{fieldChanged:function(e){if("url"==e){if(0!=this._vf.nameSpaceName.length){var t=this._xmlNode;if(t&amp;&amp;t.hasChildNodes())for(;t.childNodes.length&gt;=1;)t.removeChild(t.firstChild)}this.loadInline()}else"render"==e&amp;&amp;this.invalidateVolume()},nodeChanged:function(){this.initDone||(this.initDone=!0,this.loadIDMap())},getVolume:function(){var e=this._graph.volume;if(!this.volumeValid()&amp;&amp;this._vf.render)for(var t=0;t&lt;this._partVisibility.length;t++)if(this._partVisibility[t]){var i=this._partVolume[t];i&amp;&amp;i.isValid()&amp;&amp;e.extendBounds(i.min,i.max)}if(!e.equals(this._graph.lastVolume)){this._graph.lastVolume=x3dom.fields.BoxVolume.copy(e);var s={target:this._xmlNode,type:"volumechanged",volume:x3dom.fields.BoxVolume.copy(e)};this.callEvtHandler("onvolumechanged",s)}return e},handleEvents:function(e){if(this._inlineNamespace){var t=this._inlineNamespace.defMap.MultiMaterial_ColorMap,i=this._inlineNamespace.defMap.MultiMaterial_EmissiveMap,s=this._inlineNamespace.defMap.MultiMaterial_SpecularMap,r=this._inlineNamespace.defMap.MultiMaterial_VisibilityMap;-1==e.pickedId&amp;&amp;0!=e.button?(this._lastClickedId=-1,this._lastButton=e.button):-1==e.pickedId&amp;&amp;0==e.button&amp;&amp;(this._lastClickedId=-1,this._lastButton=0),-1!=e.pickedId?(e.part=new x3dom.Parts(this,[e.pickedId-this._minId],t,i,s,r),e.partID=this._idMap.mapping[e.pickedId-this._minId].name,e.type="mousemove",this.callEvtHandler("onmousemove",e),e.type="mouseover",this.callEvtHandler("onmouseover",e),!e.mouseup&amp;&amp;e.button&amp;&amp;e.button!=this._lastButton&amp;&amp;(e.type="mousedown",this._lastButton=e.button,-1==this._lastClickedId&amp;&amp;(this._lastClickedId=e.pickedId),this.callEvtHandler("onmousedown",e)),(e.mouseup||0!=this._lastButton&amp;&amp;0==e.button)&amp;&amp;(e.type="mouseup",this.callEvtHandler("onmouseup",e),this._lastButton=0,e.pickedId==this._lastClickedId&amp;&amp;(this._lastClickedId=-1,e.type="click",this.callEvtHandler("onclick",e)),this._lastClickedId=-1),e.pickedId!=this._lastId&amp;&amp;(-1!=this._lastId&amp;&amp;(e.part=new x3dom.Parts(this,[this._lastId-this._minId],t,i,s,r),e.partID=this._idMap.mapping[this._lastId-this._minId].name,e.type="mouseleave",this.callEvtHandler("onmouseleave",e)),e.part=new x3dom.Parts(this,[e.pickedId-this._minId],t,i,s,r),e.partID=this._idMap.mapping[e.pickedId-this._minId].name,e.type="mouseenter",this.callEvtHandler("onmouseenter",e),this._lastId=e.pickedId),this._lastId=e.pickedId):-1!=this._lastId&amp;&amp;(e.part=new x3dom.Parts(this,[this._lastId-this._minId],t,i,s,r),e.partID=this._idMap.mapping[this._lastId-this._minId].name,e.type="mouseout",this.callEvtHandler("onmouseout",e),e.type="mouseleave",this.callEvtHandler("onmouseleave",e),this._lastId=-1)}},loadIDMap:function(){if(this._vf.urlIDMap.length&amp;&amp;this._vf.urlIDMap[0].length){var e,t=this,i=this._nameSpace.getURL(this._vf.urlIDMap[0]),s=new XMLHttpRequest;s.open("GET",i,!0),s.onload=function(){for(t._idMap=JSON.parse(this.responseText),null==t._nameSpace.doc._scene._multiPartMap&amp;&amp;(t._nameSpace.doc._scene._multiPartMap={numberOfIds:0,multiParts:[]}),t._minId=t._nameSpace.doc._scene._multiPartMap.numberOfIds,t._maxId=t._minId+t._idMap.numberOfIDs-1,t._nameSpace.doc._scene._multiPartMap.numberOfIds+=t._idMap.numberOfIDs,t._nameSpace.doc._scene._multiPartMap.multiParts.push(t),e=0;e&lt;t._idMap.mapping.length;e++)if(t._identifierToPartId[t._idMap.mapping[e].name]||(t._identifierToPartId[t._idMap.mapping[e].name]=[]),t._identifierToPartId[t._idMap.mapping[e].appearance]||(t._identifierToPartId[t._idMap.mapping[e].appearance]=[]),t._identifierToPartId[t._idMap.mapping[e].name].push(e),t._identifierToPartId[t._idMap.mapping[e].appearance].push(e),!t._partVolume[e]){var i=x3dom.fields.SFVec3f.parse(t._idMap.mapping[e].min),s=x3dom.fields.SFVec3f.parse(t._idMap.mapping[e].max);t._partVolume[e]=new x3dom.fields.BoxVolume(i,s)}for(e=0;e&lt;t._idMap.appearance.length;e++)t._identifierToAppId[t._idMap.appearance[e].name]=e;t.loadInline()},x3dom.RequestManager.addRequest(s)}},createMaterialData:function(){for(var e,t,i,s,r,o,n,a,h,d,l,u,f="",c="",m="",_="",p="",x="",g=Math.ceil(Math.sqrt(this._idMap.numberOfIDs)),v=2*(g=x3dom.Utils.nextHighestPowerOfTwo(g)),y=g+" "+v+" 4",b=g+" "+v+" 4",T=g+" "+v+" 4",S=0;S&lt;g*g;S++)if(S&lt;this._idMap.mapping.length){var w=this._idMap.mapping[S].appearance,M=this._identifierToAppId[w];o=this._idMap.appearance[M].material.ambientIntensity?this._idMap.appearance[M].material.ambientIntensity:"0.2",u=this._idMap.appearance[M].material.backAmbientIntensity?this._idMap.appearance[M].material.backAmbientIntensity:o,e=this._idMap.appearance[M].material.diffuseColor?this._idMap.appearance[M].material.diffuseColor:"0.8 0.8 0.8",n=this._idMap.appearance[M].material.backDiffuseColor?this._idMap.appearance[M].material.backDiffuseColor:e,r=this._idMap.appearance[M].material.emissiveColor?this._idMap.appearance[M].material.emissiveColor:"0.0 0.0 0.0",l=this._idMap.appearance[M].material.backEmissiveColor?this._idMap.appearance[M].material.backEmissiveColor:r,s=this._idMap.appearance[M].material.shininess?this._idMap.appearance[M].material.shininess:"0.2",d=this._idMap.appearance[M].material.backShininess?this._idMap.appearance[M].material.backShininess:s,i=this._idMap.appearance[M].material.specularColor?this._idMap.appearance[M].material.specularColor:"0 0 0",h=this._idMap.appearance[M].material.backSpecularColor?this._idMap.appearance[M].material.backSpecularColor:i,t=this._idMap.appearance[M].material.transparency?this._idMap.appearance[M].material.transparency:0,a=this._idMap.appearance[M].material.backTransparency?this._idMap.appearance[M].material.backTransparency:t,f+=" "+x3dom.fields.SFColorRGBA.parse(e+" "+(1-t)).toUint(),c+=" "+x3dom.fields.SFColorRGBA.parse(i+" "+s).toUint(),m+=" "+x3dom.fields.SFColorRGBA.parse(r+" "+o).toUint(),_+=" "+x3dom.fields.SFColorRGBA.parse(n+" "+(1-a)).toUint(),p+=" "+x3dom.fields.SFColorRGBA.parse(h+" "+d).toUint(),x+=" "+x3dom.fields.SFColorRGBA.parse(l+" "+u).toUint(),this._originalColor[S]=f,this._materials[S]=new x3dom.MultiMaterial({ambientIntensity:o,diffuseColor:x3dom.fields.SFColor.parse(e),emissiveColor:x3dom.fields.SFColor.parse(r),shininess:s,specularColor:x3dom.fields.SFColor.parse(i),transparency:t,backAmbientIntensity:u,backDiffuseColor:x3dom.fields.SFColor.parse(n),backEmissiveColor:x3dom.fields.SFColor.parse(l),backShininess:d,backSpecularColor:x3dom.fields.SFColor.parse(h),backTransparency:a})}else f+=" 255",c+=" 255",m+=" 255",_+=" 255",p+=" 255",x+=" 255";return{diffuseTransparency:y+=f+_,specularShininess:b+=c+p,emissiveAmbientIntensity:T+=m+x}},createVisibilityData:function(){var e,t,i=Math.ceil(Math.sqrt(this._idMap.numberOfIDs)),s=(i=x3dom.Utils.nextHighestPowerOfTwo(i))+" "+i+" 1";for(e=0;e&lt;i*i;e++)if(e&lt;this._idMap.mapping.length){if("auto"==this._vf.initialVisibility)for(s+=" 255",this._partVisibility[e]||(this._partVisibility[e]=!0),t=0;t&lt;this._idMap.mapping[e].usage.length;t++)this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]]||(this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]]={val:0,max:0}),this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]].val++,this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]].max++;else if("visible"==this._vf.initialVisibility)for(s+=" 255",this._partVisibility[e]||(this._partVisibility[e]=!0),t=0;t&lt;this._idMap.mapping[e].usage.length;t++)this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]]||(this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]]={val:0,max:0}),this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]].val++,this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]].max++;else if("invisible"==this._vf.initialVisibility)for(s+=" 0",this._partVisibility[e]||(this._partVisibility[e]=!1),t=0;t&lt;this._idMap.mapping[e].usage.length;t++)this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]]||(this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]]={val:0,max:0}),this._visiblePartsPerShape[this._idMap.mapping[e].usage[t]].max++}else s+=" 0";return s},replaceMaterials:function(e){var t,i,s,r,o,n=!0;if(e&amp;&amp;e.hasChildNodes()){s=this.createMaterialData(),r=this.createVisibilityData();for(var a=e.getElementsByTagName("Shape"),h=0;h&lt;a.length;h++){(i=a[h].getAttribute("DEF")||a[h].getAttribute("def"))&amp;&amp;this._visiblePartsPerShape[i]&amp;&amp;0==this._visiblePartsPerShape[i].val&amp;&amp;a[h].setAttribute("render","false"),a[h].setAttribute("idOffset",this._minId),a[h].setAttribute("isPickable",this._vf.isPickable);var d=a[h].getElementsByTagName("BinaryGeometry");if(d&amp;&amp;d.length)for(var l=0;l&lt;d.length;l++)d[l].setAttribute("solid",this._vf.solid);var u=a[h].getElementsByTagName("Appearance");if(u.length)for(var f=0;f&lt;u.length;f++){u[f].removeAttribute("DEF"),u[f].removeAttribute("USE"),u[f].setAttribute("sortType",this._vf.sortType),u[f].setAttribute("sortKey",this._vf.sortKey);var c=u[f].getElementsByTagName("Material");if(c.length){if(n)n=!1,(t=document.createElement("CommonSurfaceShader")).setAttribute("DEF","MultiMaterial"),(m=document.createElement("PixelTexture")).setAttribute("containerField","multiDiffuseAlphaTexture"),m.setAttribute("id","MultiMaterial_ColorMap"),m.setAttribute("image",s.diffuseTransparency),(_=document.createElement("PixelTexture")).setAttribute("containerField","multiEmissiveAmbientTexture"),_.setAttribute("id","MultiMaterial_EmissiveMap"),_.setAttribute("image",s.emissiveAmbientIntensity),(p=document.createElement("PixelTexture")).setAttribute("containerField","multiSpecularShininessTexture"),p.setAttribute("id","MultiMaterial_SpecularMap"),p.setAttribute("image",s.specularShininess),(x=document.createElement("PixelTexture")).setAttribute("containerField","multiVisibilityTexture"),x.setAttribute("id","MultiMaterial_VisibilityMap"),x.setAttribute("image",r),t.appendChild(m),t.appendChild(_),t.appendChild(p),t.appendChild(x);else(t=document.createElement("CommonSurfaceShader")).setAttribute("USE","MultiMaterial");u[f].replaceChild(t,c[0])}else{if(n)n=!1,(t=document.createElement("CommonSurfaceShader")).setAttribute("DEF","MultiMaterial"),(m=document.createElement("PixelTexture")).setAttribute("containerField","multiDiffuseAlphaTexture"),m.setAttribute("id","MultiMaterial_ColorMap"),m.setAttribute("image",s.diffuseTransparency),(_=document.createElement("PixelTexture")).setAttribute("containerField","multiEmissiveAmbientTexture"),_.setAttribute("id","MultiMaterial_EmissiveMap"),_.setAttribute("image",s.emissiveAmbientIntensity),(p=document.createElement("PixelTexture")).setAttribute("containerField","multiSpecularShininessTexture"),p.setAttribute("id","MultiMaterial_SpecularMap"),p.setAttribute("image",s.specularShininess),(x=document.createElement("PixelTexture")).setAttribute("containerField","multiVisibilityTexture"),x.setAttribute("id","MultiMaterial_VisibilityMap"),x.setAttribute("image",r),t.appendChild(m),t.appendChild(_),t.appendChild(p),t.appendChild(x);else(t=document.createElement("CommonSurfaceShader")).setAttribute("USE","MultiMaterial");u[f].appendChild(t)}}else{var m,_,p,x;if(o=document.createElement("Appearance"),n)n=!1,(t=document.createElement("CommonSurfaceShader")).setAttribute("DEF","MultiMaterial"),(m=document.createElement("PixelTexture")).setAttribute("containerField","multiDiffuseAlphaTexture"),m.setAttribute("id","MultiMaterial_ColorMap"),m.setAttribute("image",s.diffuseTransparency),(_=document.createElement("PixelTexture")).setAttribute("containerField","multiEmissiveAmbientTexture"),_.setAttribute("id","MultiMaterial_EmissiveMap"),_.setAttribute("image",s.emissiveAmbientIntensity),(p=document.createElement("PixelTexture")).setAttribute("containerField","multiSpecularShininessTexture"),p.setAttribute("id","MultiMaterial_SpecularMap"),p.setAttribute("image",s.specularShininess),(x=document.createElement("PixelTexture")).setAttribute("containerField","multiVisibilityTexture"),x.setAttribute("id","MultiMaterial_VisibilityMap"),x.setAttribute("image",r),t.appendChild(m),t.appendChild(_),t.appendChild(p),t.appendChild(x);else(t=document.createElement("CommonSurfaceShader")).setAttribute("USE","MultiMaterial");o.appendChild(t),d[l].appendChild(o)}}}},appendAPI:function(){var e=this;this._xmlNode.getIdList=function(){var t,i=[];for(t=0;t&lt;e._idMap.mapping.length;t++)i.push(e._idMap.mapping[t].name);return i},this._xmlNode.getAppearanceIdList=function(){var t,i=[];for(t=0;t&lt;e._idMap.appearance.length;t++)i.push(e._idMap.appearance[t].name);return i},this._xmlNode.getParts=function(t){var i,s,r=[];if(void 0==t)for(s=0;s&lt;e._idMap.mapping.length;s++)r.push(s);else if(t instanceof Array)for(i=0;i&lt;t.length;i++)e._identifierToPartId[t[i]]&amp;&amp;(r=r.concat(e._identifierToPartId[t[i]]));else if(t instanceof RegExp)for(var o in e._identifierToPartId)o.match(t)&amp;&amp;(r=r.concat(e._identifierToPartId[o]));var n=e._inlineNamespace.defMap.MultiMaterial_ColorMap,a=e._inlineNamespace.defMap.MultiMaterial_EmissiveMap,h=e._inlineNamespace.defMap.MultiMaterial_SpecularMap,d=e._inlineNamespace.defMap.MultiMaterial_VisibilityMap;return 0==r.length?null:new x3dom.Parts(e,r,n,a,h,d)},this._xmlNode.getPartsByRect=function(t,i,s,r){var o=e._nameSpace.doc._viewarea,n=o._scene.getViewpoint(),a=o.getViewMatrix(),h=(o.getProjectionMatrix(),new x3dom.fields.SFVec3f(a._01,a._11,a._21)),d=new x3dom.fields.SFVec3f(a._02,a._12,a._22),l=new x3dom.fields.SFVec3f(a._03,a._13,a._23),u=(t-o._width/2)/(o._width/2),f=(i-o._width/2)/(o._width/2),c=(r-o._height/2)/(o._height/2),m=(s-o._height/2)/(o._height/2),_=n._vf.fieldOfView,p=Math.tan(_/2)*n._zNear,x=Math.tan(_/2)*n._lastAspect*n._zNear,g=x3dom.fields.SFMatrix4f.perspectiveFrustum(u*x,f*x,m*p,c*p,n.getNear(),n.getFar()),v=x3dom.fields.SFMatrix4f.lookAt(l,l.subtract(d.multiply(5)),h),y=new x3dom.fields.FrustumVolume(g.mult(v)),b=[],T=this._x3domNode._partVolume;for(id in T){if(T.hasOwnProperty(id))y.intersect(T[id],0)&gt;0&amp;&amp;b.push(id)}var S=e._inlineNamespace.defMap.MultiMaterial_ColorMap,w=e._inlineNamespace.defMap.MultiMaterial_EmissiveMap,M=e._inlineNamespace.defMap.MultiMaterial_SpecularMap,E=e._inlineNamespace.defMap.MultiMaterial_VisibilityMap;return 0==b.length?null:new x3dom.Parts(e,b,S,w,M,E)}},loadInline:function(){var e=this,t=new window.XMLHttpRequest;if(t.overrideMimeType&amp;&amp;t.overrideMimeType("text/xml"),t.onreadystatechange=function(){if(4!=t.readyState)return t;if(t.status===x3dom.nodeTypes.Inline.AwaitTranscoding){if(e.count&lt;e.numRetries){e.count++;var i=+t.getResponseHeader("Refresh")||5;return x3dom.debug.logInfo("XHR status: "+t.status+" - Await Transcoding ("+e.count+"/"+e.numRetries+"): Next request in "+i+" seconds"),window.setTimeout((function(){e._nameSpace.doc.downloadCount-=1,e.loadInline()}),1e3*i),t}return x3dom.debug.logError("XHR status: "+t.status+" - Await Transcoding ("+e.count+"/"+e.numRetries+"): No Retries left"),e._nameSpace.doc.downloadCount-=1,e.count=0,t}if(200!==t.status&amp;&amp;0!==t.status)return e.fireEvents("error"),x3dom.debug.logError("XHR status: "+t.status+" - XMLHttpRequest requires web server running!"),e._nameSpace.doc.downloadCount-=1,e.count=0,t;200!=t.status&amp;&amp;0!=t.status||(e.count=0),x3dom.debug.logInfo("Inline: downloading "+e._vf.url[0]+" done.");var s=null,r=null,o=null;if(void 0!==(o="Microsoft Internet Explorer"!=navigator.appName?t.responseXML:(new DOMParser).parseFromString(t.responseText,"text/xml"))&amp;&amp;null!==o?s=o.getElementsByTagName("Scene")[0]||o.getElementsByTagName("scene")[0]:e.fireEvents("error"),s){var n="ns"+e._nameSpace.childSpaces.length,a=0!=e._vf.nameSpaceName.length?e._vf.nameSpaceName.toString().replace(" ",""):n;e._inlineNamespace=new x3dom.NodeNameSpace(a,e._nameSpace.doc);var h=e._vf.url.length?e._vf.url[0]:"";"/"===h[0]||h.indexOf(":")&gt;=0?e._inlineNamespace.setBaseURL(h):e._inlineNamespace.setBaseURL(e._nameSpace.baseURL+h),e.replaceMaterials(s),r=e._inlineNamespace.setupTree(s),e._nameSpace.addSpace(e._inlineNamespace),0!=e._vf.nameSpaceName.length&amp;&amp;Array.forEach(s.childNodes,(function(t){t instanceof Element&amp;&amp;(setNamespace(e._vf.nameSpaceName,t,e._vf.mapDEFToID),e._xmlNode.appendChild(t))}))}else o&amp;&amp;o.localName?x3dom.debug.logError("No Scene in "+o.localName):x3dom.debug.logError("No Scene in resource");var d=x3dom.getGlobal();for(e._childNodes.length&gt;0&amp;&amp;e._childNodes[0]&amp;&amp;e._childNodes[0]._nameSpace&amp;&amp;e._nameSpace.removeSpace(e._childNodes[0]._nameSpace);0!==e._childNodes.length;)d._remover=e.removeChild(e._childNodes[0]);if(delete d._remover,r){e.addChild(r),e.invalidateVolume(),e._nameSpace.doc.downloadCount-=1,e._nameSpace.doc.needRender=!0,x3dom.debug.logInfo("Inline: added "+e._vf.url[0]+" to scene.");var l=e._nameSpace.doc._scene;l&amp;&amp;(l.invalidateVolume(),window.setTimeout((function(){e.invalidateVolume(),l.updateVolume(),e._nameSpace.doc.needRender=!0}),1e3)),e.appendAPI(),e.fireEvents("load")}return r=null,s=null,o=null,t},this._vf.url.length&amp;&amp;this._vf.url[0].length){var i=this._nameSpace.getURL(this._vf.url[0]);t.open("GET",i,!0),this._nameSpace.doc.downloadCount+=1;try{x3dom.RequestManager.addRequest(t)}catch(s){this.fireEvents("error"),x3dom.debug.logError(this._vf.url[0]+": "+s)}}}})),x3dom.registerNodeType("X3DBackgroundNode","EnvironmentalEffects",defineClass(x3dom.nodeTypes.X3DBindableNode,(function(e){x3dom.nodeTypes.X3DBackgroundNode.superClass.call(this,e);var t=e&amp;&amp;e.autoGen?1:0;this.addField_SFString(e,"crossOrigin",""),this.addField_MFColor(e,"groundColor",[]),this.addField_MFFloat(e,"groundAngle",[]),this.addField_MFColor(e,"skyColor",[new x3dom.fields.SFColor(0,0,0)]),this.addField_MFFloat(e,"skyAngle",[]),this.addField_SFFloat(e,"transparency",t),this._dirty=!0}),{getSkyColor:function(){return new x3dom.fields.SFColor(0,0,0)},getTransparency:function(){return 0},getTexUrl:function(){return[]}})),x3dom.registerNodeType("X3DFogNode","EnvironmentalEffects",defineClass(x3dom.nodeTypes.X3DBindableNode,(function(e){x3dom.nodeTypes.X3DFogNode.superClass.call(this,e),this.addField_SFColor(e,"color",1,1,1),this.addField_SFString(e,"fogType","LINEAR"),this.addField_SFFloat(e,"visibilityRange",0)}),{})),x3dom.registerNodeType("Fog","EnvironmentalEffects",defineClass(x3dom.nodeTypes.X3DFogNode,(function(e){x3dom.nodeTypes.Fog.superClass.call(this,e)}),{})),x3dom.registerNodeType("Background","EnvironmentalEffects",defineClass(x3dom.nodeTypes.X3DBackgroundNode,(function(e){x3dom.nodeTypes.Background.superClass.call(this,e),this.addField_MFString(e,"backUrl",[]),this.addField_MFString(e,"bottomUrl",[]),this.addField_MFString(e,"frontUrl",[]),this.addField_MFString(e,"leftUrl",[]),this.addField_MFString(e,"rightUrl",[]),this.addField_MFString(e,"topUrl",[]),this.addField_SFBool(e,"scaling",!1)}),{fieldChanged:function(e){e.indexOf("Url")&gt;0||"transparency"==e||e.search("sky")&gt;=0||e.search("ground")&gt;=0?this._dirty=!0:e.indexOf("bind")&gt;=0&amp;&amp;this.bind(this._vf.bind)},getSkyColor:function(){return this._vf.skyColor},getGroundColor:function(){return this._vf.groundColor},getTransparency:function(){return this._vf.transparency},getTexUrl:function(){return[this._nameSpace.getURL(this._vf.backUrl[0]),this._nameSpace.getURL(this._vf.frontUrl[0]),this._nameSpace.getURL(this._vf.bottomUrl[0]),this._nameSpace.getURL(this._vf.topUrl[0]),this._nameSpace.getURL(this._vf.leftUrl[0]),this._nameSpace.getURL(this._vf.rightUrl[0])]}})),x3dom.registerNodeType("X3DEnvironmentNode","EnvironmentalEffects",defineClass(x3dom.nodeTypes.X3DBindableNode,(function(e){x3dom.nodeTypes.X3DEnvironmentNode.superClass.call(this,e)}))),x3dom.registerNodeType("Environment","EnvironmentalEffects",defineClass(x3dom.nodeTypes.X3DEnvironmentNode,(function(e){x3dom.nodeTypes.Environment.superClass.call(this,e),this.addField_SFBool(e,"sortTrans",!0),this.addField_SFBool(e,"shadowExcludeTransparentObjects",!1),this.addField_SFString(e,"gammaCorrectionDefault","linear"),this.addField_SFBool(e,"frustumCulling",!0),this.addField_SFBool(e,"smallFeatureCulling",!1),this.addField_SFFloat(e,"smallFeatureThreshold",1),this.addField_SFBool(e,"occlusionCulling",!1),this.addField_SFFloat(e,"occlusionVisibilityThreshold",0),this.addField_SFBool(e,"lowPriorityCulling",!1),this.addField_SFFloat(e,"lowPriorityThreshold",1),this.addField_SFBool(e,"tessellationDetailCulling",!1),this.addField_SFFloat(e,"tessellationErrorThreshold",0),this.addField_SFBool(e,"enableARC",!1),this.addField_SFFloat(e,"minFrameRate",1),this.addField_SFFloat(e,"maxFrameRate",62.5),this.addField_SFFloat(e,"userDataFactor",-1),this.addField_SFFloat(e,"smallFeatureFactor",-1),this.addField_SFFloat(e,"occlusionVisibilityFactor",-1),this.addField_SFFloat(e,"lowPriorityFactor",-1),this.addField_SFFloat(e,"tessellationErrorFactor",-1),this.addField_SFBool(e,"SSAO",!1),this.addField_SFFloat(e,"SSAOradius",.7),this.addField_SFFloat(e,"SSAOamount",.3),this.addField_SFInt32(e,"SSAOrandomTextureSize",4),this.addField_SFInt32(e,"SSAOblurDepthTreshold",1),this._validGammaCorrectionTypes=["none","fastlinear","linear"],this.checkSanity()}),{checkSanity:function(){var e=function(e,t,i,s){return e&amp;&amp;t==s?i:e||t==s?t:s};this._smallFeatureThreshold=e(this._vf.smallFeatureCulling,this._vf.smallFeatureThreshold,10,0),this._lowPriorityThreshold=e(this._vf.lowPriorityCulling,this._vf.lowPriorityThreshold,.5,1),this._occlusionVisibilityThreshold=e(this._vf.occlusionCulling,this._vf.occlusionVisibilityThreshold,1,0),this._tessellationErrorThreshold=e(this._vf.tessellationDetailCulling,this._vf.tessellationErrorThreshold,1,0);var t,i;this._vf.gammaCorrectionDefault=(t=this._vf.gammaCorrectionDefault,i=this,t=t.toLowerCase(),i._validGammaCorrectionTypes.indexOf(t)&gt;-1?t:(x3dom.debug.logWarning(t+" gammaCorrectionDefault may only be linear (default), fastLinear, or none"),i._validGammaCorrectionTypes[0]))}})),x3dom.registerNodeType("X3DViewpointNode","Navigation",defineClass(x3dom.nodeTypes.X3DBindableNode,(function(e){if(x3dom.nodeTypes.X3DViewpointNode.superClass.call(this,e),e&amp;&amp;e.xmlNode){var t=e.xmlNode;t.resetView||t.getFieldOfView||t.getNear||t.getFar||(t.resetView=function(){var e=this._x3domNode;e.resetView(),e._nameSpace.doc.needRender=!0},t.getFieldOfView=function(){return this._x3domNode.getFieldOfView()},t.getNear=function(){return this._x3domNode.getNear()},t.getFar=function(){return this._x3domNode.getFar()})}}),{activate:function(e){var t=this._nameSpace.doc._viewarea;e&amp;&amp;this._bindAnimation&amp;&amp;t.animateTo(this,e._autoGen?null:e),t._needNavigationMatrixUpdate=!0,x3dom.nodeTypes.X3DBindableNode.prototype.activate.call(this,e)},deactivate:function(e){x3dom.nodeTypes.X3DBindableNode.prototype.deactivate.call(this,e)},getTransformation:function(){return this.getCurrentTransform()},getCenterOfRotation:function(){return new x3dom.fields.SFVec3f(0,0,0)},setCenterOfRotation:function(e){this._vf.centerOfRotation.setValues(e)},getFieldOfView:function(){return 1.57079633},setView:function(e){var t=this.getCurrentTransform();this._viewMatrix=e.mult(t)},setViewAbsolute:function(e){this._viewMatrix=e},setProjectionMatrix:function(e){},resetView:function(){},getNear:function(){return.1},getFar:function(){return 1e4},getImgPlaneHeightAtDistOne:function(){return 2},getViewMatrix:function(){return null},getProjectionMatrix:function(e){return null},setZoom:function(e){}})),x3dom.registerNodeType("Viewpoint","Navigation",defineClass(x3dom.nodeTypes.X3DViewpointNode,(function(e){x3dom.nodeTypes.Viewpoint.superClass.call(this,e),this.addField_SFFloat(e,"fieldOfView",.785398),this.addField_SFVec3f(e,"position",0,0,10),this.addField_SFRotation(e,"orientation",0,0,0,1),this.addField_SFVec3f(e,"centerOfRotation",0,0,0),this.addField_SFFloat(e,"zNear",-1),this.addField_SFFloat(e,"zFar",-1),this._viewMatrix=x3dom.fields.SFMatrix4f.translation(this._vf.position).mult(this._vf.orientation.toMatrix()).inverse(),this._projMatrix=null,this._lastAspect=1,this._zRatio=1e4,this._zNear=this._vf.zNear,this._zFar=this._vf.zFar,this._imgPlaneHeightAtDistOne=2*Math.tan(this._vf.fieldOfView/2)}),{fieldChanged:function(e){"position"==e||"orientation"==e?this.resetView():"fieldOfView"==e||"zNear"==e||"zFar"==e?(this._projMatrix=null,this._zNear=this._vf.zNear,this._zFar=this._vf.zFar,this._imgPlaneHeightAtDistOne=2*Math.tan(this._vf.fieldOfView/2)):e.indexOf("bind")&gt;=0&amp;&amp;this.bind(this._vf.bind)},setProjectionMatrix:function(e){this._projMatrix=e},getCenterOfRotation:function(){return this.getCurrentTransform().multMatrixPnt(this._vf.centerOfRotation)},getViewMatrix:function(){return this._viewMatrix},getFieldOfView:function(){return this._vf.fieldOfView},resetView:function(){this._viewMatrix=x3dom.fields.SFMatrix4f.translation(this._vf.position).mult(this._vf.orientation.toMatrix()).inverse(),this._vf.isActive&amp;&amp;this._nameSpace&amp;&amp;this._nameSpace.doc._viewarea&amp;&amp;this._nameSpace.doc._viewarea.resetNavHelpers()},getNear:function(){return this._zNear},getFar:function(){return this._zFar},getImgPlaneHeightAtDistOne:function(){return this._imgPlaneHeightAtDistOne},getProjectionMatrix:function(e){var t=this._vf.fieldOfView,i=this._vf.zFar,s=this._vf.zNear;if(s&lt;=0||i&lt;=0){var r=.8,o=1.2,n=this._nameSpace.doc._viewarea,a=n._scene,h=x3dom.fields.SFVec3f.copy(a._lastMin),d=x3dom.fields.SFVec3f.copy(a._lastMax).subtract(h),l=d.length()/2,u=n.getViewMatrix().inverse(),f=u.e3(),c=new x3dom.fields.SFVec3f(0,0,0),m=new x3dom.fields.SFVec3f(1,1,1),_=new x3dom.fields.Quaternion(0,0,1,0),p=new x3dom.fields.Quaternion(0,0,1,0);u.getTransform(c,_,m,p);var x=m.x,g=m.x;g&lt;m.y&amp;&amp;(g=m.y),x&gt;m.y&amp;&amp;(x=m.y),g&lt;m.z&amp;&amp;(g=m.z),x&gt;m.z&amp;&amp;(x=m.z),g&gt;1?r/=g:x&gt;x3dom.fields.Eps&amp;&amp;x&lt;1&amp;&amp;(o/=x);var v=h.add(d.multiply(.5)),y=f.subtract(v).length();l?(s=y&gt;l?(y-l)*r:0,i=(y+l)*o):(s=.1,i=1e5);var b=i/this._zRatio;s=Math.max(s,Math.max(x3dom.fields.Eps,b)),i&gt;this._vf.zNear&amp;&amp;this._vf.zNear&gt;0&amp;&amp;(s=this._vf.zNear),this._vf.zFar&gt;s&amp;&amp;(i=this._vf.zFar),i&lt;=s&amp;&amp;(i=s+1)}if(null==this._projMatrix)this._projMatrix=x3dom.fields.SFMatrix4f.perspective(t,e,s,i);else if(this._zNear!=s||this._zFar!=i){var T=s-i;this._projMatrix._22=(s+i)/T,this._projMatrix._23=2*s*i/T}else this._lastAspect!=e&amp;&amp;(this._projMatrix._00=1/Math.tan(t/2)/e,this._lastAspect=e);return this._zNear=s,this._zFar=i,this._projMatrix}})),x3dom.registerNodeType("OrthoViewpoint","Navigation",defineClass(x3dom.nodeTypes.X3DViewpointNode,(function(e){x3dom.nodeTypes.OrthoViewpoint.superClass.call(this,e),this.addField_MFFloat(e,"fieldOfView",[-1,-1,1,1]),this.addField_SFVec3f(e,"position",0,0,10),this.addField_SFRotation(e,"orientation",0,0,0,1),this.addField_SFVec3f(e,"centerOfRotation",0,0,0),this.addField_SFFloat(e,"zNear",-1),this.addField_SFFloat(e,"zFar",-1),this._viewMatrix=null,this._projMatrix=null,this._lastAspect=1,this._zRatio=1e4,this._zNear=this._vf.zNear,this._zFar=this._vf.zFar,this._fieldOfView=this._vf.fieldOfView.slice(0),this.resetView()}),{fieldChanged:function(e){"position"==e||"orientation"==e?this.resetView():"fieldOfView"==e?(this._fieldOfView=this._vf.fieldOfView,this._projMatrix=null):"zNear"==e||"zFar"==e?(this._projMatrix=null,this.resetView()):e.indexOf("bind")&gt;=0&amp;&amp;this.bind(this._vf.bind)},getCenterOfRotation:function(){return this.getCurrentTransform().multMatrixPnt(this._vf.centerOfRotation)},getViewMatrix:function(){return this._viewMatrix},resetView:function(){x3dom.fields.SFMatrix4f.translation(new x3dom.fields.SFVec3f((this._vf.fieldOfView[0]+this._vf.fieldOfView[2])/2,(this._vf.fieldOfView[1]+this._vf.fieldOfView[3])/2,0));this._viewMatrix=x3dom.fields.SFMatrix4f.translation(this._vf.position).mult(this._vf.orientation.toMatrix()),this._viewMatrix=this._viewMatrix.inverse(),this._projMatrix=null,this._vf.isActive&amp;&amp;this._nameSpace&amp;&amp;this._nameSpace.doc._viewarea&amp;&amp;this._nameSpace.doc._viewarea.resetNavHelpers()},getNear:function(){return this._vf.zNear},getFar:function(){return this._vf.zFar},getFieldOfView:function(){return.785},setZoom:function(e){this._fieldOfView[0]=-e,this._fieldOfView[1]=-e,this._fieldOfView[2]=e,this._fieldOfView[3]=e,this._projMatrix=null},getZoom:function(e){return this._fieldOfView},getProjectionMatrix:function(e){var t=this.getFieldOfView(),i=this._vf.zFar,s=this._vf.zNear;if(s&lt;=0||i&lt;=0){var r=this._nameSpace.doc._viewarea._scene,o=x3dom.fields.SFVec3f.copy(r._lastMin),n=x3dom.fields.SFVec3f.copy(r._lastMax).subtract(o),a=Math.tan(t/2),h=n.y/2/a+n.z,d=n.x/2/a+n.z;s=1e-5,i=h&gt;d?4*h:4*d}if(null==this._projMatrix||this._lastAspect!=e||this._zNear!=s||this._zFar!=i){var l=this._zNear=s,u=this._zFar=i,f=this._fieldOfView[0],c=this._fieldOfView[1],m=this._fieldOfView[2],_=this._fieldOfView[3];this._projMatrix=x3dom.fields.SFMatrix4f.ortho(f,m,c,_,l,u,e)}return this._lastAspect=e,this._projMatrix}})),x3dom.registerNodeType("Viewfrustum","Navigation",defineClass(x3dom.nodeTypes.X3DViewpointNode,(function(e){x3dom.nodeTypes.Viewfrustum.superClass.call(this,e),this.addField_SFMatrix4f(e,"modelview",1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.addField_SFMatrix4f(e,"projection",1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this._viewMatrix=this._vf.modelview.transpose().inverse(),this._projMatrix=this._vf.projection.transpose(),this._centerOfRotation=new x3dom.fields.SFVec3f(0,0,0)}),{fieldChanged:function(e){"modelview"==e?this.resetView():"projection"==e?this._projMatrix=this._vf.projection.transpose():e.indexOf("bind")&gt;=0&amp;&amp;this.bind(this._vf.bind)},getCenterOfRotation:function(){return this.getCurrentTransform().multMatrixPnt(this._centerOfRotation)},setCenterOfRotation:function(e){this._centerOfRotation.setValues(e)},getViewMatrix:function(){return this._viewMatrix},getFieldOfView:function(){return 2*Math.atan(1/this._projMatrix._11)},getImgPlaneHeightAtDistOne:function(){return 2/this._projMatrix._11},resetView:function(){this._viewMatrix=this._vf.modelview.transpose().inverse(),this._centerOfRotation=new x3dom.fields.SFVec3f(0,0,0)},getProjectionMatrix:function(e){return this._projMatrix}})),x3dom.registerNodeType("X3DNavigationInfoNode","Navigation",defineClass(x3dom.nodeTypes.X3DBindableNode,(function(e){x3dom.nodeTypes.X3DNavigationInfoNode.superClass.call(this,e)}))),x3dom.registerNodeType("NavigationInfo","Navigation",defineClass(x3dom.nodeTypes.X3DNavigationInfoNode,(function(e){x3dom.nodeTypes.NavigationInfo.superClass.call(this,e),this.addField_SFBool(e,"headlight",!0),this.addField_MFString(e,"type",["EXAMINE","ANY"]),this.addField_MFFloat(e,"typeParams",[-.4,60,.05,2.8]),this.addField_SFString(e,"explorationMode","all"),this.addField_MFFloat(e,"avatarSize",[.25,1.6,.75]),this.addField_SFFloat(e,"visibilityLimit",0),this.addField_SFFloat(e,"speed",1),this.addField_SFTime(e,"transitionTime",1),this.addField_MFString(e,"transitionType",["LINEAR"]),this._validTypes=["none","examine","turntable","fly","freefly","lookat","lookaround","walk","game","helicopter","any"],this._typeMapping={default:x3dom.DefaultNavigation,turntable:x3dom.TurntableNavigation},this._heliUpdated=!1;var t=this.setType(this.getType());x3dom.debug.logInfo("NavType: "+t)}),{fieldChanged:function(e){"typeParams"==e?this._heliUpdated=!1:"type"==e&amp;&amp;this.setType(this.getType())},setType:function(e,t){var i=this.checkType(e.toLowerCase());if(this.checkType(this.getType())!==i||null==this._impl){switch(null==this._typeMapping[i]?this._impl=new this._typeMapping.default(this):this._impl=new this._typeMapping[i](this),i){case"game":t?t.initMouseState():this._nameSpace.doc._viewarea.initMouseState();break;case"helicopter":this._heliUpdated=!1;break;case"turntable":t?t.initMouseState():this._nameSpace.doc._viewarea&amp;&amp;this._nameSpace.doc._viewarea.initMouseState()}this._nameSpace.doc._viewarea&amp;&amp;this._impl.init(this._nameSpace.doc._viewarea,!1)}this._vf.type[0]=i,x3dom.debug.logInfo("Switch to "+i+" mode.")},getType:function(){var e=this._vf.type[0].toLowerCase();return e.length&lt;=1?e="none":"any"==e&amp;&amp;(e="examine"),e},getTypeParams:function(){var e=this._vf.typeParams.length,t=[e&gt;=1?this._vf.typeParams[0]:-.4,e&gt;=2?this._vf.typeParams[1]:60,e&gt;=3?this._vf.typeParams[2]:x3dom.fields.Eps,e&gt;=4?this._vf.typeParams[3]:Math.PI-x3dom.fields.Eps];return e&gt;=5&amp;&amp;(t=t.concat(this._vf.typeParams.slice(4))),console.log(t),t},setTypeParams:function(e){for(var t=0;t&lt;e.length;t++)this._vf.typeParams[t]=e[t]},checkType:function(e){return this._validTypes.indexOf(e)&gt;-1?e:(x3dom.debug.logWarning(e+" is no valid navigation type, use one of "+this._validTypes.toString()),"examine")},getExplorationMode:function(){switch(this._vf.explorationMode.toLowerCase()){case"all":return 7;case"rotate":return 1;case"zoom":return 2;case"pan":return 4;case"none":return 0;default:return 7}}})),x3dom.registerNodeType("Billboard","Navigation",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.Billboard.superClass.call(this,e),this.addField_SFVec3f(e,"axisOfRotation",0,1,0),this._eye=new x3dom.fields.SFVec3f(0,0,0),this._eyeViewUp=new x3dom.fields.SFVec3f(0,0,0),this._eyeLook=new x3dom.fields.SFVec3f(0,0,0)}),{collectDrawableObjects:function(e,t,i,s,r,o){if(i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),!((r=t.cull(e,this.graphState(),i,r))&lt;0)){i=!1;var n=this.getVolume(),a=x3dom.fields.SFVec3f.MAX(),h=x3dom.fields.SFVec3f.MIN();n.getBounds(a,h);var d=t.viewMatrix,l=new x3dom.fields.SFVec3f(0,0,0);l=d.inverse().multMatrixPnt(l);var u=d.mult(e);this._eye=e.inverse().multMatrixPnt(l),this._eyeViewUp=new x3dom.fields.SFVec3f(u._10,u._11,u._12),this._eyeLook=new x3dom.fields.SFVec3f(u._20,u._21,u._22);var f=x3dom.fields.SFMatrix4f.identity(),c=h.add(a).multiply(.5),m=this._eye.subtract(c);if(this._vf.axisOfRotation.equals(new x3dom.fields.SFVec3f(0,0,0),x3dom.fields.Eps)){var _=(f=x3dom.fields.Quaternion.rotateFromTo(m,new x3dom.fields.SFVec3f(0,0,1)).toMatrix().transpose()).multMatrixPnt(new x3dom.fields.SFVec3f(0,1,0)).normalize(),p=f.multMatrixPnt(new x3dom.fields.SFVec3f(0,0,1)).normalize();if(!this._eyeViewUp.equals(new x3dom.fields.SFVec3f(0,0,0),x3dom.fields.Eps)){var x=x3dom.fields.Quaternion.rotateFromTo(this._eyeLook,p),g=x.toMatrix().transpose().multMatrixVec(_),v=x3dom.fields.Quaternion.rotateFromTo(this._eyeViewUp,g);f=x.toMatrix().transpose().mult(f),f=v.toMatrix().transpose().mult(f)}}else{var y=this._vf.axisOfRotation.cross(m).normalize();this._eye.z&lt;0&amp;&amp;(y=y.multiply(-1));var b=Math.asin(y.dot(new x3dom.fields.SFVec3f(0,0,1)));this._eye.z&lt;0&amp;&amp;(b+=Math.PI),f=x3dom.fields.SFMatrix4f.parseRotation(this._vf.axisOfRotation.x+", "+this._vf.axisOfRotation.y+", "+this._vf.axisOfRotation.z+", "+-1*b)}for(var T=this.transformMatrix(e.mult(f)),S=0,w=this._childNodes.length;S&lt;w;S++){var M=this._childNodes[S];M&amp;&amp;M.collectDrawableObjects(T,t,i,s,r,o)}}}})),x3dom.registerNodeType("Collision","Navigation",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.Collision.superClass.call(this,e),this.addField_SFBool(e,"enabled",!0),this.addField_SFNode("proxy",x3dom.nodeTypes.X3DGroupingNode),this.addField_SFTime(e,"collideTime",0),this.addField_SFBool(e,"isActive",!0)}),{collectDrawableObjects:function(e,t,i,s,r,o){if(i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),!((r=t.cull(e,this.graphState(),i,r))&lt;0)){var n,a;i?(this._graph.globalMatrix||(this._graph.globalMatrix=this.transformMatrix(e)),a=this._graph.globalMatrix):a=this.transformMatrix(e);for(var h=0,d=this._childNodes.length;h&lt;d;h++)(n=this._childNodes[h])&amp;&amp;n!==this._cf.proxy.node&amp;&amp;n.collectDrawableObjects(a,t,i,s,r,o)}}})),x3dom.registerNodeType("X3DLODNode","Navigation",defineClass(x3dom.nodeTypes.X3DGroupingNode,(function(e){x3dom.nodeTypes.X3DLODNode.superClass.call(this,e),this.addField_SFBool(e,"forceTransitions",!1),this.addField_SFVec3f(e,"center",0,0,0),this._eye=new x3dom.fields.SFVec3f(0,0,0)}),{collectDrawableObjects:function(e,t,i,s,r,o){i&amp;&amp;this._parentNodes.length&gt;1&amp;&amp;(i=!1),i&amp;&amp;(s=s||this.cacheInvalid())&amp;&amp;this.invalidateCache(),(r=t.cull(e,this.graphState(),i,r))&lt;0||(i=!1,this.visitChildren(e,t,i,s,r,o))},visitChildren:function(e,t,i,s,r,o){}})),x3dom.registerNodeType("LOD","Navigation",defineClass(x3dom.nodeTypes.X3DLODNode,(function(e){x3dom.nodeTypes.LOD.superClass.call(this,e),this.addField_MFFloat(e,"range",[]),this._lastRangePos=-1}),{visitChildren:function(e,t,i,s,r,o){var n=0,a=this._childNodes.length,h=t.viewMatrix,d=new x3dom.fields.SFVec3f(0,0,0);d=h.inverse().multMatrixPnt(d),this._eye=e.inverse().multMatrixPnt(d);for(var l=this._vf.center.subtract(this._eye).length();n&lt;this._vf.range.length&amp;&amp;l&gt;this._vf.range[n];)n++;n&amp;&amp;n&gt;=a&amp;&amp;(n=a-1),this._lastRangePos=n;var u=this._childNodes[n];if(a&amp;&amp;u){var f=this.transformMatrix(e);u.collectDrawableObjects(f,t,i,s,r,o)}},getVolume:function(){var e,t,i=this._graph.volume;if(!this.volumeValid()&amp;&amp;this._vf.render)if(this._lastRangePos&gt;=0)(t=(e=this._childNodes[this._lastRangePos])&amp;&amp;!0===e._vf.render?e.getVolume():null)&amp;&amp;t.isValid()&amp;&amp;i.extendBounds(t.min,t.max);else for(var s=0,r=this._childNodes.length;s&lt;r;s++)(e=this._childNodes[s])&amp;&amp;!0===e._vf.render&amp;&amp;(t=e.getVolume())&amp;&amp;t.isValid()&amp;&amp;i.extendBounds(t.min,t.max);return i},nodeChanged:function(){this.invalidateVolume()},fieldChanged:function(e){"render"!=e&amp;&amp;"center"!=e&amp;&amp;"range"!=e||this.invalidateVolume()}})),x3dom.registerNodeType("DynamicLOD","Navigation",defineClass(x3dom.nodeTypes.X3DLODNode,(function(e){x3dom.nodeTypes.DynamicLOD.superClass.call(this,e),this.addField_SFFloat(e,"subScale",.5),this.addField_SFVec2f(e,"size",2,2),this.addField_SFVec2f(e,"subdivision",1,1),this.addField_SFNode("root",x3dom.nodeTypes.X3DShapeNode),this.addField_SFString(e,"urlHead","http://r"),this.addField_SFString(e,"urlCenter",".ortho.tiles.virtualearth.net/tiles/h"),this.addField_SFString(e,"urlTail",".png?g=-1"),this.rootGeometry=new x3dom.nodeTypes.Plane(e),this.level=0,this.quadrant=4,this.cell=""}),{nodeChanged:function(){var e=this._cf.root.node;null!=e&amp;&amp;null==e._cf.geometry.node&amp;&amp;(this.rootGeometry._vf.size.setValues(this._vf.size),this.rootGeometry._vf.subdivision.setValues(this._vf.subdivision),this.rootGeometry._vf.center.setValues(this._vf.center),this.rootGeometry.fieldChanged("subdivision"),this._cf.root.node.addChild(this.rootGeometry),this.rootGeometry.nodeChanged(),this._cf.root.node.nodeChanged(),this._nameSpace.doc.needRender=!0)},visitChildren:function(e,t,i,s,r,o){var n=this._cf.root.node;if(null!=n){var a=t.viewMatrix,h=new x3dom.fields.SFVec3f(0,0,0);h=a.inverse().multMatrixPnt(h),this._eye=e.inverse().multMatrixPnt(h);var d,l=this._vf.center.subtract(this._eye).length();if(l&gt;x3dom.fields.Eps&amp;&amp;l*this._vf.subScale&lt;=this._vf.size.length())if(this._childNodes.length&lt;=1){var u=new Array(new x3dom.fields.SFVec3f(-.25*this._vf.size.x,.25*this._vf.size.y,0),new x3dom.fields.SFVec3f(.25*this._vf.size.x,.25*this._vf.size.y,0),new x3dom.fields.SFVec3f(-.25*this._vf.size.x,-.25*this._vf.size.y,0),new x3dom.fields.SFVec3f(.25*this._vf.size.x,-.25*this._vf.size.y,0));for(d=0;d&lt;4;d++){var f=new x3dom.nodeTypes.DynamicLOD;f._nameSpace=this._nameSpace,f._eye.setValues(this._eye),f.level=this.level+1,f.quadrant=d,f.cell=this.cell+d,f._vf.urlHead=this._vf.urlHead,f._vf.urlCenter=this._vf.urlCenter,f._vf.urlTail=this._vf.urlTail,f._vf.center=this._vf.center.add(u[d]),f._vf.size=this._vf.size.multiply(.5),f._vf.subdivision.setValues(this._vf.subdivision);var c=new x3dom.nodeTypes.Appearance,m=new x3dom.nodeTypes.ImageTexture;m._nameSpace=this._nameSpace,m._vf.url[0]=this._vf.urlHead+f.quadrant+this._vf.urlCenter+f.cell+this._vf.urlTail,c.addChild(m),m.nodeChanged();var _=new x3dom.nodeTypes.Shape;_._nameSpace=this._nameSpace,_.addChild(c),c.nodeChanged(),f.addChild(_,"root"),_.nodeChanged(),this.addChild(f),f.nodeChanged()}}else for(d=1;d&lt;this._childNodes.length;d++)this._childNodes[d].collectDrawableObjects(e,t,i,s,r,o);else n.collectDrawableObjects(e,t,i,s,r,o)}},getVolume:function(){var e=this._graph.volume;return e.isValid()||(e.min.setValues(this._vf.center),e.min.x-=.5*this._vf.size.x,e.min.y-=.5*this._vf.size.y,e.min.z-=x3dom.fields.Eps,e.max.setValues(this._vf.center),e.max.x+=.5*this._vf.size.x,e.max.y+=.5*this._vf.size.y,e.max.z+=x3dom.fields.Eps),e}})),x3dom.DefaultNavigation=function(e){this.navi=e},x3dom.DefaultNavigation.prototype.onMousePress=function(e,t,i,s){},x3dom.DefaultNavigation.prototype.onMouseReleased=function(e,t,i,s,r){},x3dom.DefaultNavigation.prototype.init=function(e,t){},x3dom.DefaultNavigation.prototype.zoom=function(e,t){var i=this.navi,s=e._scene.getViewpoint(),r=e._scene._lastMax.subtract(e._scene._lastMin).length();if(r=(r&lt;x3dom.fields.Eps?1:r)*i._vf.speed,vec=new x3dom.fields.SFVec3f(0,0,r*t/e._height),x3dom.isa(s,x3dom.nodeTypes.OrthoViewpoint))s.setZoom(Math.abs(s._fieldOfView[0])-vec.z);else{if(i._vf.typeParams.length&gt;=6){var o=-i._vf.typeParams[5],n=i._vf.typeParams[4];e._movement.z=Math.min(Math.max(e._movement.z,o),n)}e._movement=e._movement.add(vec),mat=e.getViewpointMatrix().mult(e._transMat),e._transMat=mat.inverse().mult(x3dom.fields.SFMatrix4f.translation(e._movement)).mult(mat)}},x3dom.DefaultNavigation.prototype.moveForward=function(e){var t=this.navi;if("game"===t.getType()){var i=.25;t._vf.avatarSize.length&gt;2&amp;&amp;(i=t._vf.avatarSize[0],t._vf.avatarSize[1]);var s=5*e._deltaT*t._vf.speed,r=e._yaw/180*Math.PI,o=e._pitch/180*Math.PI,n=e._flyMat.inverse();e._scene._nameSpace.doc.ctx.pickValue(e,e._width/2,e._height/2,e._lastButton),e._pickingInfo.pickObj&amp;&amp;(e._pickingInfo.pickPos.subtract(n.e3()).length()&lt;=2*i||(e._eyePos.x-=Math.sin(r)*s,e._eyePos.z+=Math.cos(r)*s,e._eyePos.y+=Math.sin(o)*s))}},x3dom.DefaultNavigation.prototype.moveBackwards=function(e){var t=this.navi;if("game"===t.getType()){var i=5*e._deltaT*t._vf.speed,s=e._yaw/180*Math.PI,r=e._pitch/180*Math.PI;e._eyePos.x+=Math.sin(s)*i,e._eyePos.z-=Math.cos(s)*i,e._eyePos.y-=Math.sin(r)*i}},x3dom.DefaultNavigation.prototype.strafeLeft=function(e){var t=this.navi;if("game"===t.getType()){var i=5*e._deltaT*t._vf.speed,s=e._yaw/180*Math.PI;e._eyePos.x+=Math.cos(s)*i,e._eyePos.z+=Math.sin(s)*i}},x3dom.DefaultNavigation.prototype.strafeRight=function(e){var t=this.navi;if("game"===t.getType()){var i=5*e._deltaT*t._vf.speed,s=e._yaw/180*Math.PI;e._eyePos.x-=Math.cos(s)*i,e._eyePos.z-=Math.sin(s)*i}},x3dom.DefaultNavigation.prototype.navigateTo=function(e,t){var i=this.navi,s=i.getType(),r=null,o=e._currentInputType==x3dom.InputTypes.NAVIGATION&amp;&amp;("game"===s||e._lastButton&gt;0&amp;&amp;(s.indexOf("fly")&gt;=0||"walk"===s||"helicopter"===s||"looka"===s.substr(0,5)));e._deltaT=t-e._lastTS;var n=function(e,t){return e&gt;0?e&lt;=t?0:e-t:e&lt;=0?e&gt;=-t?0:e+t:void 0},a=function(e,t){return(t&lt;0?-1:1)*Math.pow(e*Math.abs(t),1.65)};if(o){null!==e._pickingInfo.pickObj&amp;&amp;(r={pickPos:e._pickingInfo.pickPos,pickNorm:e._pickingInfo.pickNorm,pickObj:e._pickingInfo.pickObj,firstObj:e._pickingInfo.firstObj,lastObj:e._pickingInfo.lastObj,lastClickObj:e._pickingInfo.lastClickObj,shadowObjectId:e._pickingInfo.shadowObjectId});var h=.25,d=1.6;i._vf.avatarSize.length&gt;2&amp;&amp;(h=i._vf.avatarSize[0],d=i._vf.avatarSize[1],i._vf.avatarSize[2]);var l=e.getViewMatrix(),u=0,f=Math.min(e._width,e._height),c=n((e._pressX-e._lastX)/f,.01),m=n((e._pressY-e._lastY)/f,.01),_=a(1,c),p=a(1,m),x=2&amp;e._lastButton?-1:1;x*=e._deltaT*i._vf.speed;e._deltaT,i._vf.speed;var g=e._deltaT*i._vf.speed*p,v=Math.PI*e._deltaT*_,y=Math.PI*e._deltaT*p;if(!0===e._needNavigationMatrixUpdate){e._needNavigationMatrixUpdate=!1,e._rotMat=x3dom.fields.SFMatrix4f.identity(),e._transMat=x3dom.fields.SFMatrix4f.identity(),e._movement=new x3dom.fields.SFVec3f(0,0,0);var b=0,T=Math.asin(l._02),S=Math.cos(T);Math.abs(S)&gt;1e-4&amp;&amp;(b=Math.atan2(-l._12/S,l._22/S)),e._flyMat=l.inverse(),e._from=e._flyMat.e3(),e._at=e._from.subtract(e._flyMat.e2()),"helicopter"===s&amp;&amp;(e._at.y=e._from.y),e._up=e._flyMat.e1(),e._pitch=180*b/Math.PI,e._yaw=180*T/Math.PI,e._eyePos=e._from.negate()}var w,M,E,F,C,A=null,R=null,I=null;if("game"===s){e._pitch+=e._dy,e._yaw+=e._dx,e._pitch&gt;=89&amp;&amp;(e._pitch=89),e._pitch&lt;=-89&amp;&amp;(e._pitch=-89),e._yaw&gt;=360&amp;&amp;(e._yaw-=360),e._yaw&lt;0&amp;&amp;(e._yaw=360+e._yaw),e._dx=0,e._dy=0;var N=x3dom.fields.SFMatrix4f.rotationX(e._pitch/180*Math.PI),P=x3dom.fields.SFMatrix4f.rotationY(e._yaw/180*Math.PI),D=x3dom.fields.SFMatrix4f.translation(e._eyePos);e._flyMat=N.mult(P).mult(D);var V=e._flyMat.inverse(),L=V.e3();return R=new x3dom.fields.SFVec3f(0,-1,0),A=L.add(R),R=V.e0().cross(R).normalize(),I=(I=x3dom.fields.SFMatrix4f.lookAt(L,A,R)).inverse(),e._scene._nameSpace.doc.ctx.pickValue(e,e._width/2,e._height/2,e._lastButton,I,e.getProjectionMatrix().mult(I)),e._pickingInfo.pickObj&amp;&amp;(u=e._pickingInfo.pickPos.subtract(L).length(),L.y+=d-u,V.setTranslate(L),e._eyePos=V.e3().negate(),e._flyMat=V.inverse(),e._pickingInfo.pickObj=null),e._scene.getViewpoint().setView(e._flyMat),o}if("helicopter"===s){var O=i.getTypeParams();if(2&amp;e._lastButton){var k=200*g;O[1]+=k,i.setTypeParams(O)}x=1&amp;e._lastButton?300*g:0,y=O[0],e._from.y=O[1],e._at.y=e._from.y,w=x3dom.fields.Quaternion.axisAngle(e._up,v).toMatrix(),M=(M=x3dom.fields.SFMatrix4f.translation(e._from)).mult(w),w=x3dom.fields.SFMatrix4f.translation(e._from.negate()),M=M.mult(w),e._at=M.multMatrixPnt(e._at),C=(F=(E=e._at.subtract(e._from).normalize()).cross(e._up).normalize()).cross(E).normalize(),E=E.multiply(x),e._from=e._from.add(E),e._at=e._at.add(E),w=x3dom.fields.Quaternion.axisAngle(F,y).toMatrix(),M=(M=x3dom.fields.SFMatrix4f.translation(e._from)).mult(w),w=x3dom.fields.SFMatrix4f.translation(e._from.negate());var B=(M=M.mult(w)).multMatrixPnt(e._at);return e._flyMat=x3dom.fields.SFMatrix4f.lookAt(e._from,B,C),e._scene.getViewpoint().setView(e._flyMat.inverse()),o}if(w=x3dom.fields.Quaternion.axisAngle(e._up,v).toMatrix(),M=(M=x3dom.fields.SFMatrix4f.translation(e._from)).mult(w),w=x3dom.fields.SFMatrix4f.translation(e._from.negate()),M=M.mult(w),e._at=M.multMatrixPnt(e._at),C=(F=(E=e._at.subtract(e._from).normalize()).cross(e._up).normalize()).cross(E).normalize(),w=x3dom.fields.Quaternion.axisAngle(F,y).toMatrix(),M=(M=x3dom.fields.SFMatrix4f.translation(e._from)).mult(w),w=x3dom.fields.SFMatrix4f.translation(e._from.negate()),M=M.mult(w),e._at=M.multMatrixPnt(e._at),"looka"!==s.substr(0,5)){var U=e.getProjectionMatrix();"freefly"!==s&amp;&amp;(x&lt;0?((I=new x3dom.fields.SFMatrix4f).setValue(e._last_mat_view.e0(),e._last_mat_view.e1(),e._last_mat_view.e2().negate(),e._last_mat_view.e3()),e._scene._nameSpace.doc.ctx.pickValue(e,e._width/2,e._height/2,e._lastButton,I,U.mult(I))):e._scene._nameSpace.doc.ctx.pickValue(e,e._width/2,e._height/2,e._lastButton),e._pickingInfo.pickObj&amp;&amp;(u=e._pickingInfo.pickPos.subtract(e._from).length())&lt;=h&amp;&amp;(x=0)),E=e._at.subtract(e._from).normalize().multiply(x),e._at=e._at.add(E),e._from=e._from.add(E),"walk"===s&amp;&amp;(A=e._from.addScaled(C,-1),R=F.cross(C.negate()).normalize(),I=(I=x3dom.fields.SFMatrix4f.lookAt(e._from,A,R)).inverse(),e._scene._nameSpace.doc.ctx.pickValue(e,e._width/2,e._height/2,e._lastButton,I,U.mult(I)),e._pickingInfo.pickObj&amp;&amp;(u=e._pickingInfo.pickPos.subtract(e._from).length(),e._at=e._at.add(C.multiply(d-u)),e._from=e._from.add(C.multiply(d-u)))),e._pickingInfo.pickObj=null}e._flyMat=x3dom.fields.SFMatrix4f.lookAt(e._from,e._at,C),e._scene.getViewpoint().setView(e._flyMat.inverse()),null!==r&amp;&amp;(e._pickingInfo=r)}return o},x3dom.DefaultNavigation.prototype.animateTo=function(e,t,i,s){var r=this.navi;x3dom.isa(t,x3dom.nodeTypes.X3DViewpointNode)&amp;&amp;(t=t.getViewMatrix().mult(t.getCurrentTransform().inverse())),"teleport"!==r._vf.transitionType[0].toLowerCase()&amp;&amp;0!=s&amp;&amp;"game"!==r.getType()&amp;&amp;i&amp;&amp;x3dom.isa(i,x3dom.nodeTypes.X3DViewpointNode)?(i=i.getViewMatrix().mult(i.getCurrentTransform().inverse()).mult(e._transMat).mult(e._rotMat),e._mixer.beginTime=e._lastTS,arguments.length&gt;=4&amp;&amp;null!=arguments[3]?e._mixer.endTime=e._lastTS+s:e._mixer.endTime=e._lastTS+r._vf.transitionTime,e._mixer.setBeginMatrix(i),e._mixer.setEndMatrix(t),e._scene.getViewpoint().setView(i)):e._scene.getViewpoint().setView(t),e._rotMat=x3dom.fields.SFMatrix4f.identity(),e._transMat=x3dom.fields.SFMatrix4f.identity(),e._movement=new x3dom.fields.SFVec3f(0,0,0),e._needNavigationMatrixUpdate=!0},x3dom.DefaultNavigation.prototype.orthoAnimateTo=function(e,t,i,s){var r=this.navi;s=s||r._vf.transitionTime,e._interpolator.beginValue=i,e._interpolator.endValue=t,e._interpolator.beginTime=e._lastTS,e._interpolator.endTime=e._lastTS+s},x3dom.DefaultNavigation.prototype.resetView=function(e){var t=this.navi;if("teleport"!==t._vf.transitionType[0].toLowerCase()&amp;&amp;"game"!==t.getType()){var i=e._scene.getViewpoint();e._mixer.beginTime=e._lastTS,e._mixer.endTime=e._lastTS+t._vf.transitionTime,e._mixer.setBeginMatrix(e.getViewMatrix()),x3dom.isa(i,x3dom.nodeTypes.OrthoViewpoint)&amp;&amp;this.orthoAnimateTo(e,Math.abs(i._vf.fieldOfView[0]),Math.abs(i._fieldOfView[0]));var s=e._scene.getViewpoint();s.resetView(),s=s.getViewMatrix().mult(s.getCurrentTransform().inverse()),e._mixer.setEndMatrix(s)}else e._scene.getViewpoint().resetView();e.resetNavHelpers(),t._heliUpdated=!1},x3dom.DefaultNavigation.prototype.onDrag=function(e,t,i,s){var r=this.navi,o=r.getType(),n=r.getExplorationMode();if("none"!==o&amp;&amp;0!=n){var a,h,d,l,u=e._scene.getViewpoint(),f=t-e._lastX,c=i-e._lastY,m=null;if(1&amp;(s=!n||7!=n&amp;&amp;1==s?n:s)){d=2*c*Math.PI/e._width,l=2*f*Math.PI/e._height,m=e.getViewMatrix();var _=x3dom.fields.SFMatrix4f.rotationX(d),p=x3dom.fields.SFMatrix4f.rotationY(l),x=u.getCenterOfRotation();m.setTranslate(new x3dom.fields.SFVec3f(0,0,0)),e._rotMat=e._rotMat.mult(x3dom.fields.SFMatrix4f.translation(x)).mult(m.inverse()).mult(_).mult(p).mult(m).mult(x3dom.fields.SFMatrix4f.translation(x.negate()))}if(4&amp;s&amp;&amp;(a=((a=e._scene._lastMax.subtract(e._scene._lastMin).length())&lt;x3dom.fields.Eps?1:a)*r._vf.speed,h=new x3dom.fields.SFVec3f(a*f/e._width,a*-c/e._height,0),e._movement=e._movement.add(h),m=e.getViewpointMatrix().mult(e._transMat),e._transMat=m.inverse().mult(x3dom.fields.SFMatrix4f.translation(e._movement)).mult(m)),2&amp;s)if(a=((a=e._scene._lastMax.subtract(e._scene._lastMin).length())&lt;x3dom.fields.Eps?1:a)*r._vf.speed,h=new x3dom.fields.SFVec3f(0,0,a*(f+c)/e._height),x3dom.isa(u,x3dom.nodeTypes.OrthoViewpoint))u.setZoom(Math.abs(u._fieldOfView[0])-h.z);else{if(r._vf.typeParams.length&gt;=6){var g=-r._vf.typeParams[5],v=r._vf.typeParams[4];e._movement.z=Math.min(Math.max(e._movement.z,g),v)}e._movement=e._movement.add(h),m=e.getViewpointMatrix().mult(e._transMat),e._transMat=m.inverse().mult(x3dom.fields.SFMatrix4f.translation(e._movement)).mult(m)}e._isMoving=!0,e._dx=f,e._dy=c,e._lastX=t,e._lastY=i}},x3dom.DefaultNavigation.prototype.onTouchStart=function(e,t,i){},x3dom.DefaultNavigation.prototype.onTouchDrag=function(e,t,i,s,r){if(e._currentInputType==x3dom.InputTypes.NAVIGATION){var o=this.navi,n=e._scene.getViewpoint();if("examine"===o.getType()){if(s){var a=e._scene._lastMax.subtract(e._scene._lastMin).length();a=(a&lt;x3dom.fields.Eps?1:a)*o._vf.speed,s=s.multiply(a),e._movement=e._movement.add(s),e._transMat=n.getViewMatrix().inverse().mult(x3dom.fields.SFMatrix4f.translation(e._movement)).mult(n.getViewMatrix())}if(r){var h=n.getCenterOfRotation(),d=e.getViewMatrix();d.setTranslate(new x3dom.fields.SFVec3f(0,0,0)),e._rotMat=e._rotMat.mult(x3dom.fields.SFMatrix4f.translation(h)).mult(d.inverse()).mult(r).mult(d).mult(x3dom.fields.SFMatrix4f.translation(h.negate()))}e._isMoving=!0}}},x3dom.DefaultNavigation.prototype.onTouchEnd=function(e,t){},x3dom.DefaultNavigation.prototype.onDoubleClick=function(e,t,i){if((!e._doc._x3dElem.hasAttribute("disableDoubleClick")||"true"!==e._doc._x3dElem.getAttribute("disableDoubleClick"))&amp;&amp;"none"!=e._scene.getNavigationInfo().getType()){var s=e._scene._vf.pickMode.toLowerCase();if("color"!=s&amp;&amp;"texcoord"!=s){var r=e._scene.getViewpoint();r.setCenterOfRotation(e._pick),x3dom.debug.logInfo("New center of Rotation:  "+e._pick);var o=e.getViewMatrix().inverse(),n=o.e3(),a=e._pick,h=o.e1(),d=o.e0().cross(h).normalize(),l=d.dot(e._pick.subtract(n));n=a.addScaled(d,-l),o=x3dom.fields.SFMatrix4f.lookAt(n,a,h),x3dom.debug.logInfo("New camera position:  "+n),e.animateTo(o.inverse(),r)}}},x3dom.TurntableNavigation=function(e){x3dom.DefaultNavigation.call(this,e),this.panAxisX=null,this.panAxisY=null,this.panEnabled=!0},x3dom.TurntableNavigation.prototype=Object.create(x3dom.DefaultNavigation.prototype),x3dom.TurntableNavigation.prototype.constructor=x3dom.TurntableNavigation,x3dom.TurntableNavigation.prototype.onDrag=function(e,t,i,s){navi=this.navi,e._flyMat||this.initTurnTable(e,!1);var r=navi.getType(),o=navi.getExplorationMode();if("none"!==r&amp;&amp;0!=o){var n,a,h=t-e._lastX,d=i-e._lastY,l=null;if(1&amp;(s=!o||7!=o&amp;&amp;1==s?o:s))n=2*d*Math.PI/e._height,a=2*h*Math.PI/e._width,this.rotate(e,n,a);else if(2&amp;s){var u=(l=((l=e._scene._lastMax.subtract(e._scene._lastMin).length())&lt;x3dom.fields.Eps?1:l)*navi._vf.speed)*(h+d)/e._height;this.zoom(e,u)}else if(4&amp;s&amp;&amp;1==this.panEnabled){var f=-(l=((l=e._scene._lastMax.subtract(e._scene._lastMin).length())&lt;x3dom.fields.Eps?1:l)*navi._vf.speed*.75)*h/e._width,c=l*d/e._height;this.pan(e,f,c)}e._isMoving=!0,e._dx=h,e._dy=d,e._lastX=t,e._lastY=i}},x3dom.TurntableNavigation.prototype.pan=function(e,t,i){if(null!=this.target){var s=this.target._x3domNode.getVolume(),r=e._scene.getViewpoint();e._up=e._flyMat.e1(),e._from=e._flyMat.e3();var o=n=(n=e._at).addScaled(this.panAxisY,i);n.y&gt;s.max.y||n.y&lt;s.min.y?o=e._at:e._from=e._from.addScaled(this.panAxisY,i),(n=o.addScaled(this.panAxisX,t)).x&gt;s.max.x||n.x&lt;s.min.x?n=o:e._from=e._from.addScaled(this.panAxisX,t),e._at=n,e._flyMat=x3dom.fields.SFMatrix4f.lookAt(e._from,n,e._up),r.setViewAbsolute(e._flyMat.inverse())}else if(null!=this.panAxisX&amp;&amp;null!=this.panAxisY){var n;r=e._scene.getViewpoint();e._up=e._flyMat.e1(),e._from=e._flyMat.e3();o=n=(n=e._at).addScaled(this.panAxisY,i);e._from=e._from.addScaled(this.panAxisY,i),n=o.addScaled(this.panAxisX,t),e._from=e._from.addScaled(this.panAxisX,t),e._at=n,e._flyMat=x3dom.fields.SFMatrix4f.lookAt(e._from,n,e._up),r.setViewAbsolute(e._flyMat.inverse())}else{var a=new x3dom.fields.SFVec3f(-t*navi._vf.speed,-i*navi._vf.speed,0);e._movement=e._movement.add(a);var h=e.getViewpointMatrix().mult(e._transMat);e._transMat=h.inverse().mult(x3dom.fields.SFMatrix4f.translation(e._movement)).mult(h)}},x3dom.TurntableNavigation.prototype.rotate=function(e,t,i){var s=e._scene.getViewpoint();e._flyMat=this.calcOrbit(e,t,i),s.setView(e._flyMat.inverse())},x3dom.TurntableNavigation.prototype.zoom=function(e,t){var i=this.navi,s=e._scene.getViewpoint();e._up=e._flyMat.e1(),e._from=e._flyMat.e3(),cor=e._at;var r=cor.subtract(e._from),o=r.length();r=r.normalize();var n=Math.min(t,o-i._vf.typeParams[6]);n=Math.max(n,o-i._vf.typeParams[7]),e._from=e._from.addScaled(r,n),e._flyMat=x3dom.fields.SFMatrix4f.lookAt(e._from,cor,e._up),s.setView(e._flyMat.inverse())},x3dom.TurntableNavigation.prototype.calcOrbit=function(e,t,i){navi=this.navi,e._up=e._flyMat.e1(),e._from=e._flyMat.e3();var s=e._from.subtract(e._at),r=Math.atan2(s.x,s.z),o=Math.atan2(Math.sqrt(s.x*s.x+s.z*s.z),s.y);r-=i,o-=t,o=Math.max(navi._vf.typeParams[2],Math.min(navi._vf.typeParams[3],o)),navi._vf.typeParams[4]&lt;=navi._vf.typeParams[5]?r=Math.max(navi._vf.typeParams[4],Math.min(navi._vf.typeParams[5],r)):i&gt;0&amp;&amp;r&lt;navi._vf.typeParams[4]&amp;&amp;r&gt;navi._vf.typeParams[5]?r=navi._vf.typeParams[4]:i&lt;0&amp;&amp;r&gt;navi._vf.typeParams[5]&amp;&amp;r&lt;navi._vf.typeParams[4]&amp;&amp;(r=navi._vf.typeParams[5]);var n=s.length(),a=n*Math.sin(o);s.x=a*Math.sin(r),s.y=n*Math.cos(o),s.z=a*Math.cos(r),s=e._at.add(s),o-=Math.PI/2;var h=Math.sin(o),d=Math.cos(o),l=new x3dom.fields.SFVec3f(h*Math.sin(r),d,h*Math.cos(r));return l.y&lt;0&amp;&amp;(l=l.negate()),x3dom.fields.SFMatrix4f.lookAt(s,e._at,l)},x3dom.TurntableNavigation.prototype.initTurnTable=function(e,t){var i=this.navi;t=void 0==t||t;var s=e.getViewMatrix(),r=e._scene.getViewpoint(),o=x3dom.fields.SFVec3f.copy(r.getCenterOfRotation());e._flyMat=s.inverse(),e._from=r._vf.position,e._at=o,e._up=new x3dom.fields.SFVec3f(0,1,0),e._flyMat=x3dom.fields.SFMatrix4f.lookAt(e._from,e._at,e._up),e._flyMat=this.calcOrbit(e,0,0);var n=0;t&amp;&amp;(n=.2/i._vf.speed),e.animateTo(e._flyMat.inverse(),r,n),e.resetNavHelpers()},x3dom.TurntableNavigation.prototype.onMousePress=function(e,t,i,s){e._flyMat||this.initTurnTable(e,!1)},x3dom.TurntableNavigation.prototype.init=function(e,t){this.initTurnTable(e,!1)},x3dom.TurntableNavigation.prototype.resetView=function(e){e._mixer.beginTime=e._lastTS,e._mixer.endTime=e._lastTS+this.navi._vf.transitionTime,e._mixer.setBeginMatrix(e.getViewMatrix());var t=e._scene.getViewpoint();t.resetView(),t=x3dom.fields.SFMatrix4f.lookAt(t._vf.position,t.getCenterOfRotation(),new x3dom.fields.SFVec3f(0,1,0)),e._mixer.setEndMatrix(t.inverse()),this.updateFlyMat(e)},x3dom.TurntableNavigation.prototype.updateFlyMat=function(e,t){e._flyMat||this.initTurnTable(e,!1);var i=e.getViewMatrix(),s=t;null!=s&amp;&amp;x3dom.isa(s,x3dom.nodeTypes.X3DViewpointNode)||(s=e._scene.getViewpoint());var r=x3dom.fields.SFVec3f.copy(s.getCenterOfRotation());e._flyMat=i.inverse(),e._from=s._vf.position,e._at=r,e._up=new x3dom.fields.SFVec3f(0,1,0),e._flyMat=x3dom.fields.SFMatrix4f.lookAt(e._from,e._at,e._up)},x3dom.TurntableNavigation.prototype.animateTo=function(e,t,i,s){var r,o=this.navi;r=x3dom.isa(t,x3dom.nodeTypes.X3DViewpointNode)?x3dom.fields.SFMatrix4f.lookAt(t._vf.position,t.getCenterOfRotation(),new x3dom.fields.SFVec3f(0,1,0)):t,"teleport"!==o._vf.transitionType[0].toLowerCase()&amp;&amp;0!=s&amp;&amp;"game"!==o.getType()?i&amp;&amp;x3dom.isa(i,x3dom.nodeTypes.X3DViewpointNode)?(i=i.getViewMatrix().mult(i.getCurrentTransform().inverse()).mult(e._transMat).mult(e._rotMat),e._mixer.beginTime=e._lastTS,arguments.length&gt;=4&amp;&amp;null!=arguments[3]?e._mixer.endTime=e._lastTS+s:e._mixer.endTime=e._lastTS+o._vf.transitionTime,e._mixer.setBeginMatrix(i),e._mixer.setEndMatrix(r.inverse()),e._scene.getViewpoint().setView(i)):e._scene.getViewpoint().setView(r.inverse()):e._scene.getViewpoint().setView(t),e._rotMat=x3dom.fields.SFMatrix4f.identity(),e._transMat=x3dom.fields.SFMatrix4f.identity(),e._movement=new x3dom.fields.SFVec3f(0,0,0),e._needNavigationMatrixUpdate=!0,this.updateFlyMat(e,t)},x3dom.TurntableNavigation.prototype.onTouchStart=function(e,t,i){console.log("touchStart "+t.touches.length),console.log(t),e._numTouches=t.touches.length,e._lastX=t.touches[0].screenX,e._lastY=t.touches[0].screenY},x3dom.TurntableNavigation.prototype.onTouchDrag=function(e,t,i,s,r){if(e._currentInputType==x3dom.InputTypes.NAVIGATION)if(1==t.touches.length){var o=t.touches[0].screenX-e._lastX,n=2*(t.touches[0].screenY-e._lastY)*Math.PI/e._height,a=2*o*Math.PI/e._width;this.rotate(e,n,a),e._lastX=t.touches[0].screenX,e._lastY=t.touches[0].screenY}else t.touches.length&gt;=2&amp;&amp;(1==this.panEnabled&amp;&amp;this.pan(e,4*-s.x,4*-s.y),this.zoom(e,4*s.z))},x3dom.TurntableNavigation.prototype.onTouchEnd=function(e,t,i){console.log("touchEnd "+t.touches.length),console.log(t),2==e._numTouches&amp;&amp;1==t.touches.length&amp;&amp;(e._lastX=t.touches[0].screenX,e._lastY=t.touches[0].screenY),e._numTouches=t.touches.length},x3dom.TurntableNavigation.prototype.onDoubleClick=function(e,t,i){},x3dom.TurntableNavigation.prototype.setPanTarget=function(e){this.target=e},x3dom.TurntableNavigation.prototype.setPanAxis=function(e,t){this.panAxisX=e,this.panAxisY=t},x3dom.TurntableNavigation.prototype.setPanEnabled=function(e){this.panEnabled=e},x3dom.registerNodeType("X3DFontStyleNode","Text",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.X3DFontStyleNode.superClass.call(this,e)}))),x3dom.registerNodeType("FontStyle","Text",defineClass(x3dom.nodeTypes.X3DFontStyleNode,(function(e){x3dom.nodeTypes.FontStyle.superClass.call(this,e),this.addField_MFString(e,"family",["SERIF"]),this.addField_SFBool(e,"horizontal",!0),this.addField_MFString(e,"justify",["MIDDLE","MIDDLE"]),this.addField_SFString(e,"language",""),this.addField_SFBool(e,"leftToRight",!0),this.addField_SFFloat(e,"size",1),this.addField_SFFloat(e,"spacing",1),this.addField_SFString(e,"style","PLAIN"),this.addField_SFBool(e,"topToBottom",!0),this.addField_SFFloat(e,"quality",2)}),{fieldChanged:function(e){"family"!=e&amp;&amp;"horizontal"!=e&amp;&amp;"justify"!=e&amp;&amp;"language"!=e&amp;&amp;"leftToRight"!=e&amp;&amp;"size"!=e&amp;&amp;"spacing"!=e&amp;&amp;"style"!=e&amp;&amp;"topToBottom"!=e||Array.forEach(this._parentNodes,(function(e){Array.forEach(e._parentNodes,(function(e){e.setAllDirty()}))}))}})),x3dom.nodeTypes.FontStyle.defaultNode=function(){return x3dom.nodeTypes.FontStyle._defaultNode||(x3dom.nodeTypes.FontStyle._defaultNode=new x3dom.nodeTypes.FontStyle,x3dom.nodeTypes.FontStyle._defaultNode.nodeChanged()),x3dom.nodeTypes.FontStyle._defaultNode},x3dom.registerNodeType("Text","Text",defineClass(x3dom.nodeTypes.X3DGeometryNode,(function(e){x3dom.nodeTypes.Text.superClass.call(this,e),this.addField_MFString(e,"string",[]),this.addField_MFFloat(e,"length",[]),this.addField_SFFloat(e,"maxExtent",0),this.addField_SFNode("fontStyle",x3dom.nodeTypes.X3DFontStyleNode),this._mesh._positions[0]=[0,0,0,1,0,0,1,1,0,0,1,0],this._mesh._normals[0]=[0,0,1,0,0,1,0,0,1,0,0,1],this._mesh._texCoords[0]=[0,0,1,0,1,1,0,1],this._mesh._colors[0]=[],this._mesh._indices[0]=[0,1,2,2,3,0],this._mesh._invalidate=!0,this._mesh._numFaces=2,this._mesh._numCoords=4}),{nodeChanged:function(){this._cf.fontStyle.node||this.addChild(x3dom.nodeTypes.FontStyle.defaultNode()),this.invalidateVolume()},fieldChanged:function(e){"string"!=e&amp;&amp;"length"!=e&amp;&amp;"maxExtent"!=e||(this.invalidateVolume(),Array.forEach(this._parentNodes,(function(e){e.setAllDirty()})))}})),x3dom.registerNodeType("X3DSoundNode","Sound",defineClass(x3dom.nodeTypes.X3DChildNode,(function(e){x3dom.nodeTypes.X3DSoundNode.superClass.call(this,e)}))),x3dom.registerNodeType("Sound","Sound",defineClass(x3dom.nodeTypes.X3DSoundNode,(function(e){x3dom.nodeTypes.Sound.superClass.call(this,e),this.addField_SFNode("source",x3dom.nodeTypes.X3DSoundSourceNode)}),{nodeChanged:function(){if(!this._cf.source.node&amp;&amp;this._xmlNode){x3dom.debug.logInfo("No AudioClip child node given, searching for &amp;lt;audio&amp;gt; elements...");try{Array.forEach(this._xmlNode.childNodes,(function(e){if(1===e.nodeType&amp;&amp;(x3dom.debug.logInfo("### Found &amp;lt;"+e.nodeName+"&amp;gt; tag."),"audio"===e.localName.toLowerCase())){var t=e.getAttribute("loop");t=!!t&amp;&amp;"loop"===t.toLowerCase();var i=e.cloneNode(!1);e.parentNode.removeChild(e),e=null,"Microsoft Internet Explorer"!=navigator.appName&amp;&amp;document.body.appendChild(i);i.addEventListener("canplaythrough",(function(){i.play()}),!0),i.addEventListener("ended",(function(){t&amp;&amp;i.play()}),!0)}}))}catch(e){x3dom.debug.logException(e)}}}})),x3dom.registerNodeType("X3DSoundSourceNode","Sound",defineClass(x3dom.nodeTypes.X3DTimeDependentNode,(function(e){x3dom.nodeTypes.X3DSoundSourceNode.superClass.call(this,e)}))),x3dom.registerNodeType("AudioClip","Sound",defineClass(x3dom.nodeTypes.X3DSoundSourceNode,(function(e){x3dom.nodeTypes.AudioClip.superClass.call(this,e),this.addField_MFString(e,"url",[]),this.addField_SFBool(e,"enabled",!1),this.addField_SFBool(e,"loop",!1),this._audio=document.createElement("audio"),"Microsoft Internet Explorer"!=navigator.appName&amp;&amp;document.body.appendChild(this._audio),this._sources=[]}),{nodeChanged:function(){this._createSources=function(){this._sources=[];for(var e=0;e&lt;this._vf.url.length;e++){var t=this._nameSpace.getURL(this._vf.url[e]);x3dom.debug.logInfo("Adding sound file: "+t);var i=document.createElement("source");i.setAttribute("src",t),this._sources.push(i),this._audio.appendChild(i)}};var e=this;this._startAudio=function(){e._audio.loop=e._vf.loop?"loop":"",!0===e._vf.enabled&amp;&amp;e._audio.play()},this._stopAudio=function(){e._audio.pause()},this._audioEnded=function(){!0===e._vf.enabled&amp;&amp;!0===e._vf.loop&amp;&amp;e._startAudio()};this._audio.addEventListener("canplaythrough",this._startAudio,!0),this._audio.addEventListener("ended",this._audioEnded,!0),this._audio.addEventListener("error",(function(e){x3dom.debug.logWarning("MediaEvent error:"+e)}),!0),this._audio.addEventListener("pause",this._audioEnded,!0),this._createSources()},fieldChanged:function(e){if("enabled"===e)!0===this._vf.enabled?this._startAudio():this._stopAudio();else if("loop"===e);else if("url"===e){for(this._stopAudio();this._audio.hasChildNodes();)this._audio.removeChild(this._audio.firstChild);for(var t=0;t&lt;this._vf.url.length;t++){var i=this._nameSpace.getURL(this._vf.url[t]);x3dom.debug.logInfo("Adding sound file: "+i);var s=document.createElement("source");s.setAttribute("src",i),this._audio.appendChild(s)}}},shutdown:function(){if(this._audio){for(this._audio.pause();this._audio.hasChildNodes();)this._audio.removeChild(this._audio.firstChild);document.body.removeChild(this._audio),this._audio=null}}})),x3dom.registerNodeType("X3DTextureTransformNode","Texturing",defineClass(x3dom.nodeTypes.X3DAppearanceChildNode,(function(e){x3dom.nodeTypes.X3DTextureTransformNode.superClass.call(this,e)}))),x3dom.registerNodeType("TextureTransform","Texturing",defineClass(x3dom.nodeTypes.X3DTextureTransformNode,(function(e){x3dom.nodeTypes.TextureTransform.superClass.call(this,e),this.addField_SFVec2f(e,"center",0,0),this.addField_SFFloat(e,"rotation",0),this.addField_SFVec2f(e,"scale",1,1),this.addField_SFVec2f(e,"translation",0,0);var t=new x3dom.fields.SFVec3f(-this._vf.center.x,-this._vf.center.y,1),i=new x3dom.fields.SFVec3f(this._vf.center.x,this._vf.center.y,0),s=new x3dom.fields.SFVec3f(this._vf.translation.x,this._vf.translation.y,0),r=new x3dom.fields.SFVec3f(this._vf.scale.x,this._vf.scale.y,0);this._trafo=x3dom.fields.SFMatrix4f.translation(t).mult(x3dom.fields.SFMatrix4f.scale(r)).mult(x3dom.fields.SFMatrix4f.rotationZ(this._vf.rotation)).mult(x3dom.fields.SFMatrix4f.translation(i.add(s)))}),{fieldChanged:function(e){if("center"==e||"rotation"==e||"scale"==e||"translation"==e){var t=new x3dom.fields.SFVec3f(-this._vf.center.x,-this._vf.center.y,1),i=new x3dom.fields.SFVec3f(this._vf.center.x,this._vf.center.y,0),s=new x3dom.fields.SFVec3f(this._vf.translation.x,this._vf.translation.y,0),r=new x3dom.fields.SFVec3f(this._vf.scale.x,this._vf.scale.y,0);this._trafo=x3dom.fields.SFMatrix4f.translation(t).mult(x3dom.fields.SFMatrix4f.scale(r)).mult(x3dom.fields.SFMatrix4f.rotationZ(this._vf.rotation)).mult(x3dom.fields.SFMatrix4f.translation(i.add(s)))}},texTransformMatrix:function(){return this._trafo}})),x3dom.registerNodeType("TextureProperties","Texturing",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.TextureProperties.superClass.call(this,e),this.addField_SFFloat(e,"anisotropicDegree",1),this.addField_SFColorRGBA(e,"borderColor",0,0,0,0),this.addField_SFInt32(e,"borderWidth",0),this.addField_SFString(e,"boundaryModeS","REPEAT"),this.addField_SFString(e,"boundaryModeT","REPEAT"),this.addField_SFString(e,"boundaryModeR","REPEAT"),this.addField_SFString(e,"magnificationFilter","FASTEST"),this.addField_SFString(e,"minificationFilter","FASTEST"),this.addField_SFString(e,"textureCompression","FASTEST"),this.addField_SFFloat(e,"texturePriority",0),this.addField_SFBool(e,"generateMipMaps",!1)}),{fieldChanged:function(e){this._vf.hasOwnProperty(e)&amp;&amp;(Array.forEach(this._parentNodes,(function(e){Array.forEach(e._parentNodes,(function(e){Array.forEach(e._parentNodes,(function(e){e._dirty.texture=!0}))}))})),this._nameSpace.doc.needRender=!0)}})),x3dom.registerNodeType("X3DTextureNode","Texturing",defineClass(x3dom.nodeTypes.X3DAppearanceChildNode,(function(e){x3dom.nodeTypes.X3DTextureNode.superClass.call(this,e),this.addField_SFInt32(e,"origChannelCount",0),this.addField_MFString(e,"url",[]),this.addField_SFBool(e,"repeatS",!0),this.addField_SFBool(e,"repeatT",!0),this.addField_SFBool(e,"scale",!0),this.addField_SFString(e,"crossOrigin",""),this.addField_SFNode("textureProperties",x3dom.nodeTypes.TextureProperties),this._needPerFrameUpdate=!1,this._isCanvas=!1,this._type="diffuseMap",this._blending=1==this._vf.origChannelCount||2==this._vf.origChannelCount}),{invalidateGLObject:function(){Array.forEach(this._parentNodes,(function(e){Array.forEach(e._parentNodes,(function(e){x3dom.isa(e,x3dom.nodeTypes.X3DShapeNode)?e._dirty.texture=!0:Array.forEach(e._parentNodes,(function(e){x3dom.isa(e,x3dom.nodeTypes.X3DShapeNode)?e._dirty.texture=!0:Array.forEach(e._parentNodes,(function(e){x3dom.isa(e,x3dom.nodeTypes.X3DShapeNode)&amp;&amp;(e._dirty.texture=!0)}))}))}))})),this._nameSpace.doc.needRender=!0},parentAdded:function(e){Array.forEach(e._parentNodes,(function(e){x3dom.isa(e,x3dom.nodeTypes.Shape)?e._dirty.texture=!0:Array.forEach(e._parentNodes,(function(e){e._dirty.texture=!0}))}))},parentRemoved:function(e){Array.forEach(e._parentNodes,(function(e){x3dom.isa(e,x3dom.nodeTypes.Shape)?e._dirty.texture=!0:Array.forEach(e._parentNodes,(function(e){e._dirty.texture=!0}))}))},fieldChanged:function(e){if("url"==e||"origChannelCount"==e||"repeatS"==e||"repeatT"==e||"scale"==e||"crossOrigin"==e){var t=this;Array.forEach(this._parentNodes,(function(e){if(x3dom.isa(e,x3dom.nodeTypes.X3DAppearanceNode))e.nodeChanged(),Array.forEach(e._parentNodes,(function(e){e._dirty.texture=!0}));else if(x3dom.isa(e,x3dom.nodeTypes.MultiTexture))Array.forEach(e._parentNodes,(function(e){e.nodeChanged(),Array.forEach(e._parentNodes,(function(e){e._dirty.texture=!0}))}));else if(x3dom.isa(e,x3dom.nodeTypes.ComposedCubeMapTexture))Array.forEach(e._parentNodes,(function(e){e.nodeChanged(),Array.forEach(e._parentNodes,(function(e){e._dirty.texture=!0}))}));else if(x3dom.isa(e,x3dom.nodeTypes.ImageGeometry)){var i=null;t._xmlNode&amp;&amp;t._xmlNode.hasAttribute("containerField")&amp;&amp;(i=t._xmlNode.getAttribute("containerField"),e._dirty[i]=!0)}else if(void 0!==x3dom.nodeTypes.X3DVolumeDataNode)if(x3dom.isa(e,x3dom.nodeTypes.X3DVolumeRenderStyleNode)){if(t._xmlNode&amp;&amp;t._xmlNode.hasAttribute("containerField"))if(e._volumeDataParent)e._volumeDataParent._dirty.texture=!0;else{for(var s=e._parentNodes[0];!x3dom.isa(s,x3dom.nodeTypes.X3DVolumeDataNode)&amp;&amp;x3dom.isa(s,x3dom.nodeTypes.X3DNode);)s=s._parentNodes[0];x3dom.isa(s,x3dom.nodeTypes.X3DNode)&amp;&amp;(s._dirty.texture=!0)}}else x3dom.isa(e,x3dom.nodeTypes.X3DVolumeDataNode)&amp;&amp;t._xmlNode&amp;&amp;t._xmlNode.hasAttribute("containerField")&amp;&amp;(e._dirty.texture=!0)}))}},getTexture:function(e){return 0===e?this:null},size:function(){return 1}})),x3dom.registerNodeType("MultiTexture","Texturing",defineClass(x3dom.nodeTypes.X3DTextureNode,(function(e){x3dom.nodeTypes.MultiTexture.superClass.call(this,e),this.addField_MFNode("texture",x3dom.nodeTypes.X3DTextureNode)}),{getTexture:function(e){return e&gt;=0&amp;&amp;e&lt;this._cf.texture.nodes.length?this._cf.texture.nodes[e]:null},getTextures:function(){return this._cf.texture.nodes},size:function(){return this._cf.texture.nodes.length}})),x3dom.registerNodeType("Texture","Texturing",defineClass(x3dom.nodeTypes.X3DTextureNode,(function(e){x3dom.nodeTypes.Texture.superClass.call(this,e),this.addField_SFBool(e,"hideChildren",!0),this._video=null,this._intervalID=0,this._canvas=null}),{nodeChanged:function(){if(!this._vf.url.length&amp;&amp;this._xmlNode){x3dom.debug.logInfo("No Texture URL given, searching for &amp;lt;img&amp;gt; elements...");var e=this;try{Array.forEach(this._xmlNode.childNodes,(function(t){if(1===t.nodeType){var i=t.getAttribute("src");if(i){if(e._vf.url.push(i),x3dom.debug.logInfo(e._vf.url[e._vf.url.length-1]),"video"===t.localName.toLowerCase())e._needPerFrameUpdate=!0,e._video=document.createElement("video"),e._video.setAttribute("preload","auto"),e._video.setAttribute("muted","muted"),document.getElementsByTagName("body")[0].appendChild(e._video),e._video.style.display="none",e._video.style.visibility="hidden"}else"canvas"===t.localName.toLowerCase()&amp;&amp;(e._needPerFrameUpdate=!0,e._isCanvas=!0,e._canvas=t);t.style&amp;&amp;e._vf.hideChildren&amp;&amp;(t.style.display="none",t.style.visibility="hidden"),x3dom.debug.logInfo("### Found &amp;lt;"+t.nodeName+"&amp;gt; tag.")}}))}catch(t){x3dom.debug.logException(t)}}},shutdown:function(){if(this._video){for(this._video.pause();this._video.hasChildNodes();)this._video.removeChild(this._video.firstChild);document.body.removeChild(this._video),this._video=null}}})),x3dom.registerNodeType("RenderedTexture","Texturing",defineClass(x3dom.nodeTypes.X3DTextureNode,(function(e){x3dom.nodeTypes.RenderedTexture.superClass.call(this,e),e?e.doc._nodeBag.renderTextures.push(this):x3dom.debug.logWarning("RenderedTexture: No runtime context found!"),this.addField_SFNode("viewpoint",x3dom.nodeTypes.X3DViewpointNode),this.addField_SFNode("background",x3dom.nodeTypes.X3DBackgroundNode),this.addField_SFNode("fog",x3dom.nodeTypes.X3DFogNode),this.addField_SFNode("scene",x3dom.nodeTypes.X3DNode),this.addField_MFNode("excludeNodes",x3dom.nodeTypes.X3DNode),this.addField_MFInt32(e,"dimensions",[128,128,4]),this.addField_SFString(e,"update","NONE"),this.addField_SFBool(e,"showNormals",!1),this.addField_SFString(e,"stereoMode","NONE"),this.addField_SFFloat(e,"interpupillaryDistance",.064),this.addField_SFFloat(e,"eyeToScreenDistance",.041),this.addField_SFFloat(e,"vScreenSize",.07074),this.addField_SFVec3f(e,"lensCenter",.15197,0,0),this.addField_SFBool(e,"depthMap",!1),this.addField_SFBool(e,"oculusRiftVersion",1),x3dom.debug.assert(this._vf.dimensions.length&gt;=3,"RenderedTexture.dimensions requires at least 3 entries."),this._clearParents=!0,this._needRenderUpdate=!0,this.checkDepthTextureSupport=function(){this._vf.depthMap&amp;&amp;null===x3dom.caps.DEPTH_TEXTURE&amp;&amp;x3dom.debug.logWarning("RenderedTexture Node: depth texture extension not supported")},this.checkDepthTextureSupport()}),{nodeChanged:function(){this._clearParents=!0,this._needRenderUpdate=!0},fieldChanged:function(e){switch(e){case"excludeNodes":this._clearParents=!0;break;case"update":"NEXT_FRAME_ONLY"!=this._vf.update.toUpperCase()&amp;&amp;"ALWAYS"!=this._vf.update.toUpperCase()||(this._needRenderUpdate=!0);break;case"depthMap":this.checkDepthTextureSupport(),this._x3domTexture.updateTexture(),this._needRenderUpdate=!0}},getViewMatrix:function(){if(this._clearParents&amp;&amp;this._cf.excludeNodes.nodes.length){var e=this;Array.forEach(this._cf.excludeNodes.nodes,(function(t){for(var i=0,s=t._parentNodes.length;i&lt;s;i++)t._parentNodes[i]===e&amp;&amp;(t._parentNodes.splice(i,1),t.parentRemoved(e))})),this._clearParents=!1}var t=this._cf.scene.node,i=this._nameSpace.doc._scene,s=i.getViewpoint(),r=this._cf.viewpoint.node,o=null;if(null===r||r===s)o=this._nameSpace.doc._viewarea.getViewMatrix();else if(t&amp;&amp;t!==i)o=r.getViewMatrix();else{var n=r.getCurrentTransform();o=r.getViewMatrix().mult(n.inverse())}var a=this._vf.stereoMode.toUpperCase();if("NONE"!=a){var h=this._vf.interpupillaryDistance/2;"RIGHT_EYE"==a&amp;&amp;(h=-h),o=new x3dom.fields.SFMatrix4f(1,0,0,h,0,1,0,0,0,0,1,0,0,0,0,1).mult(o)}return o},getProjectionMatrix:function(){var e,t=this._nameSpace.doc,i=t._scene.getViewpoint(),s=this._cf.viewpoint.node,r=null,o=this._vf.dimensions[0],n=this._vf.dimensions[1],a=this._vf.stereoMode.toUpperCase(),h="NONE"!=a;if(null===s||s===i?(r=x3dom.fields.SFMatrix4f.copy(t._viewarea.getProjectionMatrix()),h?(e=2*Math.atan(this._vf.vScreenSize/(2*this._vf.eyeToScreenDistance)),e=1/Math.tan(e/2)):e=1/Math.tan(i._vf.fieldOfView/2),r._00=e/(o/n),r._11=e):r=s.getProjectionMatrix(o/n),h){var d=this._vf.lensCenter.copy();"RIGHT_EYE"==a&amp;&amp;(d.x=-d.x),r=new x3dom.fields.SFMatrix4f(1,0,0,d.x,0,1,0,d.y,0,0,1,d.z,0,0,0,1).mult(r)}return r},getWCtoCCMatrix:function(){var e=this.getViewMatrix();return this.getProjectionMatrix().mult(e)},parentRemoved:function(e){if(0===this._parentNodes.length)for(var t=this.findX3DDoc(),i=0,s=t._nodeBag.renderTextures.length;i&lt;s;i++)t._nodeBag.renderTextures[i]===this&amp;&amp;t._nodeBag.renderTextures.splice(i,1);this._cf.scene.node&amp;&amp;this._cf.scene.node.parentRemoved(this)},requirePingPong:function(){return!1}})),x3dom.registerNodeType("RefinementTexture","Texturing",defineClass(x3dom.nodeTypes.RenderedTexture,(function(e){if(x3dom.nodeTypes.RefinementTexture.superClass.call(this,e),this.addField_SFString(e,"stamp0","gpuii/stamps/0.gif"),this.addField_SFString(e,"stamp1","gpuii/stamps/1.gif"),this.addField_SFBool(e,"autoRefinement",!0),this.addField_SFString(e,"format","jpg"),this.addField_SFInt32(e,"iterations",7),this.addField_SFInt32(e,"maxLevel",this._vf.iterations),this._vf.iterations%2===0){var t=this._vf.stamp0;this._vf.stamp0=this._vf.stamp1,this._vf.stamp1=t}this._vf.iterations=this._vf.iterations&gt;11?11:this._vf.iterations,this._vf.iterations=this._vf.iterations&lt;3?3:this._vf.iterations,this._vf.maxLevel=this._vf.maxLevel&gt;11?11:this._vf.maxLevel,this._vf.maxLevel=this._vf.maxLevel&lt;3?3:this._vf.maxLevel,this._vf.maxLevel=this._vf.maxLevel&gt;this._vf.iterations?this._vf.iterations:this._vf.maxLevel;var i=[{x:4,y:8},{x:8,y:8},{x:8,y:16},{x:16,y:16},{x:16,y:32},{x:32,y:32},{x:32,y:64},{x:64,y:64},{x:64,y:128}];this._repeat=new x3dom.fields.SFVec2f(this._vf.dimensions[0]/i[this._vf.iterations-3].x,this._vf.dimensions[1]/i[this._vf.iterations-3].y),this._renderedImage=0,this._currLoadLevel=0,this._loadLevel=1}),{nextLevel:function(){this._loadLevel&lt;this._vf.maxLevel&amp;&amp;(this._loadLevel++,this._nameSpace.doc.needRender=!0)},requirePingPong:function(){return this._currLoadLevel&lt;=this._vf.maxLevel&amp;&amp;this._renderedImage&lt;this._loadLevel}})),x3dom.registerNodeType("PixelTexture","Texturing",defineClass(x3dom.nodeTypes.X3DTextureNode,(function(e){x3dom.nodeTypes.PixelTexture.superClass.call(this,e),this.addField_SFImage(e,"image",0,0,0)}),{fieldChanged:function(e){"image"==e&amp;&amp;this.invalidateGLObject()},getWidth:function(){return this._vf.image.width},getHeight:function(){return this._vf.image.height},getComponents:function(){return this._vf.image.comp},setPixel:function(e,t,i,s){s=void 0==s||s,this._x3domTexture?(this._x3domTexture.setPixel(e,t,[255*i.r,255*i.g,255*i.b,255*i.a],s),this._vf.image.setPixel(e,t,i)):(this._vf.image.setPixel(e,t,i),s&amp;&amp;this.invalidateGLObject())},getPixel:function(e,t){return this._vf.image.getPixel(e,t)},setPixels:function(e,t){t=void 0==t||t,this._vf.image.setPixels(e),t&amp;&amp;this.invalidateGLObject()},getPixels:function(){return this._vf.image.getPixels()}})),x3dom.registerNodeType("ImageTexture","Texturing",defineClass(x3dom.nodeTypes.Texture,(function(e){x3dom.nodeTypes.ImageTexture.superClass.call(this,e)}))),x3dom.registerNodeType("MovieTexture","Texturing",defineClass(x3dom.nodeTypes.Texture,(function(e){x3dom.nodeTypes.MovieTexture.superClass.call(this,e),this.addField_SFBool(e,"loop",!1),this.addField_SFFloat(e,"speed",1),this.addField_SFTime(e,"pauseTime",0),this.addField_SFFloat(e,"pitch",1),this.addField_SFTime(e,"resumeTime",0),this.addField_SFTime(e,"startTime",0),this.addField_SFTime(e,"stopTime",0)}))),x3dom.registerNodeType("X3DTextureCoordinateNode","Texturing",defineClass(x3dom.nodeTypes.X3DGeometricPropertyNode,(function(e){x3dom.nodeTypes.X3DTextureCoordinateNode.superClass.call(this,e)}),{fieldChanged:function(e){"texCoord"!==e&amp;&amp;"point"!==e&amp;&amp;"parameter"!==e&amp;&amp;"mode"!==e||Array.forEach(this._parentNodes,(function(e){e.fieldChanged("texCoord")}))},parentAdded:function(e){e._mesh&amp;&amp;e._cf.texCoord.node!==this&amp;&amp;e.fieldChanged("texCoord")}})),x3dom.registerNodeType("TextureCoordinate","Texturing",defineClass(x3dom.nodeTypes.X3DTextureCoordinateNode,(function(e){x3dom.nodeTypes.TextureCoordinate.superClass.call(this,e),this.addField_MFVec2f(e,"point",[])}))),x3dom.registerNodeType("TextureCoordinateGenerator","Texturing",defineClass(x3dom.nodeTypes.X3DTextureCoordinateNode,(function(e){x3dom.nodeTypes.TextureCoordinateGenerator.superClass.call(this,e),this.addField_SFString(e,"mode","SPHERE"),this.addField_MFFloat(e,"parameter",[])}))),x3dom.registerNodeType("MultiTextureCoordinate","Texturing",defineClass(x3dom.nodeTypes.X3DTextureCoordinateNode,(function(e){x3dom.nodeTypes.MultiTextureCoordinate.superClass.call(this,e),this.addField_MFNode("texCoord",x3dom.nodeTypes.X3DTextureCoordinateNode)}))),x3dom.registerNodeType("ImageTextureAtlas","Texturing",defineClass(x3dom.nodeTypes.Texture,(function(e){x3dom.nodeTypes.ImageTextureAtlas.superClass.call(this,e),this.addField_SFInt32(e,"numberOfSlices",0),this.addField_SFInt32(e,"slicesOverX",0),this.addField_SFInt32(e,"slicesOverY",0)}))),x3dom.registerNodeType("X3DEnvironmentTextureNode","CubeMapTexturing",defineClass(x3dom.nodeTypes.X3DTextureNode,(function(e){x3dom.nodeTypes.X3DEnvironmentTextureNode.superClass.call(this,e)}),{getTexUrl:function(){return[]},getTexSize:function(){return-1}})),x3dom.registerNodeType("ComposedCubeMapTexture","CubeMapTexturing",defineClass(x3dom.nodeTypes.X3DEnvironmentTextureNode,(function(e){x3dom.nodeTypes.ComposedCubeMapTexture.superClass.call(this,e),this.addField_SFNode("back",x3dom.nodeTypes.Texture),this.addField_SFNode("front",x3dom.nodeTypes.Texture),this.addField_SFNode("bottom",x3dom.nodeTypes.Texture),this.addField_SFNode("top",x3dom.nodeTypes.Texture),this.addField_SFNode("left",x3dom.nodeTypes.Texture),this.addField_SFNode("right",x3dom.nodeTypes.Texture),this._type="environmentMap"}),{getTexUrl:function(){return[this._nameSpace.getURL(this._cf.back.node._vf.url[0]),this._nameSpace.getURL(this._cf.front.node._vf.url[0]),this._nameSpace.getURL(this._cf.bottom.node._vf.url[0]),this._nameSpace.getURL(this._cf.top.node._vf.url[0]),this._nameSpace.getURL(this._cf.left.node._vf.url[0]),this._nameSpace.getURL(this._cf.right.node._vf.url[0])]}})),x3dom.registerNodeType("GeneratedCubeMapTexture","CubeMapTexturing",defineClass(x3dom.nodeTypes.X3DEnvironmentTextureNode,(function(e){x3dom.nodeTypes.GeneratedCubeMapTexture.superClass.call(this,e),this.addField_SFInt32(e,"size",128),this.addField_SFString(e,"update","NONE"),this._type="cubeMap",x3dom.debug.logWarning("GeneratedCubeMapTexture NYI")}),{getTexSize:function(){return this._vf.size}})),x3dom.registerNodeType("Uniform","Shaders",defineClass(x3dom.nodeTypes.Field,(function(e){x3dom.nodeTypes.Uniform.superClass.call(this,e)}))),x3dom.registerNodeType("SurfaceShaderTexture","Shaders",defineClass(x3dom.nodeTypes.X3DTextureNode,(function(e){x3dom.nodeTypes.SurfaceShaderTexture.superClass.call(this,e),this.addField_SFInt32(e,"textureCoordinatesId",0),this.addField_SFString(e,"channelMask","DEFAULT"),this.addField_SFBool(e,"isSRGB",!1),this.addField_SFNode("texture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("textureTransform",x3dom.nodeTypes.X3DTextureTransformNode)}))),x3dom.registerNodeType("X3DShaderNode","Shaders",defineClass(x3dom.nodeTypes.X3DAppearanceChildNode,(function(e){x3dom.nodeTypes.X3DShaderNode.superClass.call(this,e),this.addField_SFString(e,"language","")}))),x3dom.registerNodeType("CommonSurfaceShader","Shaders",defineClass(x3dom.nodeTypes.X3DShaderNode,(function(e){x3dom.nodeTypes.CommonSurfaceShader.superClass.call(this,e),this.addField_SFInt32(e,"tangentTextureCoordinatesId",-1),this.addField_SFInt32(e,"binormalTextureCoordinatesId",-1),this.addField_SFVec3f(e,"emissiveFactor",0,0,0),this.addField_SFInt32(e,"emissiveTextureId",-1),this.addField_SFInt32(e,"emissiveTextureCoordinatesId",0),this.addField_SFString(e,"emissiveTextureChannelMask","rgb"),this.addField_SFVec3f(e,"ambientFactor",.2,.2,.2),this.addField_SFInt32(e,"ambientTextureId",-1),this.addField_SFInt32(e,"ambientTextureCoordinatesId",0),this.addField_SFString(e,"ambientTextureChannelMask","rgb"),this.addField_SFVec3f(e,"diffuseFactor",.8,.8,.8),this.addField_SFInt32(e,"diffuseTextureId",-1),this.addField_SFInt32(e,"diffuseTextureCoordinatesId",0),this.addField_SFString(e,"diffuseTextureChannelMask","rgb"),this.addField_SFVec3f(e,"specularFactor",0,0,0),this.addField_SFInt32(e,"specularTextureId",-1),this.addField_SFInt32(e,"specularTextureCoordinatesId",0),this.addField_SFString(e,"specularTextureChannelMask","rgb"),this.addField_SFFloat(e,"shininessFactor",.2),this.addField_SFInt32(e,"shininessTextureId",-1),this.addField_SFInt32(e,"shininessTextureCoordinatesId",0),this.addField_SFString(e,"shininessTextureChannelMask","a"),this.addField_SFString(e,"normalFormat","UNORM"),this.addField_SFString(e,"normalSpace","TANGENT"),this.addField_SFInt32(e,"normalTextureId",-1),this.addField_SFInt32(e,"normalTextureCoordinatesId",0),this.addField_SFString(e,"normalTextureChannelMask","rgb"),this.addField_SFVec3f(e,"reflectionFactor",0,0,0),this.addField_SFInt32(e,"reflectionTextureId",-1),this.addField_SFInt32(e,"reflectionTextureCoordinatesId",0),this.addField_SFString(e,"reflectionTextureChannelMask","rgb"),this.addField_SFVec3f(e,"transmissionFactor",0,0,0),this.addField_SFInt32(e,"transmissionTextureId",-1),this.addField_SFInt32(e,"transmissionTextureCoordinatesId",0),this.addField_SFString(e,"transmissionTextureChannelMask","rgb"),this.addField_SFVec3f(e,"environmentFactor",1,1,1),this.addField_SFInt32(e,"environmentTextureId",-1),this.addField_SFInt32(e,"environmentTextureCoordinatesId",0),this.addField_SFString(e,"environmentTextureChannelMask","rgb"),this.addField_SFFloat(e,"relativeIndexOfRefraction",1),this.addField_SFFloat(e,"fresnelBlend",0),this.addField_SFString(e,"displacementAxis","y"),this.addField_SFFloat(e,"displacementFactor",255),this.addField_SFInt32(e,"displacementTextureId",-1),this.addField_SFInt32(e,"displacementTextureCoordinatesId",0),this.addField_SFNode("emissiveTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("ambientTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("diffuseTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("specularTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("shininessTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("normalTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("reflectionTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("transmissionTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("environmentTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("displacementTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("diffuseDisplacementTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("multiDiffuseAlphaTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("multiSpecularShininessTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("multiEmissiveAmbientTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("multiVisibilityTexture",x3dom.nodeTypes.X3DTextureNode),this.addField_SFVec3f(e,"normalScale",2,2,2),this.addField_SFVec3f(e,"normalBias",-1,-1,-1),this.addField_SFFloat(e,"alphaFactor",1),this.addField_SFBool(e,"invertAlphaTexture",!1),this.addField_SFInt32(e,"alphaTextureId",-1),this.addField_SFInt32(e,"alphaTextureCoordinatesId",0),this.addField_SFString(e,"alphaTextureChannelMask","a"),this.addField_SFNode("alphaTexture",x3dom.nodeTypes.X3DTextureNode),this._dirty={}}),{getDiffuseMap:function(){return this._cf.diffuseTexture.node?x3dom.isa(this._cf.diffuseTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.diffuseTexture.node._cf.texture.node._type="diffuseMap",this._cf.diffuseTexture.node._cf.texture.node):(this._cf.diffuseTexture.node._type="diffuseMap",this._cf.diffuseTexture.node):null},getEnvironmentMap:function(){return this._cf.environmentTexture.node?x3dom.isa(this._cf.environmentTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.environmentTexture.node._cf.texture.node._type="environmentMap",this._cf.environmentTexture.node._cf.texture.node):(this._cf.environmentTexture.node._type="environmentMap",this._cf.environmentTexture.node):null},getNormalMap:function(){return this._cf.normalTexture.node?x3dom.isa(this._cf.normalTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.normalTexture.node._cf.texture.node._type="normalMap",this._cf.normalTexture.node._cf.texture.node):(this._cf.normalTexture.node._type="normalMap",this._cf.normalTexture.node):null},getAmbientMap:function(){return this._cf.ambientTexture.node?x3dom.isa(this._cf.ambientTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.ambientTexture.node._cf.texture.node._type="ambientMap",this._cf.ambientTexture.node._cf.texture.node):(this._cf.ambientTexture.node._type="ambientMap",this._cf.ambientTexture.node):null},getSpecularMap:function(){return this._cf.specularTexture.node?x3dom.isa(this._cf.specularTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.specularTexture.node._cf.texture.node._type="specularMap",this._cf.specularTexture.node._cf.texture.node):(this._cf.specularTexture.node._type="specularMap",this._cf.specularTexture.node):null},getShininessMap:function(){return this._cf.shininessTexture.node?x3dom.isa(this._cf.shininessTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.shininessTexture.node._cf.texture.node._type="shininessMap",this._cf.shininessTexture.node._cf.texture.node):(this._cf.shininessTexture.node._type="shininessMap",this._cf.shininessTexture.node):null},getAlphaMap:function(){return this._cf.alphaTexture.node?x3dom.isa(this._cf.alphaTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.alphaTexture.node._cf.texture.node._type="alphaMap",this._cf.alphaTexture.node._cf.texture.node):(this._cf.alphaTexture.node._type="alphaMap",this._cf.alphaTexture.node):null},getDisplacementMap:function(){return this._cf.displacementTexture.node?x3dom.isa(this._cf.displacementTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.displacementTexture.node._cf.texture.node._type="displacementMap",this._cf.displacementTexture.node._cf.texture.node):(this._cf.displacementTexture.node._type="displacementMap",this._cf.displacementTexture.node):null},getDiffuseDisplacementMap:function(){return this._cf.diffuseDisplacementTexture.node?x3dom.isa(this._cf.diffuseDisplacementTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.diffuseDisplacementTexture.node._cf.texture.node._type="diffuseDisplacementMap",this._cf.diffuseDisplacementTexture.node._cf.texture.node):(this._cf.diffuseDisplacementTexture.node._type="diffuseDisplacementMap",this._cf.diffuseDisplacementTexture.node):null},getMultiDiffuseAlphaMap:function(){return this._cf.multiDiffuseAlphaTexture.node?x3dom.isa(this._cf.multiDiffuseAlphaTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.multiDiffuseAlphaTexture.node._cf.texture.node._type="multiDiffuseAlphaMap",this._cf.multiDiffuseAlphaTexture.node._cf.texture.node):(this._cf.multiDiffuseAlphaTexture.node._type="multiDiffuseAlphaMap",this._cf.multiDiffuseAlphaTexture.node):null},getMultiEmissiveAmbientMap:function(){return this._cf.multiEmissiveAmbientTexture.node?x3dom.isa(this._cf.multiEmissiveAmbientTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.multiEmissiveAmbientTexture.node._cf.texture.node._type="multiEmissiveAmbientMap",this._cf.multiEmissiveAmbientTexture.node._cf.texture.node):(this._cf.multiEmissiveAmbientTexture.node._type="multiEmissiveAmbientMap",this._cf.multiEmissiveAmbientTexture.node):null},getMultiSpecularShininessMap:function(){return this._cf.multiSpecularShininessTexture.node?x3dom.isa(this._cf.multiSpecularShininessTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.multiSpecularShininessTexture.node._cf.texture.node._type="multiSpecularShininessMap",this._cf.multiSpecularShininessTexture.node._cf.texture.node):(this._cf.multiSpecularShininessTexture.node._type="multiSpecularShininessMap",this._cf.multiSpecularShininessTexture.node):null},getMultiVisibilityMap:function(){return this._cf.multiVisibilityTexture.node?x3dom.isa(this._cf.multiVisibilityTexture.node,x3dom.nodeTypes.SurfaceShaderTexture)?(this._cf.multiVisibilityTexture.node._cf.texture.node._type="multiVisibilityMap",this._cf.multiVisibilityTexture.node._cf.texture.node):(this._cf.multiVisibilityTexture.node._type="multiVisibilityMap",this._cf.multiVisibilityTexture.node):null},getTextures:function(){var e=[],t=this.getDiffuseMap();t&amp;&amp;e.push(t);var i=this.getNormalMap();i&amp;&amp;e.push(i);var s=this.getSpecularMap();s&amp;&amp;e.push(s);var r=this.getShininessMap();r&amp;&amp;e.push(r);var o=this.getEnvironmentMap();o&amp;&amp;e.push(o);var n=this.getDisplacementMap();n&amp;&amp;e.push(n);var a=this.getDiffuseDisplacementMap();a&amp;&amp;e.push(a);var h=this.getMultiDiffuseAlphaMap();h&amp;&amp;e.push(h);var d=this.getMultiEmissiveAmbientMap();d&amp;&amp;e.push(d);var l=this.getMultiSpecularShininessMap();l&amp;&amp;e.push(l);var u=this.getMultiVisibilityMap();return u&amp;&amp;e.push(u),e},needTexcoords:function(){return!!(this.getDiffuseMap()||this.getNormalMap()||this.getSpecularMap()||this.getShininessMap()||this.getDisplacementMap()||this.getDiffuseDisplacementMap()||this.getEnvironmentMap())}})),x3dom.registerNodeType("ComposedShader","Shaders",defineClass(x3dom.nodeTypes.X3DShaderNode,(function(e){x3dom.nodeTypes.ComposedShader.superClass.call(this,e),this.addField_MFNode("fields",x3dom.nodeTypes.Field),this.addField_MFNode("parts",x3dom.nodeTypes.ShaderPart),this._vertex=null,this._fragment=null,this._id=null,x3dom.nodeTypes.ComposedShader.ShaderInfoMsgShown||(x3dom.debug.logInfo("Current ComposedShader node implementation limitations:\nVertex attributes (if given in the standard X3D fields 'coord', 'color', 'normal', 'texCoord'), matrices and texture are provided as follows...\n(see also &lt;a href='http://x3dom.org/x3dom/doc/help/composedShader.html'&gt;http://x3dom.org/x3dom/doc/help/composedShader.html&lt;/a&gt;)\n    attribute vec3 position;\n    attribute vec3 normal;\n    attribute vec2 texcoord;\n    attribute vec3 color;\n    uniform mat4 modelViewProjectionMatrix;\n    uniform mat4 modelViewMatrix;\n    uniform mat4 normalMatrix;\n    uniform mat4 viewMatrix;\n    uniform sampler2D tex;\n"),x3dom.nodeTypes.ComposedShader.ShaderInfoMsgShown=!0)}),{nodeChanged:function(){var e,t=this._cf.parts.nodes.length;for(e=0;e&lt;t;e++)"vertex"==this._cf.parts.nodes[e]._vf.type.toLowerCase()?(this._vertex=this._cf.parts.nodes[e],this._id=this._cf.parts.nodes[e]._id):"fragment"==this._cf.parts.nodes[e]._vf.type.toLowerCase()&amp;&amp;(this._fragment=this._cf.parts.nodes[e],this._id+=" - "+this._cf.parts.nodes[e]._id);var i={};for(t=this._cf.fields.nodes.length,e=0;e&lt;t;e++){var s=this._cf.fields.nodes[e]._vf.name;i.xmlNode=this._cf.fields.nodes[e]._xmlNode;var r=!1;void 0!==i.xmlNode&amp;&amp;null!==i.xmlNode||(i.xmlNode=document.createElement("field"),r=!0),i.xmlNode.setAttribute(s,this._cf.fields.nodes[e]._vf.value);var o="this.addField_"+this._cf.fields.nodes[e]._vf.type+"(ctx, name);";new Function("ctx","name",o).call(this,i,s),r&amp;&amp;(i.xmlNode=null)}Array.forEach(this._parentNodes,(function(e){Array.forEach(e._parentNodes,(function(e){e._cleanupGLObjects&amp;&amp;e._cleanupGLObjects(),e.setAllDirty()}))}))},fieldChanged:function(e){var t,i=this._cf.fields.nodes.length;for(t=0;t&lt;i;t++){var s=this._cf.fields.nodes[t]._vf.name;if(s===e){var r=this._cf.fields.nodes[t]._vf.value;try{this._vf[s].setValueByStr(r)}catch(o){try{switch((typeof this._vf[s]).toString()){case"number":this._vf[s]=+r;break;case"boolean":this._vf[s]="true"===r.toLowerCase();break;case"string":this._vf[s]=r}}catch(n){x3dom.debug.logError("setValueByStr() NYI for "+typeof this._vf[s])}}break}}"url"===s&amp;&amp;Array.forEach(this._parentNodes,(function(e){Array.forEach(e._parentNodes,(function(e){e._dirty.shader=!0}))}))},parentAdded:function(e){e.nodeChanged()}})),x3dom.nodeTypes.ComposedShader.ShaderInfoMsgShown=!1,x3dom.registerNodeType("ShaderPart","Shaders",defineClass(x3dom.nodeTypes.X3DNode,(function(e){x3dom.nodeTypes.ShaderPart.superClass.call(this,e),this.addField_MFString(e,"url",[]),this.addField_SFString(e,"type","VERTEX"),this._id=e&amp;&amp;e.xmlNode&amp;&amp;""!=e.xmlNode.id?e.xmlNode.id:++x3dom.nodeTypes.Shape.shaderPartID,x3dom.debug.assert("vertex"==this._vf.type.toLowerCase()||"fragment"==this._vf.type.toLowerCase(),"Unknown shader part type!")}),{nodeChanged:function(){var e={};if(e.xmlNode=this._xmlNode,void 0!==e.xmlNode&amp;&amp;null!==e.xmlNode){var t=this;if(t._vf.url.length&amp;&amp;-1==t._vf.url[0].indexOf("\n")){var i=new XMLHttpRequest;i.open("GET",t._nameSpace.getURL(t._vf.url[0]),!1),i.onload=function(){t._vf.url=new x3dom.fields.MFString([]),t._vf.url.push(i.response)},i.onerror=function(){x3dom.debug.logError("Could not load file '"+t._vf.url[0]+"'.")},x3dom.RequestManager.addRequest(i)}else{t._vf.url.length&amp;&amp;(t._vf.url=new x3dom.fields.MFString([]));try{t._vf.url.push(e.xmlNode.childNodes[1].nodeValue),e.xmlNode.removeChild(e.xmlNode.childNodes[1])}catch(s){Array.forEach(e.xmlNode.childNodes,(function(e){3===e.nodeType?t._vf.url.push(e.nodeValue):4===e.nodeType&amp;&amp;t._vf.url.push(e.data),e.parentNode.removeChild(e)}))}}}Array.forEach(this._parentNodes,(function(e){e.nodeChanged()}))},fieldChanged:function(e){"url"===e&amp;&amp;Array.forEach(this._parentNodes,(function(e){e.fieldChanged("url")}))},parentAdded:function(e){e.nodeChanged()}})),x3dom.registerNodeType("X3DVertexAttributeNode","Shaders",defineClass(x3dom.nodeTypes.X3DGeometricPropertyNode,(function(e){x3dom.nodeTypes.X3DVertexAttributeNode.superClass.call(this,e),this.addField_SFString(e,"name","")}))),x3dom.registerNodeType("FloatVertexAttribute","Shaders",defineClass(x3dom.nodeTypes.X3DVertexAttributeNode,(function(e){x3dom.nodeTypes.FloatVertexAttribute.superClass.call(this,e),this.addField_SFInt32(e,"numComponents",4),this.addField_MFFloat(e,"value",[])}))),x3dom.registerNodeType("X3DSpatialGeometryNode","Geometry3D",defineClass(x3dom.nodeTypes.X3DGeometryNode,(function(e){x3dom.nodeTypes.X3DSpatialGeometryNode.superClass.call(this,e)}))),x3dom.registerNodeType("Plane","Geometry3D",defineClass(x3dom.nodeTypes.X3DSpatialGeometryNode,(function(e){x3dom.nodeTypes.Plane.superClass.call(this,e),this.addField_SFVec2f(e,"size",2,2),this.addField_SFVec2f(e,"subdivision",1,1),this.addField_SFVec3f(e,"center",0,0,0),this.addField_MFString(e,"primType",["TRIANGLES"]),this._vf.primType.length&amp;&amp;(this._mesh._primType=this._vf.primType[0]);var t=this._vf.size.x,i=this._vf.size.y,s=this._vf.subdivision.x,r=this._vf.subdivision.y,o="Plane_"+t+"-"+i+"-"+s+"-"+r+"-"+this._vf.center.x+"-"+this._vf.center.y+"-"+this._vf.center.z;if(e&amp;&amp;this._vf.useGeoCache&amp;&amp;void 0!==x3dom.geoCache[o])this._mesh=x3dom.geoCache[o];else{var n=0,a=0,h=t/s,d=i/r;for(t/=2,i/=2,a=0;a&lt;=r;a++)for(n=0;n&lt;=s;n++)this._mesh._positions[0].push(this._vf.center.x+n*h-t),this._mesh._positions[0].push(this._vf.center.y+a*d-i),this._mesh._positions[0].push(this._vf.center.z),this._mesh._normals[0].push(0),this._mesh._normals[0].push(0),this._mesh._normals[0].push(1),this._mesh._texCoords[0].push(n/s),this._mesh._texCoords[0].push(a/r);for(a=1;a&lt;=r;a++)for(n=0;n&lt;s;n++)this._mesh._indices[0].push((a-1)*(s+1)+n),this._mesh._indices[0].push((a-1)*(s+1)+n+1),this._mesh._indices[0].push(a*(s+1)+n),this._mesh._indices[0].push(a*(s+1)+n),this._mesh._indices[0].push((a-1)*(s+1)+n+1),this._mesh._indices[0].push(a*(s+1)+n+1);this._mesh._invalidate=!0,this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,x3dom.geoCache[o]=this._mesh}}),{fieldChanged:function(e){if("size"==e||"center"==e){this._mesh._positions[0]=[];var t=this._vf.size.x,i=this._vf.size.y,s=0,r=0,o=t/(a=this._vf.subdivision.x),n=i/(h=this._vf.subdivision.y);for(t/=2,i/=2,r=0;r&lt;=h;r++)for(s=0;s&lt;=a;s++)this._mesh._positions[0].push(this._vf.center.x+s*o-t),this._mesh._positions[0].push(this._vf.center.y+r*n-i),this._mesh._positions[0].push(this._vf.center.z);this.invalidateVolume(),this._mesh._numCoords=this._mesh._positions[0].length/3,Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}))}else if("subdivision"==e){this._mesh._positions[0]=[],this._mesh._indices[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[];var a,h;t=this._vf.size.x,i=this._vf.size.y,s=0,r=0,o=t/(a=this._vf.subdivision.x),n=i/(h=this._vf.subdivision.y);for(t/=2,i/=2,r=0;r&lt;=h;r++)for(s=0;s&lt;=a;s++)this._mesh._positions[0].push(this._vf.center.x+s*o-t),this._mesh._positions[0].push(this._vf.center.y+r*n-i),this._mesh._positions[0].push(this._vf.center.z),this._mesh._normals[0].push(0),this._mesh._normals[0].push(0),this._mesh._normals[0].push(1),this._mesh._texCoords[0].push(s/a),this._mesh._texCoords[0].push(r/h);for(r=1;r&lt;=h;r++)for(s=0;s&lt;a;s++)this._mesh._indices[0].push((r-1)*(a+1)+s),this._mesh._indices[0].push((r-1)*(a+1)+s+1),this._mesh._indices[0].push(r*(a+1)+s),this._mesh._indices[0].push(r*(a+1)+s),this._mesh._indices[0].push((r-1)*(a+1)+s+1),this._mesh._indices[0].push(r*(a+1)+s+1);this.invalidateVolume(),this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,Array.forEach(this._parentNodes,(function(e){e.setAllDirty(),e.invalidateVolume()}))}}})),x3dom.registerNodeType("Box","Geometry3D",defineClass(x3dom.nodeTypes.X3DSpatialGeometryNode,(function(e){x3dom.nodeTypes.Box.superClass.call(this,e),this.addField_SFVec3f(e,"size",2,2,2),this.addField_SFBool(e,"hasHelperColors",!1);var t=this._vf.size.x,i=this._vf.size.y,s=this._vf.size.z,r="Box_"+t+"-"+i+"-"+s;this._vf.useGeoCache&amp;&amp;void 0!==x3dom.geoCache[r]?this._mesh=x3dom.geoCache[r]:(t/=2,i/=2,s/=2,this._mesh._positions[0]=[-t,-i,-s,-t,i,-s,t,i,-s,t,-i,-s,-t,-i,s,-t,i,s,t,i,s,t,-i,s,-t,-i,-s,-t,-i,s,-t,i,s,-t,i,-s,t,-i,-s,t,-i,s,t,i,s,t,i,-s,-t,i,-s,-t,i,s,t,i,s,t,i,-s,-t,-i,-s,-t,-i,s,t,-i,s,t,-i,-s],this._mesh._normals[0]=[0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],this._mesh._texCoords[0]=[1,0,1,1,0,1,0,0,0,0,0,1,1,1,1,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,1,0],this._vf.hasHelperColors&amp;&amp;(this._mesh._colors[0]=[0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,1,1,0,1,0,0,0,0,0,1,0,1,1,0,1,0,1,0,0,1,0,1,1,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0]),this._mesh._indices[0]=[0,1,2,2,3,0,4,7,5,5,7,6,8,9,10,10,11,8,12,14,13,14,12,15,16,17,18,18,19,16,20,22,21,22,20,23],this._mesh._invalidate=!0,this._mesh._numFaces=12,this._mesh._numCoords=24,x3dom.geoCache[r]=this._mesh)}),{fieldChanged:function(e){if("size"===e){var t=this._vf.size.x/2,i=this._vf.size.y/2,s=this._vf.size.z/2;this._mesh._positions[0]=[-t,-i,-s,-t,i,-s,t,i,-s,t,-i,-s,-t,-i,s,-t,i,s,t,i,s,t,-i,s,-t,-i,-s,-t,-i,s,-t,i,s,-t,i,-s,t,-i,-s,t,-i,s,t,i,s,t,i,-s,-t,i,-s,-t,i,s,t,i,s,t,i,-s,-t,-i,-s,-t,-i,s,t,-i,s,t,-i,-s],this.invalidateVolume(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}))}else"hasHelperColors"===e&amp;&amp;(this._vf.hasHelperColors?this._mesh._colors[0]=[0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,1,1,0,1,0,0,0,0,0,1,0,1,1,0,1,0,1,0,0,1,0,1,1,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0]:this._mesh._colors[0]=[],Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0})))}})),x3dom.registerNodeType("Sphere","Geometry3D",defineClass(x3dom.nodeTypes.X3DSpatialGeometryNode,(function(e){x3dom.nodeTypes.Sphere.superClass.call(this,e),this.addField_SFFloat(e,"radius",e?1:1e4),this.addField_SFVec2f(e,"subdivision",24,24);var t=1,i=this._vf.radius,s=this._vf.subdivision.x,r=this._vf.subdivision.y,o="Sphere_"+i+"-"+s+"-"+r;if(this._vf.useGeoCache&amp;&amp;void 0!==x3dom.geoCache[o])this._mesh=x3dom.geoCache[o];else{if(e&amp;&amp;(t=e.doc.properties.getProperty("PrimitiveQuality","Medium")),x3dom.Utils.isNumber(t))t=parseFloat(t);else switch(t.toLowerCase()){case"low":t=.3;break;case"medium":t=.5;break;case"high":t=1}var n,a;this._quality=t;var h,d,l,u,f,c,m,_,p,x,g,v,y=Math.floor(s*t),b=Math.floor(r*t);for(n=0;n&lt;=y;n++)for(h=n*Math.PI/y,d=Math.sin(h),l=Math.cos(h),a=0;a&lt;=b;a++)u=2*a*Math.PI/b,f=Math.sin(u),c=-Math.cos(u)*d,m=-l,_=-f*d,p=.25-a/b,x=n/y,this._mesh._positions[0].push(i*c),this._mesh._positions[0].push(i*m),this._mesh._positions[0].push(i*_),this._mesh._normals[0].push(c),this._mesh._normals[0].push(m),this._mesh._normals[0].push(_),this._mesh._texCoords[0].push(p),this._mesh._texCoords[0].push(x);for(n=0;n&lt;y;n++)for(a=0;a&lt;b;a++)v=(g=n*(b+1)+a)+b+1,this._mesh._indices[0].push(g),this._mesh._indices[0].push(v),this._mesh._indices[0].push(g+1),this._mesh._indices[0].push(v),this._mesh._indices[0].push(v+1),this._mesh._indices[0].push(g+1);this._mesh._invalidate=!0,this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,x3dom.geoCache[o]=this._mesh}}),{fieldChanged:function(e){if("radius"===e){this._mesh._positions[0]=[];var t=this._vf.radius,i=this._vf.subdivision.x,s=this._vf.subdivision.y,r=this._quality,o=Math.floor(i*r),n=Math.floor(s*r);for(a=0;a&lt;=o;a++)for(d=a*Math.PI/o,l=Math.sin(d),u=Math.cos(d),h=0;h&lt;=n;h++)f=2*h*Math.PI/n,c=Math.sin(f),m=-Math.cos(f)*l,_=-u,p=-c*l,this._mesh._positions[0].push(t*m),this._mesh._positions[0].push(t*_),this._mesh._positions[0].push(t*p);this.invalidateVolume(),this._mesh._numCoords=this._mesh._positions[0].length/3,Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}))}else if("subdivision"===e){this._mesh._positions[0]=[],this._mesh._indices[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[];var a,h,d,l,u,f,c,m,_,p,x,g,v,y;t=this._vf.radius,i=this._vf.subdivision.x,s=this._vf.subdivision.y,r=this._quality,o=Math.floor(i*r),n=Math.floor(s*r);for(a=0;a&lt;=o;a++)for(d=a*Math.PI/o,l=Math.sin(d),u=Math.cos(d),h=0;h&lt;=n;h++)f=2*h*Math.PI/n,c=Math.sin(f),m=-Math.cos(f)*l,_=-u,p=-c*l,x=.25-h/n,g=a/o,this._mesh._positions[0].push(t*m),this._mesh._positions[0].push(t*_),this._mesh._positions[0].push(t*p),this._mesh._normals[0].push(m),this._mesh._normals[0].push(_),this._mesh._normals[0].push(p),this._mesh._texCoords[0].push(x),this._mesh._texCoords[0].push(g);for(a=0;a&lt;o;a++)for(h=0;h&lt;n;h++)y=(v=a*(n+1)+h)+n+1,this._mesh._indices[0].push(v),this._mesh._indices[0].push(y),this._mesh._indices[0].push(v+1),this._mesh._indices[0].push(y),this._mesh._indices[0].push(y+1),this._mesh._indices[0].push(v+1);this.invalidateVolume(),this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,Array.forEach(this._parentNodes,(function(e){e.setAllDirty(),e.invalidateVolume()}))}}})),x3dom.registerNodeType("Torus","Geometry3D",defineClass(x3dom.nodeTypes.X3DSpatialGeometryNode,(function(e){x3dom.nodeTypes.Torus.superClass.call(this,e);var t=2*Math.PI;this.addField_SFFloat(e,"innerRadius",.5),this.addField_SFFloat(e,"outerRadius",1),this.addField_SFFloat(e,"angle",t),this.addField_SFBool(e,"caps",!0),this.addField_SFVec2f(e,"subdivision",24,24),this.addField_SFBool(e,"insideOutsideRadius",!1),this._vf.angle&lt;0?this._vf.angle=0:this._vf.angle&gt;t&amp;&amp;(this._vf.angle=t),this._origCCW=this._vf.ccw;var i=this._vf.innerRadius,s=this._vf.outerRadius;if(1==this._vf.insideOutsideRadius){if(i&gt;s){var r=i;i=s,s=r}var o=(s-i)/2;s=i+o,i=o,this._vf.ccw=!this._origCCW}var n=this._vf.subdivision.x,a=this._vf.subdivision.y;n=Math.max(3,Math.round(this._vf.angle/t*n));var h="Torus_"+i+"_"+s+"_"+this._vf.angle+"_"+this._vf.subdivision+"-"+this._vf.caps;if(this._vf.useGeoCache&amp;&amp;void 0!==x3dom.geoCache[h])this._mesh=x3dom.geoCache[h];else{var d,l,u,f,c,m,_,p,x,g=this._vf.angle/n,v=t/a;for(d=0,u=0;d&lt;=n;d++,u+=g)for(c=Math.cos(u),m=Math.sin(u),l=0,f=0;l&lt;=a;l++,f+=v)_=Math.cos(f),p=Math.sin(f),x=s+i*_,this._vf.insideOutsideRadius?(this._mesh._positions[0].push(c*x,i*p,-m*x),this._mesh._normals[0].push(c*_,p,-m*_)):(this._mesh._positions[0].push(c*x,-m*x,i*p),this._mesh._normals[0].push(c*_,-m*_,p)),this._mesh._texCoords[0].push(-d/n,l/a);for(d=0;d&lt;a;d++)for(l=0;l&lt;n;l++)this._mesh._indices[0].push(l*(a+1)+d),this._mesh._indices[0].push(l*(a+1)+d+1),this._mesh._indices[0].push((l+1)*(a+1)+d),this._mesh._indices[0].push(l*(a+1)+d+1),this._mesh._indices[0].push((l+1)*(a+1)+d+1),this._mesh._indices[0].push((l+1)*(a+1)+d);if(this._vf.angle&lt;t&amp;&amp;1==this._vf.caps){var y=this._mesh._positions[0].length/3;for(this._vf.insideOutsideRadius?(this._mesh._positions[0].push(s,0,0),this._mesh._normals[0].push(0,0,1)):(this._mesh._positions[0].push(s,0,0),this._mesh._normals[0].push(0,1,0)),this._mesh._texCoords[0].push(.5,.5),l=0,f=0;l&lt;=a;l++,f+=v)_=Math.cos(f),p=Math.sin(f),x=s+i*_,this._vf.insideOutsideRadius?(this._mesh._positions[0].push(x,p*i,0),this._mesh._normals[0].push(0,0,1)):(this._mesh._positions[0].push(x,0,p*i),this._mesh._normals[0].push(0,1,0)),this._mesh._texCoords[0].push(.5*(1+_),.5*(1-p)),l&gt;0&amp;&amp;(this._mesh._indices[0].push(y),this._mesh._indices[0].push(y+l),this._mesh._indices[0].push(y+l-1)),l==a&amp;&amp;(this._mesh._indices[0].push(y),this._mesh._indices[0].push(y+1),this._mesh._indices[0].push(y+l));c=Math.cos(this._vf.angle),m=Math.sin(this._vf.angle),y=this._mesh._positions[0].length/3;var b=-m,T=-c;for(this._vf.insideOutsideRadius?(this._mesh._positions[0].push(c*s,0,-m*s),this._mesh._normals[0].push(b,0,T)):(this._mesh._positions[0].push(c*s,-m*s,0),this._mesh._normals[0].push(b,T,0)),this._mesh._texCoords[0].push(.5,.5),l=0,f=0;l&lt;=a;l++,f+=v)_=Math.cos(f),p=Math.sin(f),x=s+i*_,this._vf.insideOutsideRadius?(this._mesh._positions[0].push(c*x,p*i,-m*x),this._mesh._normals[0].push(b,0,T)):(this._mesh._positions[0].push(c*x,-m*x,p*i),this._mesh._normals[0].push(b,T,0)),this._mesh._texCoords[0].push(1-.5*(1+_),.5*(1-p)),l&gt;0&amp;&amp;(this._mesh._indices[0].push(y),this._mesh._indices[0].push(y+l-1),this._mesh._indices[0].push(y+l)),l==a&amp;&amp;(this._mesh._indices[0].push(y),this._mesh._indices[0].push(y+l),this._mesh._indices[0].push(y+1))}this._mesh._invalidate=!0,this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,x3dom.geoCache[h]=this._mesh}}),{fieldChanged:function(e){if("innerRadius"==e||"outerRadius"==e||"subdivision"==e||"angle"==e||"insideOutsideRadius"==e||"caps"==e){var t=2*Math.PI;this._vf.angle&lt;0?this._vf.angle=0:this._vf.angle&gt;t&amp;&amp;(this._vf.angle=t);var i=this._vf.innerRadius,s=this._vf.outerRadius;if(1==this._vf.insideOutsideRadius){if(i&gt;s){var r=i;i=s,s=r}var o=(s-i)/2;s=i+o,i=o,this._vf.ccw=!this._origCCW}else this._vf.ccw=this._origCCW;var n=this._vf.subdivision.x,a=this._vf.subdivision.y;n=Math.max(3,Math.round(this._vf.angle/t*n));var h,d,l,u,f,c,m,_,p,x=this._vf.angle/n,g=t/a;for(this._mesh._positions[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[],this._mesh._indices[0]=[],h=0,l=0;h&lt;=n;h++,l+=x)for(f=Math.cos(l),c=Math.sin(l),d=0,u=0;d&lt;=a;d++,u+=g)m=Math.cos(u),_=Math.sin(u),p=s+i*m,this._vf.insideOutsideRadius?(this._mesh._positions[0].push(f*p,i*_,-c*p),this._mesh._normals[0].push(f*m,_,-c*m)):(this._mesh._positions[0].push(f*p,-c*p,i*_),this._mesh._normals[0].push(f*m,-c*m,_)),this._mesh._texCoords[0].push(-h/n,d/a);for(h=0;h&lt;a;h++)for(d=0;d&lt;n;d++)this._mesh._indices[0].push(d*(a+1)+h),this._mesh._indices[0].push(d*(a+1)+h+1),this._mesh._indices[0].push((d+1)*(a+1)+h),this._mesh._indices[0].push(d*(a+1)+h+1),this._mesh._indices[0].push((d+1)*(a+1)+h+1),this._mesh._indices[0].push((d+1)*(a+1)+h);if(this._vf.angle&lt;t&amp;&amp;1==this._vf.caps){var v=this._mesh._positions[0].length/3;for(this._vf.insideOutsideRadius?(this._mesh._positions[0].push(s,0,0),this._mesh._normals[0].push(0,0,1)):(this._mesh._positions[0].push(s,0,0),this._mesh._normals[0].push(0,1,0)),this._mesh._texCoords[0].push(.5,.5),d=0,u=0;d&lt;=a;d++,u+=g)m=Math.cos(u),_=Math.sin(u),p=s+i*m,this._vf.insideOutsideRadius?(this._mesh._positions[0].push(p,_*i,0),this._mesh._normals[0].push(0,0,1)):(this._mesh._positions[0].push(p,0,_*i),this._mesh._normals[0].push(0,1,0)),this._mesh._texCoords[0].push(.5*(1+m),.5*(1-_)),d&gt;0&amp;&amp;(this._mesh._indices[0].push(v),this._mesh._indices[0].push(v+d),this._mesh._indices[0].push(v+d-1)),d==a&amp;&amp;(this._mesh._indices[0].push(v),this._mesh._indices[0].push(v+1),this._mesh._indices[0].push(v+d));f=Math.cos(this._vf.angle),c=Math.sin(this._vf.angle),v=this._mesh._positions[0].length/3;var y=-c,b=-f;for(this._vf.insideOutsideRadius?(this._mesh._positions[0].push(f*s,0,-c*s),this._mesh._normals[0].push(y,0,b)):(this._mesh._positions[0].push(f*s,-c*s,0),this._mesh._normals[0].push(y,b,0)),this._mesh._texCoords[0].push(.5,.5),d=0,u=0;d&lt;=a;d++,u+=g)m=Math.cos(u),_=Math.sin(u),p=s+i*m,this._vf.insideOutsideRadius?(this._mesh._positions[0].push(f*p,_*i,-c*p),this._mesh._normals[0].push(y,0,b)):(this._mesh._positions[0].push(f*p,-c*p,_*i),this._mesh._normals[0].push(y,b,0)),this._mesh._texCoords[0].push(1-.5*(1+m),.5*(1-_)),d&gt;0&amp;&amp;(this._mesh._indices[0].push(v),this._mesh._indices[0].push(v+d-1),this._mesh._indices[0].push(v+d)),d==a&amp;&amp;(this._mesh._indices[0].push(v),this._mesh._indices[0].push(v+d),this._mesh._indices[0].push(v+1))}this.invalidateVolume(),this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,Array.forEach(this._parentNodes,(function(e){e.setAllDirty(),e.invalidateVolume()}))}}})),x3dom.registerNodeType("Cone","Geometry3D",defineClass(x3dom.nodeTypes.X3DSpatialGeometryNode,(function(e){x3dom.nodeTypes.Cone.superClass.call(this,e),this.addField_SFFloat(e,"bottomRadius",1),this.addField_SFFloat(e,"topRadius",0),this.addField_SFFloat(e,"height",2),this.addField_SFBool(e,"bottom",!0),this.addField_SFBool(e,"side",!0),this.addField_SFBool(e,"top",!0),this.addField_SFFloat(e,"subdivision",32);var t="Cone_"+this._vf.bottomRadius+"_"+this._vf.height+"_"+this._vf.top+"_"+this._vf.bottom+"_"+this._vf.side+"_"+this._vf.topRadius+"_"+this._vf.subdivision;if(this._vf.useGeoCache&amp;&amp;void 0!==x3dom.geoCache[t])this._mesh=x3dom.geoCache[t];else{var i,s,r,o,n,a=this._vf.bottomRadius,h=this._vf.height,d=this._vf.topRadius,l=this._vf.subdivision,u=2*Math.PI/l,f=(a-d)/h,c=1/Math.sqrt(1+f*f),m=0,_=0;if(this._vf.side&amp;&amp;h&gt;0){var p=0,x=0;for(m=0,_=0;m&lt;=l;m++)i=m*u,s=Math.sin(i),r=-Math.cos(i),d&gt;x3dom.fields.Eps&amp;&amp;(p=s*d,x=r*d),this._mesh._positions[0].push(p,h/2,x),this._mesh._normals[0].push(s/c,f/c,r/c),this._mesh._texCoords[0].push(1-m/l,1),this._mesh._positions[0].push(s*a,-h/2,r*a),this._mesh._normals[0].push(s/c,f/c,r/c),this._mesh._texCoords[0].push(1-m/l,0),m&gt;0&amp;&amp;(this._mesh._indices[0].push(_),this._mesh._indices[0].push(_+2),this._mesh._indices[0].push(_+1),this._mesh._indices[0].push(_+1),this._mesh._indices[0].push(_+2),this._mesh._indices[0].push(_+3),_+=2)}if(this._vf.bottom&amp;&amp;a&gt;0){for(n=this._mesh._positions[0].length/3,m=l-1;m&gt;=0;m--)i=m*u,s=a*Math.sin(i),r=-a*Math.cos(i),this._mesh._positions[0].push(s,-h/2,r),this._mesh._normals[0].push(0,-1,0),this._mesh._texCoords[0].push(s/a/2+.5,r/a/2+.5);for(o=n+1,m=2;m&lt;l;m++)this._mesh._indices[0].push(o),this._mesh._indices[0].push(n),o=n+m,this._mesh._indices[0].push(o)}if(this._vf.top&amp;&amp;d&gt;x3dom.fields.Eps){for(n=this._mesh._positions[0].length/3,m=l-1;m&gt;=0;m--)i=m*u,s=d*Math.sin(i),r=-d*Math.cos(i),this._mesh._positions[0].push(s,h/2,r),this._mesh._normals[0].push(0,1,0),this._mesh._texCoords[0].push(s/d/2+.5,1-r/d/2+.5);for(o=n+1,m=2;m&lt;l;m++)this._mesh._indices[0].push(n),this._mesh._indices[0].push(o),o=n+m,this._mesh._indices[0].push(o)}this._mesh._invalidate=!0,this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,x3dom.geoCache[t]=this._mesh}}),{fieldChanged:function(e){if("bottomRadius"==e||"topRadius"==e||"height"==e||"subdivision"==e||"bottom"==e||"top"==e||"side"==e){this._mesh._positions[0]=[],this._mesh._indices[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[];var t,i,s,r,o,n=this._vf.bottomRadius,a=this._vf.height,h=this._vf.topRadius,d=this._vf.subdivision,l=2*Math.PI/d,u=(n-h)/a,f=1/Math.sqrt(1+u*u),c=0,m=0;if(this._vf.side&amp;&amp;a&gt;0){var _=0,p=0;for(c=0,m=0;c&lt;=d;c++)t=c*l,i=Math.sin(t),s=-Math.cos(t),h&gt;x3dom.fields.Eps&amp;&amp;(_=i*h,p=s*h),this._mesh._positions[0].push(_,a/2,p),this._mesh._normals[0].push(i/f,u/f,s/f),this._mesh._texCoords[0].push(1-c/d,1),this._mesh._positions[0].push(i*n,-a/2,s*n),this._mesh._normals[0].push(i/f,u/f,s/f),this._mesh._texCoords[0].push(1-c/d,0),c&gt;0&amp;&amp;(this._mesh._indices[0].push(m),this._mesh._indices[0].push(m+2),this._mesh._indices[0].push(m+1),this._mesh._indices[0].push(m+1),this._mesh._indices[0].push(m+2),this._mesh._indices[0].push(m+3),m+=2)}if(this._vf.bottom&amp;&amp;n&gt;0){for(o=this._mesh._positions[0].length/3,c=d-1;c&gt;=0;c--)t=c*l,i=n*Math.sin(t),s=-n*Math.cos(t),this._mesh._positions[0].push(i,-a/2,s),this._mesh._normals[0].push(0,-1,0),this._mesh._texCoords[0].push(i/n/2+.5,s/n/2+.5);for(r=o+1,c=2;c&lt;d;c++)this._mesh._indices[0].push(r),this._mesh._indices[0].push(o),r=o+c,this._mesh._indices[0].push(r)}if(this._vf.top&amp;&amp;h&gt;x3dom.fields.Eps){for(o=this._mesh._positions[0].length/3,c=d-1;c&gt;=0;c--)t=c*l,i=h*Math.sin(t),s=-h*Math.cos(t),this._mesh._positions[0].push(i,a/2,s),this._mesh._normals[0].push(0,1,0),this._mesh._texCoords[0].push(i/h/2+.5,1-s/h/2+.5);for(r=o+1,c=2;c&lt;d;c++)this._mesh._indices[0].push(o),this._mesh._indices[0].push(r),r=o+c,this._mesh._indices[0].push(r)}this.invalidateVolume(),this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,Array.forEach(this._parentNodes,(function(e){e.setAllDirty(),e.invalidateVolume()}))}}})),x3dom.registerNodeType("Cylinder","Geometry3D",defineClass(x3dom.nodeTypes.X3DSpatialGeometryNode,(function(e){x3dom.nodeTypes.Cylinder.superClass.call(this,e),this.addField_SFFloat(e,"radius",1),this.addField_SFFloat(e,"height",2),this.addField_SFBool(e,"bottom",!0),this.addField_SFBool(e,"top",!0),this.addField_SFFloat(e,"subdivision",32),this.addField_SFBool(e,"side",!0);var t=this._vf.subdivision,i="Cylinder_"+this._vf.radius+"_"+this._vf.height+"_"+this._vf.bottom+"_"+this._vf.top+"_"+this._vf.side+"_"+this._vf.subdivision;if(this._vf.useGeoCache&amp;&amp;void 0!==x3dom.geoCache[i])this._mesh=x3dom.geoCache[i];else{var s,r,o,n,a,h=this._vf.radius,d=this._vf.height/2,l=2*Math.PI/t;if(this._vf.side)for(n=0,a=0;n&lt;=t;n++)s=n*l,r=Math.sin(s),o=-Math.cos(s),this._mesh._positions[0].push(r*h,-d,o*h),this._mesh._normals[0].push(r,0,o),this._mesh._texCoords[0].push(1-n/t,0),this._mesh._positions[0].push(r*h,d,o*h),this._mesh._normals[0].push(r,0,o),this._mesh._texCoords[0].push(1-n/t,1),n&gt;0&amp;&amp;(this._mesh._indices[0].push(a),this._mesh._indices[0].push(a+1),this._mesh._indices[0].push(a+2),this._mesh._indices[0].push(a+2),this._mesh._indices[0].push(a+1),this._mesh._indices[0].push(a+3),a+=2);if(h&gt;0){var u,f=this._mesh._positions[0].length/3;if(this._vf.top){for(n=t-1;n&gt;=0;n--)s=n*l,r=h*Math.sin(s),o=-h*Math.cos(s),this._mesh._positions[0].push(r,d,o),this._mesh._normals[0].push(0,1,0),this._mesh._texCoords[0].push(r/h/2+.5,-o/h/2+.5);for(u=f+1,n=2;n&lt;t;n++)this._mesh._indices[0].push(f),this._mesh._indices[0].push(u),u=f+n,this._mesh._indices[0].push(u);f=this._mesh._positions[0].length/3}if(this._vf.bottom){for(n=t-1;n&gt;=0;n--)s=n*l,r=h*Math.sin(s),o=-h*Math.cos(s),this._mesh._positions[0].push(r,-d,o),this._mesh._normals[0].push(0,-1,0),this._mesh._texCoords[0].push(r/h/2+.5,o/h/2+.5);for(u=f+1,n=2;n&lt;t;n++)this._mesh._indices[0].push(u),this._mesh._indices[0].push(f),u=f+n,this._mesh._indices[0].push(u)}}this._mesh._invalidate=!0,this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,x3dom.geoCache[i]=this._mesh}}),{fieldChanged:function(e){if("radius"===e||"height"===e){this._mesh._positions[0]=[];var t=this._vf.radius,i=this._vf.height/2,s=this._vf.subdivision,r=2*Math.PI/s;if(this._vf.side)for(d=0;d&lt;=s;d++)n=d*r,a=Math.sin(n),h=-Math.cos(n),this._mesh._positions[0].push(a*t,-i,h*t),this._mesh._positions[0].push(a*t,i,h*t);if(t&gt;0){var o=this._mesh._positions[0].length/3;if(this._vf.top)for(d=s-1;d&gt;=0;d--)n=d*r,a=t*Math.sin(n),h=-t*Math.cos(n),this._mesh._positions[0].push(a,i,h)}if(this._vf.bottom)for(d=s-1;d&gt;=0;d--)n=d*r,a=t*Math.sin(n),h=-t*Math.cos(n),this._mesh._positions[0].push(a,-i,h);this.invalidateVolume(),this._mesh._numCoords=this._mesh._positions[0].length/3,Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e.invalidateVolume()}))}else if("subdivision"===e||"bottom"===e||"top"===e||"side"===e){this._mesh._positions[0]=[],this._mesh._indices[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[];t=this._vf.radius,i=this._vf.height/2,s=this._vf.subdivision,r=2*Math.PI/s;var n,a,h,d,l=0;if(this._vf.side)for(d=0,l=0;d&lt;=s;d++)n=d*r,a=Math.sin(n),h=-Math.cos(n),this._mesh._positions[0].push(a*t,-i,h*t),this._mesh._normals[0].push(a,0,h),this._mesh._texCoords[0].push(1-d/s,0),this._mesh._positions[0].push(a*t,i,h*t),this._mesh._normals[0].push(a,0,h),this._mesh._texCoords[0].push(1-d/s,1),d&gt;0&amp;&amp;(this._mesh._indices[0].push(l+0),this._mesh._indices[0].push(l+1),this._mesh._indices[0].push(l+2),this._mesh._indices[0].push(l+2),this._mesh._indices[0].push(l+1),this._mesh._indices[0].push(l+3),l+=2);if(t&gt;0){var u;o=this._mesh._positions[0].length/3;if(this._vf.top){for(d=s-1;d&gt;=0;d--)n=d*r,a=t*Math.sin(n),h=-t*Math.cos(n),this._mesh._positions[0].push(a,i,h),this._mesh._normals[0].push(0,1,0),this._mesh._texCoords[0].push(a/t/2+.5,-h/t/2+.5);for(u=o+1,d=2;d&lt;s;d++)this._mesh._indices[0].push(o),this._mesh._indices[0].push(u),u=o+d,this._mesh._indices[0].push(u);o=this._mesh._positions[0].length/3}if(this._vf.bottom){for(d=s-1;d&gt;=0;d--)n=d*r,a=t*Math.sin(n),h=-t*Math.cos(n),this._mesh._positions[0].push(a,-i,h),this._mesh._normals[0].push(0,-1,0),this._mesh._texCoords[0].push(a/t/2+.5,h/t/2+.5);for(u=o+1,d=2;d&lt;s;d++)this._mesh._indices[0].push(u),this._mesh._indices[0].push(o),u=o+d,this._mesh._indices[0].push(u)}}this.invalidateVolume(),this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,Array.forEach(this._parentNodes,(function(e){e.setAllDirty(),e.invalidateVolume()}))}}})),x3dom.registerNodeType("ExternalGeometry","Geometry3D",defineClass(x3dom.nodeTypes.X3DSpatialGeometryNode,(function(e){x3dom.nodeTypes.ExternalGeometry.superClass.call(this,e),this.addField_MFString(e,"url",[]),this._mesh._invalidate=!1,this._mesh._numCoords=0,this._mesh._numFaces=0,this._currentURLIdx=0}),{update:function(e,t,i,s,r){var o,n=this;0==this._vf.url.length||this._currentURLIdx&gt;=this._vf.url.length||x3dom.BinaryContainerLoader.outOfMemory||(e._webgl.internalDownloadCount=1,e._nameSpace.doc.downloadCount=1,(o=new XMLHttpRequest).open("GET",e._nameSpace.getURL(this._vf.url[this._currentURLIdx]),!0),o.responseType="arraybuffer",x3dom.RequestManager.addRequest(o),o.onerror=function(){x3dom.debug.logError('Unable to load SRC data from URL "'+n._vf.url[n._currentURLIdx]+'"')},o.onload=function(){if(e._webgl.internalDownloadCount=0,e._nameSpace.doc.downloadCount=0,e._webgl.primType=[],e._webgl.indexOffset=[],e._webgl.drawCount=[],200==o.status||0==o.status){var a=new x3dom.glTF.glTFLoader(o.response,!0);if(a.header.sceneLength&gt;0){a.loaded={},a.loaded.meshes={},a.loaded.meshCount=0;var h=n._vf.url[n._currentURLIdx];if(h.includes("#")){var d=h.split("#"),l=d[d.length-1];a.getMesh(e,t,i,l)}else a.getScene(e,t,i);for(var u in a._mesh)a._mesh.hasOwnProperty(u)&amp;&amp;(n._mesh[u]=a._mesh[u])}else n._currentURLIdx+1&lt;n._vf.url.length?(x3dom.debug.logWarning('Invalid SRC data, loaded from URL "'+n._vf.url[n._currentURLIdx]+'", trying next specified URL'),++n._currentURLIdx,n.update(e,t,i,s,r)):x3dom.debug.logError('Invalid SRC data, loaded from URL "'+n._vf.url[n._currentURLIdx]+'", no other URLs left to try.')}else n._currentURLIdx+1&lt;n._vf.url.length?(x3dom.debug.logWarning('Invalid SRC data, loaded from URL "'+n._vf.url[n._currentURLIdx]+'", trying next specified URL'),++n._currentURLIdx,n.update(e,t,i,s,r)):x3dom.debug.logError('Invalid SRC data, loaded from URL "'+n._vf.url[n._currentURLIdx]+'", no other URLs left to try.')})},getVolume:function(){var e,t=this._mesh._vol;return t.isValid()||"undefined"!=typeof(e=this._parentNodes[0])._vf.bboxCenter&amp;&amp;"undefined"!=typeof e._vf.bboxSize&amp;&amp;t.setBoundsByCenterSize(e._vf.bboxCenter,e._vf.bboxSize),t}})),x3dom.registerNodeType("X3DBinaryContainerGeometryNode","Geometry3D",defineClass(x3dom.nodeTypes.X3DSpatialGeometryNode,(function(e){x3dom.nodeTypes.X3DBinaryContainerGeometryNode.superClass.call(this,e),this.addField_SFVec3f(e,"position",0,0,0),this.addField_SFVec3f(e,"size",1,1,1),this.addField_MFInt32(e,"vertexCount",[0]),this.addField_MFString(e,"primType",["TRIANGLES"]),this._mesh._invalidate=!1,this._mesh._numCoords=0,this._mesh._numFaces=0,this._diameter=this._vf.size.length()}),{getMin:function(){var e=this._mesh._vol;return e.isValid()||e.setBoundsByCenterSize(this._vf.position,this._vf.size),e.min},getMax:function(){var e=this._mesh._vol;return e.isValid()||e.setBoundsByCenterSize(this._vf.position,this._vf.size),e.max},getVolume:function(){var e=this._mesh._vol;return e.isValid()||e.setBoundsByCenterSize(this._vf.position,this._vf.size),e},invalidateVolume:function(){},getCenter:function(){return this._vf.position},getDiameter:function(){return this._diameter},needLighting:function(){var e=this._vf.primType.length&amp;&amp;this._vf.primType[0].indexOf("TRIANGLE")&gt;=0;return this._vf.lit&amp;&amp;e}})),x3dom.registerNodeType("BinaryGeometry","Geometry3D",defineClass(x3dom.nodeTypes.X3DBinaryContainerGeometryNode,(function(e){x3dom.nodeTypes.BinaryGeometry.superClass.call(this,e),this.addField_SFString(e,"index",""),this.addField_SFString(e,"coord",""),this.addField_SFString(e,"normal",""),this.addField_SFString(e,"texCoord",""),this.addField_SFString(e,"color",""),this.addField_SFString(e,"tangent",""),this.addField_SFString(e,"binormal",""),this.addField_SFString(e,"indexType","Uint16"),this.addField_SFString(e,"coordType","Float32"),this.addField_SFString(e,"normalType","Float32"),this.addField_SFString(e,"texCoordType","Float32"),this.addField_SFString(e,"colorType","Float32"),this.addField_SFString(e,"tangentType","Float32"),this.addField_SFString(e,"binormalType","Float32"),this.addField_SFBool(e,"normalAsSphericalCoordinates",!1),this.addField_SFBool(e,"rgbaColors",!1),this.addField_SFInt32(e,"numTexCoordComponents",2),this.addField_SFBool(e,"normalPerVertex",!0),this.addField_SFBool(e,"idsPerVertex",!1),this.addField_SFBool(e,"compressed",!1),this._hasStrideOffset=!1,this._mesh._numPosComponents=this._vf.normalAsSphericalCoordinates?4:3,this._mesh._numTexComponents=this._vf.numTexCoordComponents,this._mesh._numColComponents=this._vf.rgbaColors?4:3,this._mesh._numNormComponents=this._vf.normalAsSphericalCoordinates?2:3,this._vertexCountSum=0;for(var t=0;t&lt;this._vf.vertexCount.length;++t)this._vertexCountSum+=this._vf.vertexCount[t]}),{parentAdded:function(e){var t,i,s,r;t=this._vf.coord.lastIndexOf("#"),i=this._vf.coord.lastIndexOf("+"),t&gt;=0&amp;&amp;i&gt;=0?(s=+this._vf.coord.substring(++t,i),r=+this._vf.coord.substring(i),e._coordStrideOffset=[r,s],this._hasStrideOffset=!0,s/8-Math.floor(s/8)==0&amp;&amp;(this._mesh._numPosComponents=4)):i&gt;=0&amp;&amp;(r=+this._vf.coord.substring(i),e._coordStrideOffset=[r,0],r/8-Math.floor(r/8)==0&amp;&amp;(this._mesh._numPosComponents=4)),t=this._vf.normal.lastIndexOf("#"),i=this._vf.normal.lastIndexOf("+"),t&gt;=0&amp;&amp;i&gt;=0?(s=+this._vf.normal.substring(++t,i),r=+this._vf.normal.substring(i),e._normalStrideOffset=[r,s]):i&gt;=0&amp;&amp;(r=+this._vf.normal.substring(i),e._normalStrideOffset=[r,0]),t=this._vf.texCoord.lastIndexOf("#"),i=this._vf.texCoord.lastIndexOf("+"),t&gt;=0&amp;&amp;i&gt;=0?(s=+this._vf.texCoord.substring(++t,i),r=+this._vf.texCoord.substring(i),e._texCoordStrideOffset=[r,s]):i&gt;=0&amp;&amp;(r=+this._vf.texCoord.substring(i),e._texCoordStrideOffset=[r,0]),t=this._vf.color.lastIndexOf("#"),i=this._vf.color.lastIndexOf("+"),t&gt;=0&amp;&amp;i&gt;=0?(s=+this._vf.color.substring(++t,i),r=+this._vf.color.substring(i),e._colorStrideOffset=[r,s]):i&gt;=0&amp;&amp;(r=+this._vf.color.substring(i),e._colorStrideOffset=[r,0]),"Uint16"==this._vf.indexType||x3dom.caps.INDEX_UINT||x3dom.debug.logWarning("Index type "+this._vf.indexType+" problematic")},doIntersect:function(e){var t=this.getMin(),i=this.getMax();return!!(e.intersect(t,i)&amp;&amp;e.enter&lt;e.dist)&amp;&amp;(e.dist=e.enter,e.hitObject=this,e.hitPoint=e.pos.add(e.dir.multiply(e.enter)),!0)},getPrecisionMax:function(e){switch(this._vf[e]){case"Int8":return 127;case"Uint8":return 255;case"Int16":return 32767;case"Uint16":return 65535;case"Int32":return 2147483647;case"Uint32":return 4294967295;case"Float32":case"Float64":default:return 1}}})),x3dom.registerNodeType("PopGeometryLevel","Geometry3D",defineClass(x3dom.nodeTypes.X3DGeometricPropertyNode,(function(e){x3dom.nodeTypes.PopGeometryLevel.superClass.call(this,e),this.addField_SFString(e,"src",""),this.addField_SFInt32(e,"numIndices",0),this.addField_SFInt32(e,"vertexDataBufferOffset",0)}),{getSrc:function(){return this._vf.src},getNumIndices:function(){return this._vf.numIndices},getVertexDataBufferOffset:function(){return this._vf.vertexDataBufferOffset}})),x3dom.registerNodeType("PopGeometry","Geometry3D",defineClass(x3dom.nodeTypes.X3DBinaryContainerGeometryNode,(function(e){x3dom.nodeTypes.PopGeometry.superClass.call(this,e),this.addField_SFVec3f(e,"tightSize",1,1,1),this.addField_SFVec3f(e,"maxBBSize",1,1,1),this.addField_SFVec3f(e,"bbMinModF",0,0,0),this.addField_SFVec3f(e,"bbMaxModF",1,1,1),this.addField_SFVec3f(e,"bbMin",0,0,0),this.addField_SFVec3f(e,"bbShiftVec",0,0,0),this._vf.bbMinModF.x&gt;this._vf.bbMaxModF.x&amp;&amp;(this._vf.bbShiftVec.x=1),this._vf.bbMinModF.y&gt;this._vf.bbMaxModF.y&amp;&amp;(this._vf.bbShiftVec.y=1),this._vf.bbMinModF.z&gt;this._vf.bbMaxModF.z&amp;&amp;(this._vf.bbShiftVec.z=1),this.addField_MFNode("levels",x3dom.nodeTypes.PopGeometryLevel),this.addField_SFInt32(e,"attributeStride",0),this.addField_SFInt32(e,"positionOffset",0),this.addField_SFInt32(e,"normalOffset",0),this.addField_SFInt32(e,"texcoordOffset",0),this.addField_SFInt32(e,"colorOffset",0),this.addField_SFInt32(e,"numAnchorVertices",0),this.addField_SFInt32(e,"positionPrecision",2),this.addField_SFInt32(e,"normalPrecision",1),this.addField_SFInt32(e,"texcoordPrecision",2),this.addField_SFInt32(e,"colorPrecision",1),this.addField_SFInt32(e,"minPrecisionLevel",-1),this.addField_SFInt32(e,"maxPrecisionLevel",-1),this.addField_SFFloat(e,"precisionFactor",1),this.addField_SFString(e,"coordType","Uint16"),this.addField_SFString(e,"normalType","Uint8"),this.addField_SFString(e,"texCoordType","Uint16"),this.addField_SFString(e,"colorType","Uint8"),this.addField_SFInt32(e,"vertexBufferSize",0),this.addField_SFBool(e,"indexedRendering",!0),this.addField_SFBool(e,"sphericalNormals",!1),this.addField_MFInt32(e,"originalVertexCount",[0]);for(var t=0;t&lt;this._vf.vertexCount.length;++t)this._vf.originalVertexCount[t]=this._vf.vertexCount[t];this._vf.maxBBSize=x3dom.fields.SFVec3f.copy(this._vf.size),this._vf.size=this._vf.tightSize,this._diameter=this._vf.size.length(),this._bbMinBySize=[Math.floor(this._vf.bbMin.x/this._vf.maxBBSize.x),Math.floor(this._vf.bbMin.y/this._vf.maxBBSize.y),Math.floor(this._vf.bbMin.z/this._vf.maxBBSize.z)],this._volRadius=this._vf.size.length()/2,this._volLargestRadius=this._vf.maxBBSize.length()/2,this._mesh._numPosComponents=this._vf.sphericalNormals?4:3,this._mesh._numNormComponents=this._vf.sphericalNormals?2:3,this._mesh._numTexComponents=2,this._mesh._numColComponents=3,x3dom.nodeTypes.PopGeometry.numTotalVerts+=this.getVertexCount(),x3dom.nodeTypes.PopGeometry.numTotalTris+=(this.hasIndex()?this.getTotalNumberOfIndices():this.getVertexCount())/3}),{forceUpdateCoverage:function(){return!0},getBBoxShiftVec:function(){return this._vf.bbShiftVec},getBBoxSize:function(){return this._vf.size},hasIndex:function(){return this._vf.indexedRendering},getTotalNumberOfIndices:function(){if(this._vf.indexedRendering){for(var e=0,t=0;t&lt;this._vf.originalVertexCount.length;++t)e+=this._vf.originalVertexCount[t];return e}return 0},getVertexCount:function(){for(var e=0,t=0;t&lt;this._vf.originalVertexCount.length;++t)e+=this._vf.originalVertexCount[t];return e},adaptVertexCount:function(e){for(var t=0,i=0;i&lt;this._vf.originalVertexCount.length;++i){if(!(this._vf.originalVertexCount[i]+t&lt;=e)){this._vf.vertexCount[i]=e-t;break}this._vf.vertexCount[i]=this._vf.originalVertexCount[i],t+=this._vf.originalVertexCount[i]}},hasNormal:function(){return 0!=this._vf.normalOffset&amp;&amp;!this._vf.sphericalNormals},hasTexCoord:function(){return 0!=this._vf.texcoordOffset},hasColor:function(){return 0!=this._vf.colorOffset},getPositionPrecision:function(){return this._vf.positionPrecision},getNormalPrecision:function(){return this._vf.normalPrecision},getTexCoordPrecision:function(){return this._vf.texcoordPrecision},getColorPrecision:function(){return this._vf.colorPrecision},getAttributeStride:function(){return this._vf.attributeStride},getPositionOffset:function(){return this._vf.positionOffset},getNormalOffset:function(){return this._vf.normalOffset},getTexCoordOffset:function(){return this._vf.texcoordOffset},getColorOffset:function(){return this._vf.colorOffset},getBufferTypeStringFromByteCount:function(e){switch(e){case 1:return"Uint8";case 2:return"Uint16";default:return 0}},getDataURLs:function(){for(var e=[],t=0;t&lt;this._cf.levels.nodes.length;++t)e.push(this._cf.levels.nodes[t].getSrc());return e},getNumIndicesByLevel:function(e){return this._cf.levels.nodes[e].getNumIndices()},getNumLevels:function(e){return this._cf.levels.nodes.length},getVertexDataBufferOffset:function(e){return this._cf.levels.nodes[e].getVertexDataBufferOffset()},getPrecisionMax:function(e){switch(this._vf[e]){case"Uint8":return 255;case"Uint16":return 65535;default:return 1}}})),x3dom.nodeTypes.PopGeometry.ErrorToleranceFactor=1,x3dom.nodeTypes.PopGeometry.PrecisionFactorOnMove=1,x3dom.nodeTypes.PopGeometry.numRenderedVerts=0,x3dom.nodeTypes.PopGeometry.numRenderedTris=0,x3dom.nodeTypes.PopGeometry.numTotalVerts=0,x3dom.nodeTypes.PopGeometry.numTotalTris=0,x3dom.nodeTypes.PopGeometry.powLUT=[32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1],x3dom.registerNodeType("ImageGeometry","Geometry3D",defineClass(x3dom.nodeTypes.X3DBinaryContainerGeometryNode,(function(e){if(x3dom.nodeTypes.ImageGeometry.superClass.call(this,e),this.addField_SFVec2f(e,"implicitMeshSize",256,256),this.addField_SFInt32(e,"numColorComponents",3),this.addField_SFInt32(e,"numTexCoordComponents",2),this.addField_SFNode("index",x3dom.nodeTypes.X3DTextureNode),this.addField_MFNode("coord",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("normal",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("texCoord",x3dom.nodeTypes.X3DTextureNode),this.addField_SFNode("color",x3dom.nodeTypes.X3DTextureNode),this._mesh._numColComponents=this._vf.numColorComponents,this._mesh._numTexComponents=this._vf.numTexCoordComponents,0==this._vf.implicitMeshSize.y&amp;&amp;(this._vf.implicitMeshSize.y=this._vf.implicitMeshSize.x),"webgl"==x3dom.caps.BACKEND&amp;&amp;x3dom.caps.MAX_VERTEX_TEXTURE_IMAGE_UNITS&gt;0){var t="ImageGeometry_"+this._vf.implicitMeshSize.x+"_"+this._vf.implicitMeshSize.y;if(this._vf.useGeoCache&amp;&amp;void 0!==x3dom.geoCache[t])this._mesh=x3dom.geoCache[t];else{for(var i=0;i&lt;this._vf.implicitMeshSize.y;i++)for(var s=0;s&lt;this._vf.implicitMeshSize.x;s++)this._mesh._positions[0].push(s/this._vf.implicitMeshSize.x,i/this._vf.implicitMeshSize.y,0);this._mesh._numFaces=this._mesh._indices[0].length/3,this._mesh._numCoords=this._mesh._positions[0].length/3,x3dom.geoCache[t]=this._mesh}}this._vol=new x3dom.fields.BoxVolume,this._dirty={coord:!0,normal:!0,texCoord:!0,color:!0,index:!0}}),{setGeoDirty:function(){this._dirty.coord=!0,this._dirty.normal=!0,this._dirty.texCoords=!0,this._dirty.color=!0,this._dirty.index=!0},unsetGeoDirty:function(){this._dirty.coord=!1,this._dirty.normal=!1,this._dirty.texCoords=!1,this._dirty.color=!1,this._dirty.index=!1},nodeChanged:function(){Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,e._dirty.normals=!0,e._dirty.texcoords=!0,e._dirty.colors=!0})),this._vol.invalidate()},fieldChanged:function(e){"index"==e||"coord"==e||"normal"==e||"texCoord"==e||"color"==e?(this._dirty[e]=!0,this._vol.invalidate()):"implicitMeshSize"==e&amp;&amp;this._vol.invalidate()},getMin:function(){var e=this._vol;return e.isValid()||e.setBoundsByCenterSize(this._vf.position,this._vf.size),e.min},getMax:function(){var e=this._vol;return e.isValid()||e.setBoundsByCenterSize(this._vf.position,this._vf.size),e.max},getVolume:function(){var e=this._vol;return e.isValid()||e.setBoundsByCenterSize(this._vf.position,this._vf.size),e},numCoordinateTextures:function(){return this._cf.coord.nodes.length},getIndexTexture:function(){return this._cf.index.node?(this._cf.index.node._type="IG_index",this._cf.index.node):null},getIndexTextureURL:function(){return this._cf.index.node?this._cf.index.node._vf.url:null},getCoordinateTexture:function(e){return this._cf.coord.nodes[e]?(this._cf.coord.nodes[e]._type="IG_coords"+e,this._cf.coord.nodes[e]):null},getCoordinateTextureURL:function(e){return this._cf.coord.nodes[e]?this._cf.coord.nodes[e]._vf.url:null},getCoordinateTextureURLs:function(){for(var e=[],t=0;t&lt;this._cf.coord.nodes.length;t++)e.push(this._cf.coord.nodes[t]._vf.url);return e},getNormalTexture:function(){return this._cf.normal.node?(this._cf.normal.node._type="IG_normals",this._cf.normal.node):null},getNormalTextureURL:function(){return this._cf.normal.node?this._cf.normal.node._vf.url:null},getTexCoordTexture:function(){return this._cf.texCoord.node?(this._cf.texCoord.node._type="IG_texCoords",this._cf.texCoord.node):null},getTexCoordTextureURL:function(){return this._cf.texCoord.node?this._cf.texCoord.node._vf.url:null},getColorTexture:function(){return this._cf.color.node?(this._cf.color.node._type="IG_colors",this._cf.color.node):null},getColorTextureURL:function(){return this._cf.color.node?this._cf.color.node._vf.url:null},getTextures:function(){var e=[],t=this.getIndexTexture();for(t&amp;&amp;e.push(t),i=0;i&lt;this.numCoordinateTextures();i++){var s=this.getCoordinateTexture(i);s&amp;&amp;e.push(s)}var r=this.getNormalTexture();r&amp;&amp;e.push(r);var o=this.getTexCoordTexture();o&amp;&amp;e.push(o);var n=this.getColorTexture();return n&amp;&amp;e.push(n),e}})),x3dom.registerNodeType("IndexedFaceSet","Geometry3D",defineClass(x3dom.nodeTypes.X3DComposedGeometryNode,(function(e){x3dom.nodeTypes.IndexedFaceSet.superClass.call(this,e),this.addField_SFFloat(e,"creaseAngle",0),this.addField_SFBool(e,"convex",!0),this.addField_MFInt32(e,"coordIndex",[]),this.addField_MFInt32(e,"normalIndex",[]),this.addField_MFInt32(e,"colorIndex",[]),this.addField_MFInt32(e,"texCoordIndex",[])}),{nodeChanged:function(){(new Date).getTime();this.handleAttribs();var e=this._vf.coordIndex;e.length&amp;&amp;-1!=e[e.length-1]&amp;&amp;e.push(-1);var t,i,s,r,o=this._vf.normalIndex,n=this._vf.texCoordIndex,a=this._vf.colorIndex,h=!1,d=!1,l=!1,u=!1,f=!1,c=!1,m=this._vf.colorPerVertex,_=this._vf.normalPerVertex;o.length&gt;0&amp;&amp;(d=!0),n.length&gt;0&amp;&amp;(u=!0),a.length&gt;0&amp;&amp;(c=!0);var p=this._cf.coord.node;x3dom.debug.assert(p),t=p.getPoints();var x=this._cf.normal.node;x?(h=!0,i=x._vf.vector):h=!1;var g="",v=2,y=this._cf.texCoord.node;x3dom.isa(y,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;y._cf.texCoord.nodes.length&amp;&amp;(y=y._cf.texCoord.nodes[0]),y?y._vf.point?(l=!0,s=y._vf.point,x3dom.isa(y,x3dom.nodeTypes.TextureCoordinate3D)&amp;&amp;(v=3)):y._vf.mode&amp;&amp;(g=y._vf.mode):l=!1,this._mesh._numTexComponents=v;var b,T,S,w,M,E,F,C,A,R,I,N,P,D,V,L,O,k=3,B=this._cf.color.node;if(B?(f=!0,r=B._vf.color,x3dom.isa(B,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(k=4)):f=!1,this._mesh._numColComponents=k,this._mesh._indices[0]=[],this._mesh._positions[0]=[],this._mesh._normals[0]=[],this._mesh._texCoords[0]=[],this._mesh._colors[0]=[],this._vf.creaseAngle&lt;=x3dom.fields.Eps||t.length&gt;x3dom.Utils.maxIndexableCoords||h&amp;&amp;d||l&amp;&amp;u||f&amp;&amp;c){if(this._vf.creaseAngle&lt;=x3dom.fields.Eps&amp;&amp;x3dom.debug.logWarning("Fallback to inefficient multi-index mode since creaseAngle=0."),this._vf.convex)for(S=0,w=0,M=0,this._mesh._multiIndIndices=[],this._mesh._posSize=t.length,b=0;b&lt;e.length;++b)if(-1!=e[b])switch(d&amp;&amp;x3dom.debug.assert(-1!=o[b]),u&amp;&amp;x3dom.debug.assert(-1!=n[b]),c&amp;&amp;x3dom.debug.assert(-1!=a[b]),S){case 0:E=+e[b],A=d&amp;&amp;_?+o[b]:d&amp;&amp;!_?+o[M]:_?E:M,N=u?+n[b]:E,V=c&amp;&amp;m?+a[b]:c&amp;&amp;!m?+a[M]:m?E:M,S=1;break;case 1:F=+e[b],R=d&amp;&amp;_?+o[b]:d&amp;&amp;!_?+o[M]:_?F:M,P=u?+n[b]:F,L=c&amp;&amp;m?+a[b]:c&amp;&amp;!m?+a[M]:m?F:M,S=2;break;case 2:C=+e[b],I=d&amp;&amp;_?+o[b]:d&amp;&amp;!_?+o[M]:_?C:M,D=u?+n[b]:C,O=c&amp;&amp;m?+a[b]:c&amp;&amp;!m?+a[M]:m?C:M,S=3,this._mesh._positions[0].push(t[E].x),this._mesh._positions[0].push(t[E].y),this._mesh._positions[0].push(t[E].z),this._mesh._positions[0].push(t[F].x),this._mesh._positions[0].push(t[F].y),this._mesh._positions[0].push(t[F].z),this._mesh._positions[0].push(t[C].x),this._mesh._positions[0].push(t[C].y),this._mesh._positions[0].push(t[C].z),h&amp;&amp;(this._mesh._normals[0].push(i[A].x),this._mesh._normals[0].push(i[A].y),this._mesh._normals[0].push(i[A].z),this._mesh._normals[0].push(i[R].x),this._mesh._normals[0].push(i[R].y),this._mesh._normals[0].push(i[R].z),this._mesh._normals[0].push(i[I].x),this._mesh._normals[0].push(i[I].y),this._mesh._normals[0].push(i[I].z)),this._mesh._multiIndIndices.push(E,F,C),f&amp;&amp;(this._mesh._colors[0].push(r[V].r),this._mesh._colors[0].push(r[V].g),this._mesh._colors[0].push(r[V].b),4===k&amp;&amp;this._mesh._colors[0].push(r[V].a),this._mesh._colors[0].push(r[L].r),this._mesh._colors[0].push(r[L].g),this._mesh._colors[0].push(r[L].b),4===k&amp;&amp;this._mesh._colors[0].push(r[L].a),this._mesh._colors[0].push(r[O].r),this._mesh._colors[0].push(r[O].g),this._mesh._colors[0].push(r[O].b),4===k&amp;&amp;this._mesh._colors[0].push(r[O].a)),l&amp;&amp;(this._mesh._texCoords[0].push(s[N].x),this._mesh._texCoords[0].push(s[N].y),3===v&amp;&amp;this._mesh._texCoords[0].push(s[N].z),this._mesh._texCoords[0].push(s[P].x),this._mesh._texCoords[0].push(s[P].y),3===v&amp;&amp;this._mesh._texCoords[0].push(s[P].z),this._mesh._texCoords[0].push(s[D].x),this._mesh._texCoords[0].push(s[D].y),3===v&amp;&amp;this._mesh._texCoords[0].push(s[D].z));break;case 3:F=C,P=D,_&amp;&amp;(R=I),m&amp;&amp;(L=O),C=+e[b],d&amp;&amp;_?I=+o[b]:d&amp;&amp;!_||(I=_?C:M),D=u?+n[b]:C,c&amp;&amp;m?O=+a[b]:c&amp;&amp;!m||(O=m?C:M),this._mesh._positions[0].push(t[E].x),this._mesh._positions[0].push(t[E].y),this._mesh._positions[0].push(t[E].z),this._mesh._positions[0].push(t[F].x),this._mesh._positions[0].push(t[F].y),this._mesh._positions[0].push(t[F].z),this._mesh._positions[0].push(t[C].x),this._mesh._positions[0].push(t[C].y),this._mesh._positions[0].push(t[C].z),h&amp;&amp;(this._mesh._normals[0].push(i[A].x),this._mesh._normals[0].push(i[A].y),this._mesh._normals[0].push(i[A].z),this._mesh._normals[0].push(i[R].x),this._mesh._normals[0].push(i[R].y),this._mesh._normals[0].push(i[R].z),this._mesh._normals[0].push(i[I].x),this._mesh._normals[0].push(i[I].y),this._mesh._normals[0].push(i[I].z)),this._mesh._multiIndIndices.push(E,F,C),f&amp;&amp;(this._mesh._colors[0].push(r[V].r),this._mesh._colors[0].push(r[V].g),this._mesh._colors[0].push(r[V].b),4===k&amp;&amp;this._mesh._colors[0].push(r[V].a),this._mesh._colors[0].push(r[L].r),this._mesh._colors[0].push(r[L].g),this._mesh._colors[0].push(r[L].b),4===k&amp;&amp;this._mesh._colors[0].push(r[L].a),this._mesh._colors[0].push(r[O].r),this._mesh._colors[0].push(r[O].g),this._mesh._colors[0].push(r[O].b),4===k&amp;&amp;this._mesh._colors[0].push(r[O].a)),l&amp;&amp;(this._mesh._texCoords[0].push(s[N].x),this._mesh._texCoords[0].push(s[N].y),3===v&amp;&amp;this._mesh._texCoords[0].push(s[N].z),this._mesh._texCoords[0].push(s[P].x),this._mesh._texCoords[0].push(s[P].y),3===v&amp;&amp;this._mesh._texCoords[0].push(s[P].z),this._mesh._texCoords[0].push(s[D].x),this._mesh._texCoords[0].push(s[D].y),3===v&amp;&amp;this._mesh._texCoords[0].push(s[D].z))}else S=0,M++;else{var U=new x3dom.DoublyLinkedList,z={};for(w=0,M=0,b=0;b&lt;e.length;++b)if(-1!=e[b])h&amp;&amp;(z.normals=d&amp;&amp;_?i[o[b]]:d&amp;&amp;!_?i[o[M]]:i[e[b]]),f&amp;&amp;(z.colors=c&amp;&amp;m?r[a[b]]:c&amp;&amp;!m?r[a[M]]:m?r[e[b]]:r[M]),l&amp;&amp;(z.texCoords=u?s[n[b]]:s[e[b]]),U.appendNode(new x3dom.DoublyLinkedList.ListNode(t[e[b]],e[b],z.normals,z.colors,z.texCoords));else{var G=x3dom.EarClipping.getMultiIndexes(U);for(T=0;T&lt;G.indices.length;T++)this._mesh._indices[0].push(w),w++,this._mesh._positions[0].push(G.point[T].x,G.point[T].y,G.point[T].z),h&amp;&amp;this._mesh._normals[0].push(G.normals[T].x,G.normals[T].y,G.normals[T].z),f&amp;&amp;(this._mesh._colors[0].push(G.colors[T].r,G.colors[T].g,G.colors[T].b),4===k&amp;&amp;this._mesh._colors[0].push(G.colors[T].a)),l&amp;&amp;(this._mesh._texCoords[0].push(G.texCoords[T].x,G.texCoords[T].y),3===v&amp;&amp;this._mesh._texCoords[0].push(G.texCoords[T].z));U=new x3dom.DoublyLinkedList,M++}this._mesh.splitMesh()}h||this._mesh.calcNormals(this._vf.creaseAngle,this._vf.ccw),l||this._mesh.calcTexCoords(g)}else{if(S=0,this._vf.convex)for(b=0;b&lt;e.length;++b)if(-1!=e[b])switch(S){case 0:A=+e[b],S=1;break;case 1:R=+e[b],S=2;break;case 2:I=+e[b],S=3,this._mesh._indices[0].push(A,R,I);break;case 3:R=I,I=+e[b],this._mesh._indices[0].push(A,R,I)}else S=0;else for(U=new x3dom.DoublyLinkedList,b=0;b&lt;e.length;++b)if(-1!=e[b])U.appendNode(new x3dom.DoublyLinkedList.ListNode(t[e[b]],e[b]));else{var X=x3dom.EarClipping.getIndexes(U);for(T=0;T&lt;X.length;T++)this._mesh._indices[0].push(X[T]);U=new x3dom.DoublyLinkedList}this._mesh._positions[0]=t.toGL(),h?this._mesh._normals[0]=i.toGL():this._mesh.calcNormals(this._vf.creaseAngle,this._vf.ccw),l?(this._mesh._texCoords[0]=s.toGL(),this._mesh._numTexComponents=v):this._mesh.calcTexCoords(g),f&amp;&amp;(this._mesh._colors[0]=r.toGL(),this._mesh._numColComponents=k)}for(this.invalidateVolume(),this._mesh._numFaces=0,this._mesh._numCoords=0,b=0;b&lt;this._mesh._positions.length;b++){var j=this._mesh._indices[b].length,H=this._mesh._positions[b].length/3;this._mesh._numCoords+=H,this._mesh._numFaces+=j&gt;0?j/3:H/3}},fieldChanged:function(e){if("coord"==e||"normal"==e||"texCoord"==e||"color"==e||"coordIndex"==e){var t=this._cf.coord.node._vf.point,i=t.length,s=this._cf.texCoord.node;if(x3dom.isa(s,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;s._cf.texCoord.nodes.length&amp;&amp;(s=s._cf.texCoord.nodes[0]),(this._vf.creaseAngle&lt;=x3dom.fields.Eps||i&gt;x3dom.Utils.maxIndexableCoords||this._vf.normalIndex.length&gt;0&amp;&amp;this._cf.normal.node||this._vf.texCoordIndex.length&gt;0&amp;&amp;s||this._vf.colorIndex.length&gt;0&amp;&amp;this._cf.color.node)&amp;&amp;this._mesh._multiIndIndices){var r=!this._cf.normal.node&amp;&amp;"none"!=this._vf.normalUpdateMode.toLowerCase();if(i=this._mesh._multiIndIndices.length,this._mesh._positions[0]=[],this._mesh._indices[0]=[],"coord"==e&amp;&amp;i){for(r&amp;&amp;(this._mesh._normals[0]=[]),D=0;D&lt;i;D+=3){var o=this._mesh._multiIndIndices[D],n=this._mesh._multiIndIndices[D+1],a=this._mesh._multiIndIndices[D+2],h=t[o],d=t[n],l=t[a];if(this._mesh._positions[0].push(h.x,h.y,h.z),this._mesh._positions[0].push(d.x,d.y,d.z),this._mesh._positions[0].push(l.x,l.y,l.z),r){var u=h.subtract(d),f=d.subtract(l),c=u.cross(f).normalize();this._vf.ccw||(c=c.negate()),this._mesh._normals[0].push(c.x,c.y,c.z),this._mesh._normals[0].push(c.x,c.y,c.z),this._mesh._normals[0].push(c.x,c.y,c.z)}}return this.invalidateVolume(),void Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,r&amp;&amp;(e._dirty.normals=!0)}))}this._mesh._normals[0]=[],this._mesh._texCoords[0]=[],this._mesh._colors[0]=[];var m,_,p,x,g=this._vf.coordIndex,v=this._vf.normalIndex,y=this._vf.texCoordIndex,b=this._vf.colorIndex,T=!1,S=!1,w=!1,M=!1,E=!1,F=!1,C=this._vf.colorPerVertex,A=this._vf.normalPerVertex;v.length&gt;0&amp;&amp;(S=!0),y.length&gt;0&amp;&amp;(M=!0),b.length&gt;0&amp;&amp;(F=!0);var R=this._cf.coord.node;x3dom.debug.assert(R),m=R.getPoints();var I=this._cf.normal.node;I?(T=!0,_=I._vf.vector):T=!1;var N="",P=2;s=this._cf.texCoord.node,x3dom.isa(s,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;s._cf.texCoord.nodes.length&amp;&amp;(s=s._cf.texCoord.nodes[0]),s?s._vf.point?(w=!0,p=s._vf.point,x3dom.isa(s,x3dom.nodeTypes.TextureCoordinate3D)&amp;&amp;(P=3)):s._vf.mode&amp;&amp;(N=s._vf.mode):w=!1,this._mesh._numTexComponents=P;var D,V,L,O,k,B,U,z,G,X,j,H,W,q,Y,Z,Q,K=3,$=this._cf.color.node;if($?(E=!0,x=$._vf.color,x3dom.isa($,x3dom.nodeTypes.ColorRGBA)&amp;&amp;(K=4)):E=!1,this._mesh._numColComponents=K,this._vf.convex)for(L=0,O=0,k=0,this._mesh._multiIndIndices=[],this._mesh._posSize=m.length,D=0;D&lt;g.length;++D)if(-1!=g[D])switch(S&amp;&amp;x3dom.debug.assert(-1!=v[D]),M&amp;&amp;x3dom.debug.assert(-1!=y[D]),F&amp;&amp;x3dom.debug.assert(-1!=b[D]),L){case 0:B=+g[D],G=S&amp;&amp;A?+v[D]:S&amp;&amp;!A?+v[k]:A?B:k,H=M?+y[D]:B,Y=F&amp;&amp;C?+b[D]:F&amp;&amp;!C?+b[k]:C?B:k,L=1;break;case 1:U=+g[D],X=S&amp;&amp;A?+v[D]:S&amp;&amp;!A?+v[k]:A?U:k,W=M?+y[D]:U,Z=F&amp;&amp;C?+b[D]:F&amp;&amp;!C?+b[k]:C?U:k,L=2;break;case 2:z=+g[D],j=S&amp;&amp;A?+v[D]:S&amp;&amp;!A?+v[k]:A?z:k,q=M?+y[D]:z,Q=F&amp;&amp;C?+b[D]:F&amp;&amp;!C?+b[k]:C?z:k,L=3,this._mesh._positions[0].push(m[B].x),this._mesh._positions[0].push(m[B].y),this._mesh._positions[0].push(m[B].z),this._mesh._positions[0].push(m[U].x),this._mesh._positions[0].push(m[U].y),this._mesh._positions[0].push(m[U].z),this._mesh._positions[0].push(m[z].x),this._mesh._positions[0].push(m[z].y),this._mesh._positions[0].push(m[z].z),T&amp;&amp;(this._mesh._normals[0].push(_[G].x),this._mesh._normals[0].push(_[G].y),this._mesh._normals[0].push(_[G].z),this._mesh._normals[0].push(_[X].x),this._mesh._normals[0].push(_[X].y),this._mesh._normals[0].push(_[X].z),this._mesh._normals[0].push(_[j].x),this._mesh._normals[0].push(_[j].y),this._mesh._normals[0].push(_[j].z)),this._mesh._multiIndIndices.push(B,U,z),E&amp;&amp;(this._mesh._colors[0].push(x[Y].r),this._mesh._colors[0].push(x[Y].g),this._mesh._colors[0].push(x[Y].b),4===K&amp;&amp;this._mesh._colors[0].push(x[Y].a),this._mesh._colors[0].push(x[Z].r),this._mesh._colors[0].push(x[Z].g),this._mesh._colors[0].push(x[Z].b),4===K&amp;&amp;this._mesh._colors[0].push(x[Z].a),this._mesh._colors[0].push(x[Q].r),this._mesh._colors[0].push(x[Q].g),this._mesh._colors[0].push(x[Q].b),4===K&amp;&amp;this._mesh._colors[0].push(x[Q].a)),w&amp;&amp;(this._mesh._texCoords[0].push(p[H].x),this._mesh._texCoords[0].push(p[H].y),3===P&amp;&amp;this._mesh._texCoords[0].push(p[H].z),this._mesh._texCoords[0].push(p[W].x),this._mesh._texCoords[0].push(p[W].y),3===P&amp;&amp;this._mesh._texCoords[0].push(p[W].z),this._mesh._texCoords[0].push(p[q].x),this._mesh._texCoords[0].push(p[q].y),3===P&amp;&amp;this._mesh._texCoords[0].push(p[q].z));break;case 3:U=z,W=q,A&amp;&amp;(X=j),C&amp;&amp;(Z=Q),z=+g[D],S&amp;&amp;A?j=+v[D]:S&amp;&amp;!A||(j=A?z:k),q=M?+y[D]:z,F&amp;&amp;C?Q=+b[D]:F&amp;&amp;!C||(Q=C?z:k),this._mesh._positions[0].push(m[B].x),this._mesh._positions[0].push(m[B].y),this._mesh._positions[0].push(m[B].z),this._mesh._positions[0].push(m[U].x),this._mesh._positions[0].push(m[U].y),this._mesh._positions[0].push(m[U].z),this._mesh._positions[0].push(m[z].x),this._mesh._positions[0].push(m[z].y),this._mesh._positions[0].push(m[z].z),T&amp;&amp;(this._mesh._normals[0].push(_[G].x),this._mesh._normals[0].push(_[G].y),this._mesh._normals[0].push(_[G].z),this._mesh._normals[0].push(_[X].x),this._mesh._normals[0].push(_[X].y),this._mesh._normals[0].push(_[X].z),this._mesh._normals[0].push(_[j].x),this._mesh._normals[0].push(_[j].y),this._mesh._normals[0].push(_[j].z)),this._mesh._multiIndIndices.push(B,U,z),E&amp;&amp;(this._mesh._colors[0].push(x[Y].r),this._mesh._colors[0].push(x[Y].g),this._mesh._colors[0].push(x[Y].b),4===K&amp;&amp;this._mesh._colors[0].push(x[Y].a),this._mesh._colors[0].push(x[Z].r),this._mesh._colors[0].push(x[Z].g),this._mesh._colors[0].push(x[Z].b),4===K&amp;&amp;this._mesh._colors[0].push(x[Z].a),this._mesh._colors[0].push(x[Q].r),this._mesh._colors[0].push(x[Q].g),this._mesh._colors[0].push(x[Q].b),4===K&amp;&amp;this._mesh._colors[0].push(x[Q].a)),w&amp;&amp;(this._mesh._texCoords[0].push(p[H].x),this._mesh._texCoords[0].push(p[H].y),3===P&amp;&amp;this._mesh._texCoords[0].push(p[H].z),this._mesh._texCoords[0].push(p[W].x),this._mesh._texCoords[0].push(p[W].y),3===P&amp;&amp;this._mesh._texCoords[0].push(p[W].z),this._mesh._texCoords[0].push(p[q].x),this._mesh._texCoords[0].push(p[q].y),3===P&amp;&amp;this._mesh._texCoords[0].push(p[q].z))}else L=0,k++;else{var J=new x3dom.DoublyLinkedList,ee={};for(O=0,k=0,D=0;D&lt;g.length;++D)if(-1!=g[D])T&amp;&amp;(ee.normals=S&amp;&amp;A?_[v[D]]:S&amp;&amp;!A?_[v[k]]:_[g[D]]),E&amp;&amp;(ee.colors=F&amp;&amp;C?x[b[D]]:F&amp;&amp;!C?x[b[k]]:x[g[D]]),w&amp;&amp;(ee.texCoords=M?p[y[D]]:p[g[D]]),J.appendNode(new x3dom.DoublyLinkedList.ListNode(m[g[D]],g[D],ee.normals,ee.colors,ee.texCoords));else{var te=x3dom.EarClipping.getMultiIndexes(J);for(V=0;V&lt;te.indices.length;V++)this._mesh._indices[0].push(O),O++,this._mesh._positions[0].push(te.point[V].x,te.point[V].y,te.point[V].z),T&amp;&amp;this._mesh._normals[0].push(te.normals[V].x,te.normals[V].y,te.normals[V].z),E&amp;&amp;(this._mesh._colors[0].push(te.colors[V].r,te.colors[V].g,te.colors[V].b),4===K&amp;&amp;this._mesh._colors[0].push(te.colors[V].a)),w&amp;&amp;(this._mesh._texCoords[0].push(te.texCoords[V].x,te.texCoords[V].y),3===P&amp;&amp;this._mesh._texCoords[0].push(te.texCoords[V].z));J=new x3dom.DoublyLinkedList,k++}this._mesh.splitMesh()}for(T||this._mesh.calcNormals(this._vf.creaseAngle,this._vf.ccw),w||this._mesh.calcTexCoords(N),this.invalidateVolume(),this._mesh._numFaces=0,this._mesh._numCoords=0,D=0;D&lt;this._mesh._positions.length;D++){var ie=this._mesh._indices[D].length,se=this._mesh._positions[D].length/3;this._mesh._numCoords+=se,this._mesh._numFaces+=ie&gt;0?ie/3:se/3}Array.forEach(this._parentNodes,(function(e){e.setGeoDirty()}))}else if("coord"==e){r=!this._cf.normal.node&amp;&amp;"none"!=this._vf.normalUpdateMode.toLowerCase();this._mesh._positions[0]=t.toGL(),r&amp;&amp;this._mesh.calcNormals(this._vf.creaseAngle,this._vf.ccw),this.invalidateVolume(),Array.forEach(this._parentNodes,(function(e){e._dirty.positions=!0,r&amp;&amp;(e._dirty.normals=!0),e.invalidateVolume()}))}else if("color"==e)t=this._cf.color.node._vf.color,this._mesh._colors[0]=t.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.colors=!0}));else if("normal"==e)t=this._cf.normal.node._vf.vector,this._mesh._normals[0]=t.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.normals=!0}));else if("texCoord"==e)s=this._cf.texCoord.node,x3dom.isa(s,x3dom.nodeTypes.MultiTextureCoordinate)&amp;&amp;s._cf.texCoord.nodes.length&amp;&amp;(s=s._cf.texCoord.nodes[0]),t=s._vf.point,this._mesh._texCoords[0]=t.toGL(),Array.forEach(this._parentNodes,(function(e){e._dirty.texcoords=!0}));else if("coordIndex"==e){for(r=!this._cf.normal.node&amp;&amp;"none"!=this._vf.normalUpdateMode.toLowerCase(),L=0,i=(g=this._vf.coordIndex).length,this._mesh._indices[0]=[],D=0;D&lt;i;++D)if(-1==g[D])L=0;else switch(L){case 0:B=+g[D],L=1;break;case 1:U=+g[D],L=2;break;case 2:z=+g[D],L=3,this._mesh._indices[0].push(B,U,z);break;case 3:U=z,z=+g[D],this._mesh._indices[0].push(B,U,z)}r&amp;&amp;this._mesh.calcNormals(this._vf.creaseAngle,this._vf.ccw),Array.forEach(this._parentNodes,(function(e){e._dirty.indexes=!0,r&amp;&amp;(e._dirty.normals=!0)}))}}else x3dom.debug.logWarning("IndexedFaceSet: fieldChanged for "+e+" not yet implemented!")}})),x3dom.registerNodeType("X3DTexture3DNode","Texturing3D",defineClass(x3dom.nodeTypes.X3DTextureNode,(function(e){x3dom.nodeTypes.X3DTexture3DNode.superClass.call(this,e)}))),x3dom.registerNodeType("ComposedTexture3D","Texturing3D",defineClass(x3dom.nodeTypes.X3DTexture3DNode,(function(e){x3dom.nodeTypes.ComposedTexture3D.superClass.call(this,e),this.addField_MFNode("texture",x3dom.nodeTypes.X3DTexture3DNode)}))),x3dom.registerNodeType("ImageTexture3D","Texturing3D",defineClass(x3dom.nodeTypes.X3DTexture3DNode,(function(e){x3dom.nodeTypes.ImageTexture3D.superClass.call(this,e)}))),x3dom.registerNodeType("PixelTexture3D","Texturing3D",defineClass(x3dom.nodeTypes.X3DTexture3DNode,(function(e){x3dom.nodeTypes.PixelTexture3D.superClass.call(this,e)}))),x3dom.registerNodeType("TextureCoordinate3D","Texturing3D",defineClass(x3dom.nodeTypes.X3DTextureCoordinateNode,(function(e){x3dom.nodeTypes.TextureCoordinate3D.superClass.call(this,e),this.addField_MFVec3f(e,"point",[])}))),x3dom.registerNodeType("TextureTransform3D","Texturing3D",defineClass(x3dom.nodeTypes.X3DTextureTransformNode,(function(e){x3dom.nodeTypes.TextureTransform3D.superClass.call(this,e),this.addField_SFVec3f(e,"center",0,0,0),this.addField_SFRotation(e,"rotation",0,0,1,0),this.addField_SFVec3f(e,"scale",1,1,1),this.addField_SFVec3f(e,"translation",0,0,0),this.addField_SFRotation(e,"scaleOrientation",0,0,1,0)}))),x3dom.registerNodeType("TextureTransformMatrix3D","Texturing3D",defineClass(x3dom.nodeTypes.X3DTextureTransformNode,(function(e){x3dom.nodeTypes.TextureTransformMatrix3D.superClass.call(this,e),this.addField_SFMatrix4f(e,"matrix",1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)}))),x3dom.registerNodeType("X3DPointingDeviceSensorNode","PointingDeviceSensor",defineClass(x3dom.nodeTypes.X3DSensorNode,(function(e){x3dom.nodeTypes.X3DPointingDeviceSensorNode.superClass.call(this,e)}),{pointerPressedOverSibling:function(e){this._vf.enabled&amp;&amp;(this._vf.isActive=!0,this.postMessage("isActive",!0))},pointerMoved:function(e){},pointerMovedOver:function(e){this._vf.enabled&amp;&amp;this.postMessage("isOver",!0)},pointerMovedOut:function(e){this._vf.enabled&amp;&amp;this.postMessage("isOver",!1)},pointerReleased:function(){this._vf.enabled&amp;&amp;(this._vf.isActive=!1,this.postMessage("isActive",!1))}})),x3dom.registerNodeType("X3DDragSensorNode","PointingDeviceSensor",defineClass(x3dom.nodeTypes.X3DPointingDeviceSensorNode,(function(e){x3dom.nodeTypes.X3DDragSensorNode.superClass.call(this,e),this.addField_SFBool(e,"autoOffset",!0),this._lastX=-1,this._lastY=-1}),{pointerPressedOverSibling:function(e){x3dom.nodeTypes.X3DPointingDeviceSensorNode.prototype.pointerPressedOverSibling.call(this,e),this._lastX=e.layerX,this._lastY=e.layerY,this._startDragging(e.viewarea,e.layerX,e.layerX,e.worldX,e.worldY,e.worldZ)},pointerMoved:function(e){x3dom.nodeTypes.X3DPointingDeviceSensorNode.prototype.pointerMoved.call(this,e),this._vf.isActive&amp;&amp;this._vf.enabled&amp;&amp;this._process2DDrag(e.layerX,e.layerY,e.layerX-this._lastX,e.layerY-this._lastY)},pointerReleased:function(){x3dom.nodeTypes.X3DPointingDeviceSensorNode.prototype.pointerReleased.call(this),this._stopDragging()},_startDragging:function(e,t,i,s,r,o){},_process2DDrag:function(e,t,i,s){},_stopDragging:function(){}})),x3dom.registerNodeType("X3DTouchSensorNode","PointingDeviceSensor",defineClass(x3dom.nodeTypes.X3DPointingDeviceSensorNode,(function(e){x3dom.nodeTypes.X3DTouchSensorNode.superClass.call(this,e)}),{})),x3dom.registerNodeType("TouchSensor","PointingDeviceSensor",defineClass(x3dom.nodeTypes.X3DTouchSensorNode,(function(e){x3dom.nodeTypes.TouchSensor.superClass.call(this,e)}),{})),x3dom.registerNodeType("PlaneSensor","PointingDeviceSensor",defineClass(x3dom.nodeTypes.X3DDragSensorNode,(function(e){x3dom.nodeTypes.PlaneSensor.superClass.call(this,e),this.addField_SFRotation(e,"axisRotation",0,0,1,0),this.addField_SFVec2f(e,"minPosition",0,0),this.addField_SFVec2f(e,"maxPosition",-1,-1),this.addField_SFVec3f(e,"offset",0,0,0),this._rotationMatrix=this._vf.axisRotation.toMatrix(),this._worldToLocalMatrix=null,this._initialPlaneIntersection=null,this._planeNormal=null,this._viewArea=null,this._currentTranslation=new x3dom.fields.SFVec3f(0,0,0)}),{getCurrentTransform:function(){return x3dom.nodeTypes.X3DDragSensorNode.prototype.getCurrentTransform.call(this).mult(this._rotationMatrix)},_startDragging:function(e,t,i,s,r,o){x3dom.nodeTypes.X3DDragSensorNode.prototype._startDragging.call(this,e,t,i,s,r,o),this._viewArea=e,this._currentTranslation=new x3dom.fields.SFVec3f(0,0,0).add(this._vf.offset),this._worldToLocalMatrix=this.getCurrentTransform().inverse(),this._initialPlaneIntersection=this._worldToLocalMatrix.multMatrixPnt(new x3dom.fields.SFVec3f(s,r,o)),this._planeNormal=new x3dom.fields.SFVec3f(0,0,1)},_process2DDrag:function(e,t,i,s){var r,o,n;if(x3dom.nodeTypes.X3DDragSensorNode.prototype._process2DDrag.call(this,e,t,i,s),this._initialPlaneIntersection){var a=this._viewArea.calcViewRay(e,t);a.pos=this._worldToLocalMatrix.multMatrixPnt(a.pos),a.dir=this._worldToLocalMatrix.multMatrixVec(a.dir.normalize()),(r=a.intersectPlane(this._initialPlaneIntersection,this._planeNormal))||(r=a.intersectPlane(this._initialPlaneIntersection,this._planeNormal.negate())),r&amp;&amp;(this._currentTranslation=r.subtract(this._initialPlaneIntersection),this._currentTranslation=this._currentTranslation.add(this._vf.offset),o=this._vf.minPosition,n=this._vf.maxPosition,o.x&lt;=n.x&amp;&amp;(this._currentTranslation.x=Math.min(this._currentTranslation.x,n.x),this._currentTranslation.x=Math.max(this._currentTranslation.x,o.x)),o.y&lt;=n.y&amp;&amp;(this._currentTranslation.y=Math.min(this._currentTranslation.y,n.y),this._currentTranslation.y=Math.max(this._currentTranslation.y,o.y)),this.postMessage("translation_changed",x3dom.fields.SFVec3f.copy(this._currentTranslation)))}},_stopDragging:function(){x3dom.nodeTypes.X3DDragSensorNode.prototype._stopDragging.call(this),this._vf.autoOffset&amp;&amp;(this._vf.offset=x3dom.fields.SFVec3f.copy(this._currentTranslation),this.postMessage("offset_changed",this._vf.offset))}})),x3dom.registerNodeType("SphereSensor","PointingDeviceSensor",defineClass(x3dom.nodeTypes.X3DDragSensorNode,(function(e){x3dom.nodeTypes.SphereSensor.superClass.call(this,e),this.addField_SFRotation(e,"offset",0,1,0,0),this._currentRotation=null,this._rotationMatrix=this._vf.offset.toMatrix()}),{getCurrentTransform:function(){return x3dom.nodeTypes.X3DDragSensorNode.prototype.getCurrentTransform.call(this).mult(this._rotationMatrix)},_startDragging:function(e,t,i,s,r,o){x3dom.nodeTypes.X3DDragSensorNode.prototype._startDragging.call(this,e,t,i,s,r,o),this._currentRotation=new x3dom.fields.Quaternion,this._viewArea=e,this._localOrigin=new x3dom.fields.SFVec3f(0,0,0),this._inverseToWorldMatrix=this.getCurrentTransform().inverse();var n=this._inverseToWorldMatrix.multMatrixPnt(new x3dom.fields.SFVec3f(s,r,o));this._initialSphereIntersectionVector=n.subtract(this._localOrigin),this._sphereRadius=this._initialSphereIntersectionVector.length(),this._initialSphereIntersectionVector=this._initialSphereIntersectionVector.normalize()},_process2DDrag:function(e,t,i,s){x3dom.nodeTypes.X3DDragSensorNode.prototype._process2DDrag.call(this,e,t,i,s);var r=this._viewArea.calcViewRay(e,t);r.pos=this._inverseToWorldMatrix.multMatrixPnt(r.pos),r.dir=this._inverseToWorldMatrix.multMatrixVec(r.dir);var o,n,a=r.dir.dot(r.dir),h=2*r.dir.dot(r.pos.subtract(this._localOrigin)),d=h*h-4*a*(r.pos.dot(r.pos)-2*this._localOrigin.dot(r.pos)+this._localOrigin.dot(this._localOrigin)-this._sphereRadius*this._sphereRadius);if(d&gt;=0&amp;&amp;(o=(-h+Math.sqrt(d))/(2*a),n=(-h-Math.sqrt(d))/(2*a),(o=Math.min(o,n))&gt;=1)){var l=r.pos.add(r.dir.multiply(o)).subtract(this._localOrigin).normalize();this._currentRotation=x3dom.fields.Quaternion.rotateFromTo(this._initialSphereIntersectionVector,l),this._currentRotation=this._currentRotation.multiply(this._vf.offset),this.postMessage("rotation_changed",this._currentRotation)}},_stopDragging:function(){x3dom.nodeTypes.X3DDragSensorNode.prototype._stopDragging.call(this),this._vf.autoOffset&amp;&amp;(this._vf.offset=this._currentRotation,this.postMessage("offset_changed",this._vf.offset)),this._currentRotation=new x3dom.fields.Quaternion}})),x3dom.registerNodeType("CylinderSensor","PointingDeviceSensor",defineClass(x3dom.nodeTypes.X3DDragSensorNode,(function(e){x3dom.nodeTypes.CylinderSensor.superClass.call(this,e),this.addField_SFFloat(e,"offset",0),this.addField_SFRotation(e,"axisRotation",0,1,0,0),this.addField_SFFloat(e,"diskAngle",.262),this.addField_SFFloat(e,"minAngle",0),this.addField_SFFloat(e,"maxAngle",-1),this._rotationMatrix=this._vf.axisRotation.toMatrix(),this._inverseToWorldMatrix=null,this._initialCylinderIntersectionVector=null,this._viewArea=null,this._cylinderRadius=0,this._yAxisLine=null,this._cylinderMode=!0,this._currentRotationAngle=0}),{getCurrentTransform:function(){return x3dom.nodeTypes.X3DDragSensorNode.prototype.getCurrentTransform.call(this).mult(this._rotationMatrix)},_startDragging:function(e,t,i,s,r,o){x3dom.nodeTypes.X3DDragSensorNode.prototype._startDragging.call(this,e,t,i,s,r,o),this._currentRotation=new x3dom.fields.Quaternion,this._viewArea=e,this._yAxisLine=new x3dom.fields.Line(new x3dom.fields.SFVec3f(0,0,0),new x3dom.fields.SFVec3f(0,1,0)),this._inverseToWorldMatrix=this.getCurrentTransform().inverse();var n=this._inverseToWorldMatrix.multMatrixPnt(new x3dom.fields.SFVec3f(s,r,o)),a=this._yAxisLine.closestPoint(n);this._initialCylinderIntersectionVector=n.subtract(a),this._cylinderRadius=this._initialCylinderIntersectionVector.length(),this._initialCylinderIntersectionVector=this._initialCylinderIntersectionVector.normalize()},_process2DDrag:function(e,t,i,s){if(x3dom.nodeTypes.X3DDragSensorNode.prototype._process2DDrag.call(this,e,t,i,s),this._cylinderMode){var r=this._viewArea.calcViewRay(e,t);r.pos=this._inverseToWorldMatrix.multMatrixPnt(r.pos),r.dir=this._inverseToWorldMatrix.multMatrixVec(r.dir);var o,n,a=r.dir.subtract(this._yAxisLine.dir.multiply(r.dir.dot(this._yAxisLine.dir))),h=r.pos.subtract(this._yAxisLine.pos).add(this._yAxisLine.dir.multiply(this._yAxisLine.dir.dot(this._yAxisLine.pos.subtract(r.pos)))),d=2*a.dot(h)/a.dot(a),l=d*d*.25-(h.dot(h)-this._cylinderRadius*this._cylinderRadius)/a.dot(a);if(l&gt;=0&amp;&amp;(o=.5*-d+(l=Math.sqrt(l)),n=.5*-d-l,(o=Math.min(o,n))&gt;0)){var u=r.pos.add(r.dir.multiply(o)),f=this._yAxisLine.closestPoint(u),c=u.subtract(f).normalize();this._currentRotation=x3dom.fields.Quaternion.rotateFromTo(this._initialCylinderIntersectionVector,c);var m=x3dom.fields.Quaternion.axisAngle(this._yAxisLine.dir,this._vf.offset);this._currentRotation=this._currentRotation.multiply(m),this.postMessage("rotation_changed",this._currentRotation)}}},_stopDragging:function(){x3dom.nodeTypes.X3DDragSensorNode.prototype._stopDragging.call(this),this._vf.autoOffset&amp;&amp;(this._vf.offset=this._currentRotation.angle(),this.postMessage("offset_changed",this._vf.offset))}})),x3dom.versionInfo={version:"1.7.2",revision:"61a235203deb34329fe615cbbf21314db6ebf49f",date:"Mon Dec 19 19:17:05 2016 +0100"},module.exports=x3dom},610:function(e,t,i){},611:function(e,t,i){var s;!function(r){var o=/^\s+/,n=/\s+$/,a=0,h=r.round,d=r.min,l=r.max,u=r.random;function f(e,t){if(t=t||{},(e=e||"")instanceof f)return e;if(!(this instanceof f))return new f(e,t);var i=function(e){var t={r:0,g:0,b:0},i=1,s=null,a=null,h=null,u=!1,f=!1;"string"==typeof e&amp;&amp;(e=function(e){e=e.replace(o,"").replace(n,"").toLowerCase();var t,i=!1;if(R[e])e=R[e],i=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=U.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=U.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=U.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=U.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=U.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=U.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=U.hex8.exec(e))return{r:V(t[1]),g:V(t[2]),b:V(t[3]),a:B(t[4]),format:i?"name":"hex8"};if(t=U.hex6.exec(e))return{r:V(t[1]),g:V(t[2]),b:V(t[3]),format:i?"name":"hex"};if(t=U.hex4.exec(e))return{r:V(t[1]+""+t[1]),g:V(t[2]+""+t[2]),b:V(t[3]+""+t[3]),a:B(t[4]+""+t[4]),format:i?"name":"hex8"};if(t=U.hex3.exec(e))return{r:V(t[1]+""+t[1]),g:V(t[2]+""+t[2]),b:V(t[3]+""+t[3]),format:i?"name":"hex"};return!1}(e));"object"==typeof e&amp;&amp;(z(e.r)&amp;&amp;z(e.g)&amp;&amp;z(e.b)?(t=function(e,t,i){return{r:255*P(e,255),g:255*P(t,255),b:255*P(i,255)}}(e.r,e.g,e.b),u=!0,f="%"===String(e.r).substr(-1)?"prgb":"rgb"):z(e.h)&amp;&amp;z(e.s)&amp;&amp;z(e.v)?(s=O(e.s),a=O(e.v),t=function(e,t,i){e=6*P(e,360),t=P(t,100),i=P(i,100);var s=r.floor(e),o=e-s,n=i*(1-t),a=i*(1-o*t),h=i*(1-(1-o)*t),d=s%6;return{r:255*[i,a,n,n,h,i][d],g:255*[h,i,i,a,n,n][d],b:255*[n,n,h,i,i,a][d]}}(e.h,s,a),u=!0,f="hsv"):z(e.h)&amp;&amp;z(e.s)&amp;&amp;z(e.l)&amp;&amp;(s=O(e.s),h=O(e.l),t=function(e,t,i){var s,r,o;function n(e,t,i){return i&lt;0&amp;&amp;(i+=1),i&gt;1&amp;&amp;(i-=1),i&lt;1/6?e+6*(t-e)*i:i&lt;.5?t:i&lt;2/3?e+(t-e)*(2/3-i)*6:e}if(e=P(e,360),t=P(t,100),i=P(i,100),0===t)s=r=o=i;else{var a=i&lt;.5?i*(1+t):i+t-i*t,h=2*i-a;s=n(h,a,e+1/3),r=n(h,a,e),o=n(h,a,e-1/3)}return{r:255*s,g:255*r,b:255*o}}(e.h,s,h),u=!0,f="hsl"),e.hasOwnProperty("a")&amp;&amp;(i=e.a));return i=N(i),{ok:u,format:e.format||f,r:d(255,l(t.r,0)),g:d(255,l(t.g,0)),b:d(255,l(t.b,0)),a:i}}(e);this._originalInput=e,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=h(100*this._a)/100,this._format=t.format||i.format,this._gradientType=t.gradientType,this._r&lt;1&amp;&amp;(this._r=h(this._r)),this._g&lt;1&amp;&amp;(this._g=h(this._g)),this._b&lt;1&amp;&amp;(this._b=h(this._b)),this._ok=i.ok,this._tc_id=a++}function c(e,t,i){e=P(e,255),t=P(t,255),i=P(i,255);var s,r,o=l(e,t,i),n=d(e,t,i),a=(o+n)/2;if(o==n)s=r=0;else{var h=o-n;switch(r=a&gt;.5?h/(2-o-n):h/(o+n),o){case e:s=(t-i)/h+(t&lt;i?6:0);break;case t:s=(i-e)/h+2;break;case i:s=(e-t)/h+4}s/=6}return{h:s,s:r,l:a}}function m(e,t,i){e=P(e,255),t=P(t,255),i=P(i,255);var s,r,o=l(e,t,i),n=d(e,t,i),a=o,h=o-n;if(r=0===o?0:h/o,o==n)s=0;else{switch(o){case e:s=(t-i)/h+(t&lt;i?6:0);break;case t:s=(i-e)/h+2;break;case i:s=(e-t)/h+4}s/=6}return{h:s,s:r,v:a}}function _(e,t,i,s){var r=[L(h(e).toString(16)),L(h(t).toString(16)),L(h(i).toString(16))];return s&amp;&amp;r[0].charAt(0)==r[0].charAt(1)&amp;&amp;r[1].charAt(0)==r[1].charAt(1)&amp;&amp;r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function p(e,t,i,s){return[L(k(s)),L(h(e).toString(16)),L(h(t).toString(16)),L(h(i).toString(16))].join("")}function x(e,t){t=0===t?0:t||10;var i=f(e).toHsl();return i.s-=t/100,i.s=D(i.s),f(i)}function g(e,t){t=0===t?0:t||10;var i=f(e).toHsl();return i.s+=t/100,i.s=D(i.s),f(i)}function v(e){return f(e).desaturate(100)}function y(e,t){t=0===t?0:t||10;var i=f(e).toHsl();return i.l+=t/100,i.l=D(i.l),f(i)}function b(e,t){t=0===t?0:t||10;var i=f(e).toRgb();return i.r=l(0,d(255,i.r-h(-t/100*255))),i.g=l(0,d(255,i.g-h(-t/100*255))),i.b=l(0,d(255,i.b-h(-t/100*255))),f(i)}function T(e,t){t=0===t?0:t||10;var i=f(e).toHsl();return i.l-=t/100,i.l=D(i.l),f(i)}function S(e,t){var i=f(e).toHsl(),s=(i.h+t)%360;return i.h=s&lt;0?360+s:s,f(i)}function w(e){var t=f(e).toHsl();return t.h=(t.h+180)%360,f(t)}function M(e){var t=f(e).toHsl(),i=t.h;return[f(e),f({h:(i+120)%360,s:t.s,l:t.l}),f({h:(i+240)%360,s:t.s,l:t.l})]}function E(e){var t=f(e).toHsl(),i=t.h;return[f(e),f({h:(i+90)%360,s:t.s,l:t.l}),f({h:(i+180)%360,s:t.s,l:t.l}),f({h:(i+270)%360,s:t.s,l:t.l})]}function F(e){var t=f(e).toHsl(),i=t.h;return[f(e),f({h:(i+72)%360,s:t.s,l:t.l}),f({h:(i+216)%360,s:t.s,l:t.l})]}function C(e,t,i){t=t||6,i=i||30;var s=f(e).toHsl(),r=360/i,o=[f(e)];for(s.h=(s.h-(r*t&gt;&gt;1)+720)%360;--t;)s.h=(s.h+r)%360,o.push(f(s));return o}function A(e,t){t=t||6;for(var i=f(e).toHsv(),s=i.h,r=i.s,o=i.v,n=[],a=1/t;t--;)n.push(f({h:s,s:r,v:o})),o=(o+a)%1;return n}f.prototype={isDark:function(){return this.getBrightness()&lt;128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,i,s=this.toRgb();return e=s.r/255,t=s.g/255,i=s.b/255,.2126*(e&lt;=.03928?e/12.92:r.pow((e+.055)/1.055,2.4))+.7152*(t&lt;=.03928?t/12.92:r.pow((t+.055)/1.055,2.4))+.0722*(i&lt;=.03928?i/12.92:r.pow((i+.055)/1.055,2.4))},setAlpha:function(e){return this._a=N(e),this._roundA=h(100*this._a)/100,this},toHsv:function(){var e=m(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=m(this._r,this._g,this._b),t=h(360*e.h),i=h(100*e.s),s=h(100*e.v);return 1==this._a?"hsv("+t+", "+i+"%, "+s+"%)":"hsva("+t+", "+i+"%, "+s+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=h(360*e.h),i=h(100*e.s),s=h(100*e.l);return 1==this._a?"hsl("+t+", "+i+"%, "+s+"%)":"hsla("+t+", "+i+"%, "+s+"%, "+this._roundA+")"},toHex:function(e){return _(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,i,s,r){var o=[L(h(e).toString(16)),L(h(t).toString(16)),L(h(i).toString(16)),L(k(s))];if(r&amp;&amp;o[0].charAt(0)==o[0].charAt(1)&amp;&amp;o[1].charAt(0)==o[1].charAt(1)&amp;&amp;o[2].charAt(0)==o[2].charAt(1)&amp;&amp;o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:h(this._r),g:h(this._g),b:h(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+h(this._r)+", "+h(this._g)+", "+h(this._b)+")":"rgba("+h(this._r)+", "+h(this._g)+", "+h(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:h(100*P(this._r,255))+"%",g:h(100*P(this._g,255))+"%",b:h(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+h(100*P(this._r,255))+"%, "+h(100*P(this._g,255))+"%, "+h(100*P(this._b,255))+"%)":"rgba("+h(100*P(this._r,255))+"%, "+h(100*P(this._g,255))+"%, "+h(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a&lt;1)&amp;&amp;(I[_(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),i=t,s=this._gradientType?"GradientType = 1, ":"";if(e){var r=f(e);i="#"+p(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+s+"startColorstr="+t+",endColorstr="+i+")"},toString:function(e){var t=!!e;e=e||this._format;var i=!1,s=this._a&lt;1&amp;&amp;this._a&gt;=0;return t||!s||"hex"!==e&amp;&amp;"hex6"!==e&amp;&amp;"hex3"!==e&amp;&amp;"hex4"!==e&amp;&amp;"hex8"!==e&amp;&amp;"name"!==e?("rgb"===e&amp;&amp;(i=this.toRgbString()),"prgb"===e&amp;&amp;(i=this.toPercentageRgbString()),"hex"!==e&amp;&amp;"hex6"!==e||(i=this.toHexString()),"hex3"===e&amp;&amp;(i=this.toHexString(!0)),"hex4"===e&amp;&amp;(i=this.toHex8String(!0)),"hex8"===e&amp;&amp;(i=this.toHex8String()),"name"===e&amp;&amp;(i=this.toName()),"hsl"===e&amp;&amp;(i=this.toHslString()),"hsv"===e&amp;&amp;(i=this.toHsvString()),i||this.toHexString()):"name"===e&amp;&amp;0===this._a?this.toName():this.toRgbString()},clone:function(){return f(this.toString())},_applyModification:function(e,t){var i=e.apply(null,[this].concat([].slice.call(t)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(y,arguments)},brighten:function(){return this._applyModification(b,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(x,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(S,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(C,arguments)},complement:function(){return this._applyCombination(w,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(F,arguments)},triad:function(){return this._applyCombination(M,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},f.fromRatio=function(e,t){if("object"==typeof e){var i={};for(var s in e)e.hasOwnProperty(s)&amp;&amp;(i[s]="a"===s?e[s]:O(e[s]));e=i}return f(e,t)},f.equals=function(e,t){return!(!e||!t)&amp;&amp;f(e).toRgbString()==f(t).toRgbString()},f.random=function(){return f.fromRatio({r:u(),g:u(),b:u()})},f.mix=function(e,t,i){i=0===i?0:i||50;var s=f(e).toRgb(),r=f(t).toRgb(),o=i/100;return f({r:(r.r-s.r)*o+s.r,g:(r.g-s.g)*o+s.g,b:(r.b-s.b)*o+s.b,a:(r.a-s.a)*o+s.a})},f.readability=function(e,t){var i=f(e),s=f(t);return(r.max(i.getLuminance(),s.getLuminance())+.05)/(r.min(i.getLuminance(),s.getLuminance())+.05)},f.isReadable=function(e,t,i){var s,r,o=f.readability(e,t);switch(r=!1,(s=function(e){var t,i;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),i=(e.size||"small").toLowerCase(),"AA"!==t&amp;&amp;"AAA"!==t&amp;&amp;(t="AA");"small"!==i&amp;&amp;"large"!==i&amp;&amp;(i="small");return{level:t,size:i}}(i)).level+s.size){case"AAsmall":case"AAAlarge":r=o&gt;=4.5;break;case"AAlarge":r=o&gt;=3;break;case"AAAsmall":r=o&gt;=7}return r},f.mostReadable=function(e,t,i){var s,r,o,n,a=null,h=0;r=(i=i||{}).includeFallbackColors,o=i.level,n=i.size;for(var d=0;d&lt;t.length;d++)(s=f.readability(e,t[d]))&gt;h&amp;&amp;(h=s,a=f(t[d]));return f.isReadable(e,a,{level:o,size:n})||!r?a:(i.includeFallbackColors=!1,f.mostReadable(e,["#fff","#000"],i))};var R=f.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},I=f.hexNames=function(e){var t={};for(var i in e)e.hasOwnProperty(i)&amp;&amp;(t[e[i]]=i);return t}(R);function N(e){return e=parseFloat(e),(isNaN(e)||e&lt;0||e&gt;1)&amp;&amp;(e=1),e}function P(e,t){(function(e){return"string"==typeof e&amp;&amp;-1!=e.indexOf(".")&amp;&amp;1===parseFloat(e)})(e)&amp;&amp;(e="100%");var i=function(e){return"string"===typeof e&amp;&amp;-1!=e.indexOf("%")}(e);return e=d(t,l(0,parseFloat(e))),i&amp;&amp;(e=parseInt(e*t,10)/100),r.abs(e-t)&lt;1e-6?1:e%t/parseFloat(t)}function D(e){return d(1,l(0,e))}function V(e){return parseInt(e,16)}function L(e){return 1==e.length?"0"+e:""+e}function O(e){return e&lt;=1&amp;&amp;(e=100*e+"%"),e}function k(e){return r.round(255*parseFloat(e)).toString(16)}function B(e){return V(e)/255}var U=function(){var e="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",t="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?",i="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+t),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+t),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+t),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function z(e){return!!U.CSS_UNIT.exec(e)}e.exports?e.exports=f:void 0===(s=function(){return f}.call(t,i,t,e))||(e.exports=s)}(Math)},612:function(e,t,i){"use strict";function s(e,t,i,s,r,o,n){try{var a=e[o](n),h=a.value}catch(d){return void i(d)}a.done?t(h):Promise.resolve(h).then(s,r)}function r(e){return function(){var t=this,i=arguments;return new Promise((function(r,o){var n=e.apply(t,i);function a(e){s(n,r,o,a,h,"next",e)}function h(e){s(n,r,o,a,h,"throw",e)}a(void 0)}))}}i.d(t,"a",(function(){return r}))},613:function(e,t,i){(function(t,i,s){e.exports=function e(t,i,s){function r(n,a){if(!i[n]){if(!t[n]){if(o)return o(n,!0);var h=new Error("Cannot find module '"+n+"'");throw h.code="MODULE_NOT_FOUND",h}var d=i[n]={exports:{}};t[n][0].call(d.exports,(function(e){return r(t[n][1][e]||e)}),d,d.exports,e,t,i,s)}return i[n].exports}for(var o=!1,n=0;n&lt;s.length;n++)r(s[n]);return r}({1:[function(e,t,i){"use strict";var s=e("./utils"),r=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,r,n,a,h,d,l=[],u=0,f=e.length,c=f,m="string"!==s.getTypeOf(e);u&lt;e.length;)c=f-u,r=m?(t=e[u++],i=u&lt;f?e[u++]:0,u&lt;f?e[u++]:0):(t=e.charCodeAt(u++),i=u&lt;f?e.charCodeAt(u++):0,u&lt;f?e.charCodeAt(u++):0),n=t&gt;&gt;2,a=(3&amp;t)&lt;&lt;4|i&gt;&gt;4,h=1&lt;c?(15&amp;i)&lt;&lt;2|r&gt;&gt;6:64,d=2&lt;c?63&amp;r:64,l.push(o.charAt(n)+o.charAt(a)+o.charAt(h)+o.charAt(d));return l.join("")},i.decode=function(e){var t,i,s,n,a,h,d=0,l=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var f,c=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(e.charAt(e.length-1)===o.charAt(64)&amp;&amp;c--,e.charAt(e.length-2)===o.charAt(64)&amp;&amp;c--,c%1!=0)throw new Error("Invalid base64 input, bad content length.");for(f=r.uint8array?new Uint8Array(0|c):new Array(0|c);d&lt;e.length;)t=o.indexOf(e.charAt(d++))&lt;&lt;2|(n=o.indexOf(e.charAt(d++)))&gt;&gt;4,i=(15&amp;n)&lt;&lt;4|(a=o.indexOf(e.charAt(d++)))&gt;&gt;2,s=(3&amp;a)&lt;&lt;6|(h=o.indexOf(e.charAt(d++))),f[l++]=t,64!==a&amp;&amp;(f[l++]=i),64!==h&amp;&amp;(f[l++]=s);return f}},{"./support":30,"./utils":32}],2:[function(e,t,i){"use strict";var s=e("./external"),r=e("./stream/DataWorker"),o=e("./stream/DataLengthProbe"),n=e("./stream/Crc32Probe");function a(e,t,i,s,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=s,this.compressedContent=r}o=e("./stream/DataLengthProbe"),a.prototype={getContentWorker:function(){var e=new r(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new r(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,i){return e.pipe(new n).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){"use strict";var s=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(e){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){"use strict";var s=e("./utils"),r=function(){for(var e,t=[],i=0;i&lt;256;i++){e=i;for(var s=0;s&lt;8;s++)e=1&amp;e?3988292384^e&gt;&gt;&gt;1:e&gt;&gt;&gt;1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&amp;&amp;e.length?"string"!==s.getTypeOf(e)?function(e,t,i,s){var o=r,n=0+i;e^=-1;for(var a=0;a&lt;n;a++)e=e&gt;&gt;&gt;8^o[255&amp;(e^t[a])];return-1^e}(0|t,e,e.length):function(e,t,i,s){var o=r,n=0+i;e^=-1;for(var a=0;a&lt;n;a++)e=e&gt;&gt;&gt;8^o[255&amp;(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){"use strict";i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){"use strict";var s;s="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:s}},{lie:37}],7:[function(e,t,i){"use strict";var s="undefined"!=typeof Uint8Array&amp;&amp;"undefined"!=typeof Uint16Array&amp;&amp;"undefined"!=typeof Uint32Array,r=e("pako"),o=e("./utils"),n=e("./stream/GenericWorker"),a=s?"uint8array":"array";function h(e,t){n.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",o.inherits(h,n),h.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&amp;&amp;this._createPako(),this._pako.push(o.transformTo(a,e.data),!1)},h.prototype.flush=function(){n.prototype.flush.call(this),null===this._pako&amp;&amp;this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new h("Deflate",e)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){"use strict";function s(e,t){var i,s="";for(i=0;i&lt;t;i++)s+=String.fromCharCode(255&amp;e),e&gt;&gt;&gt;=8;return s}function r(e,t,i,r,n,l){var u,f,c=e.file,m=e.compression,_=l!==a.utf8encode,p=o.transformTo("string",l(c.name)),x=o.transformTo("string",a.utf8encode(c.name)),g=c.comment,v=o.transformTo("string",l(g)),y=o.transformTo("string",a.utf8encode(g)),b=x.length!==c.name.length,T=y.length!==g.length,S="",w="",M="",E=c.dir,F=c.date,C={crc32:0,compressedSize:0,uncompressedSize:0};t&amp;&amp;!i||(C.crc32=e.crc32,C.compressedSize=e.compressedSize,C.uncompressedSize=e.uncompressedSize);var A=0;t&amp;&amp;(A|=8),_||!b&amp;&amp;!T||(A|=2048);var R=0,I=0;E&amp;&amp;(R|=16),"UNIX"===n?(I=798,R|=function(e,t){var i=e;return e||(i=t?16893:33204),(65535&amp;i)&lt;&lt;16}(c.unixPermissions,E)):(I=20,R|=function(e){return 63&amp;(e||0)}(c.dosPermissions)),u=F.getUTCHours(),u&lt;&lt;=6,u|=F.getUTCMinutes(),u&lt;&lt;=5,u|=F.getUTCSeconds()/2,f=F.getUTCFullYear()-1980,f&lt;&lt;=4,f|=F.getUTCMonth()+1,f&lt;&lt;=5,f|=F.getUTCDate(),b&amp;&amp;(w=s(1,1)+s(h(p),4)+x,S+="up"+s(w.length,2)+w),T&amp;&amp;(M=s(1,1)+s(h(v),4)+y,S+="uc"+s(M.length,2)+M);var N="";return N+="\n\0",N+=s(A,2),N+=m.magic,N+=s(u,2),N+=s(f,2),N+=s(C.crc32,4),N+=s(C.compressedSize,4),N+=s(C.uncompressedSize,4),N+=s(p.length,2),N+=s(S.length,2),{fileRecord:d.LOCAL_FILE_HEADER+N+p+S,dirRecord:d.CENTRAL_FILE_HEADER+s(I,2)+N+s(v.length,2)+"\0\0\0\0"+s(R,4)+s(r,4)+p+S+v}}var o=e("../utils"),n=e("../stream/GenericWorker"),a=e("../utf8"),h=e("../crc32"),d=e("../signature");function l(e,t,i,s){n.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=s,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(l,n),l.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,s=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,n.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-s-1))/i:100}}))},l.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&amp;&amp;!e.file.dir;if(t){var i=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&amp;&amp;!e.file.dir,i=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:function(e){return d.DATA_DESCRIPTOR+s(e.crc32,4)+s(e.compressedSize,4)+s(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t&lt;this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i=this.bytesWritten-e,r=function(e,t,i,r,n){var a=o.transformTo("string",n(r));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(e,2)+s(e,2)+s(t,4)+s(i,4)+s(a.length,2)+a}(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:r,meta:{percent:100}})},l.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},l.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},l.prototype.resume=function(){return!!n.prototype.resume.call(this)&amp;&amp;(!this.previous&amp;&amp;this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},l.prototype.error=function(e){var t=this._sources;if(!n.prototype.error.call(this,e))return!1;for(var i=0;i&lt;t.length;i++)try{t[i].error(e)}catch(e){}return!0},l.prototype.lock=function(){n.prototype.lock.call(this);for(var e=this._sources,t=0;t&lt;e.length;t++)e[t].lock()},t.exports=l},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){"use strict";var s=e("../compressions"),r=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var o=new r(t.streamFiles,i,t.platform,t.encodeFileName),n=0;try{e.forEach((function(e,i){n++;var r=function(e,t){var i=e||t,r=s[i];if(!r)throw new Error(i+" is not a valid compression method !");return r}(i.options.compression,t.compression),a=i.options.compressionOptions||t.compressionOptions||{},h=i.dir,d=i.date;i._compressWorker(r,a).withStreamInfo("file",{name:e,dir:h,date:d,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(o)})),o.entriesCount=n}catch(e){o.error(e)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){"use strict";function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files={},this.comment=null,this.root="",this.clone=function(){var e=new s;for(var t in this)"function"!=typeof this[t]&amp;&amp;(e[t]=this[t]);return e}}(s.prototype=e("./object")).loadAsync=e("./load"),s.support=e("./support"),s.defaults=e("./defaults"),s.version="3.4.0",s.loadAsync=function(e,t){return(new s).loadAsync(e,t)},s.external=e("./external"),t.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){"use strict";var s=e("./utils"),r=e("./external"),o=e("./utf8"),n=(s=e("./utils"),e("./zipEntries")),a=e("./stream/Crc32Probe"),h=e("./nodejsUtils");function d(e){return new r.Promise((function(t,i){var s=e.decompressed.getContentWorker().pipe(new a);s.on("error",(function(e){i(e)})).on("end",(function(){s.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var i=this;return t=s.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),h.isNode&amp;&amp;h.isStream(e)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var i=new n(t);return i.load(e),i})).then((function(e){var i=[r.Promise.resolve(e)],s=e.files;if(t.checkCRC32)for(var o=0;o&lt;s.length;o++)i.push(d(s[o]));return r.Promise.all(i)})).then((function(e){for(var s=e.shift(),r=s.files,o=0;o&lt;r.length;o++){var n=r[o];i.file(n.fileNameStr,n.decompressed,{binary:!0,optimizedBinaryString:!0,date:n.date,dir:n.dir,comment:n.fileCommentStr.length?n.fileCommentStr:null,unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions,createFolders:t.createFolders})}return s.zipComment.length&amp;&amp;(i.comment=s.zipComment),i}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){"use strict";var s=e("../utils"),r=e("../stream/GenericWorker");function o(e,t){r.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}s.inherits(o,r),o.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},o.prototype.pause=function(){return!!r.prototype.pause.call(this)&amp;&amp;(this._stream.pause(),!0)},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&amp;&amp;(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){"use strict";var s=e("readable-stream").Readable;function r(e,t,i){s.call(this,t),this._helper=e;var r=this;e.on("data",(function(e,t){r.push(e)||r._helper.pause(),i&amp;&amp;i(t)})).on("error",(function(e){r.emit("error",e)})).on("end",(function(){r.push(null)}))}e("../utils").inherits(r,s),r.prototype._read=function(){this._helper.resume()},t.exports=r},{"../utils":32,"readable-stream":16}],14:[function(e,i,s){"use strict";i.exports={isNode:"undefined"!=typeof t,newBufferFrom:function(e,i){if(t.from&amp;&amp;t.from!==Uint8Array.from)return t.from(e,i);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new t(e,i)},allocBuffer:function(e){if(t.alloc)return t.alloc(e);var i=new t(e);return i.fill(0),i},isBuffer:function(e){return t.isBuffer(e)},isStream:function(e){return e&amp;&amp;"function"==typeof e.on&amp;&amp;"function"==typeof e.pause&amp;&amp;"function"==typeof e.resume}}},{}],15:[function(e,t,i){"use strict";function s(e,t,i){var s,r=o.getTypeOf(t),a=o.extend(i||{},h);a.date=a.date||new Date,null!==a.compression&amp;&amp;(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&amp;&amp;(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&amp;&amp;16384&amp;a.unixPermissions&amp;&amp;(a.dir=!0),a.dosPermissions&amp;&amp;16&amp;a.dosPermissions&amp;&amp;(a.dir=!0),a.dir&amp;&amp;(e=_(e)),a.createFolders&amp;&amp;(s=m(e))&amp;&amp;p.call(this,s,!0);var u,x="string"===r&amp;&amp;!1===a.binary&amp;&amp;!1===a.base64;i&amp;&amp;void 0!==i.binary||(a.binary=!x),(t instanceof d&amp;&amp;0===t.uncompressedSize||a.dir||!t||0===t.length)&amp;&amp;(a.base64=!1,a.binary=!0,t="",a.compression="STORE",r="string"),u=t instanceof d||t instanceof n?t:f.isNode&amp;&amp;f.isStream(t)?new c(e,t):o.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var g=new l(e,u,a);this.files[e]=g}var r=e("./utf8"),o=e("./utils"),n=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),h=e("./defaults"),d=e("./compressedObject"),l=e("./zipObject"),u=e("./generate"),f=e("./nodejsUtils"),c=e("./nodejs/NodejsStreamInputAdapter"),m=function(e){"/"===e.slice(-1)&amp;&amp;(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0&lt;t?e.substring(0,t):""},_=function(e){return"/"!==e.slice(-1)&amp;&amp;(e+="/"),e},p=function(e,t){return t=void 0!==t?t:h.createFolders,e=_(e),this.files[e]||s.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function x(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var g={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,s;for(t in this.files)this.files.hasOwnProperty(t)&amp;&amp;(s=this.files[t],(i=t.slice(this.root.length,t.length))&amp;&amp;t.slice(0,this.root.length)===this.root&amp;&amp;e(i,s))},filter:function(e){var t=[];return this.forEach((function(i,s){e(i,s)&amp;&amp;t.push(s)})),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,s.call(this,e,t,i),this;if(x(e)){var r=e;return this.filter((function(e,t){return!t.dir&amp;&amp;r.test(e)}))}var o=this.files[this.root+e];return o&amp;&amp;!o.dir?o:null},folder:function(e){if(!e)return this;if(x(e))return this.filter((function(t,i){return i.dir&amp;&amp;e.test(t)}));var t=this.root+e,i=p.call(this,t),s=this.clone();return s.root=i.name,s},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&amp;&amp;(e+="/"),t=this.files[e]),t&amp;&amp;!t.dir)delete this.files[e];else for(var i=this.filter((function(t,i){return i.name.slice(0,e.length)===e})),s=0;s&lt;i.length;s++)delete this.files[i[s].name];return this},generate:function(e){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=o.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&amp;&amp;(i.type="string"),!i.type)throw new Error("No output type specified.");o.checkSupport(i.type),"darwin"!==i.platform&amp;&amp;"freebsd"!==i.platform&amp;&amp;"linux"!==i.platform&amp;&amp;"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&amp;&amp;(i.platform="DOS");var s=i.comment||this.comment||"";t=u.generateWorker(this,i,s)}catch(e){(t=new n("error")).error(e)}return new a(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=g},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){"use strict";var s=e("./DataReader");function r(e){s.call(this,e);for(var t=0;t&lt;this.data.length;t++)e[t]=255&amp;e[t]}e("../utils").inherits(r,s),r.prototype.byteAt=function(e){return this.data[this.zero+e]},r.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),r=e.charCodeAt(3),o=this.length-4;0&lt;=o;--o)if(this.data[o]===t&amp;&amp;this.data[o+1]===i&amp;&amp;this.data[o+2]===s&amp;&amp;this.data[o+3]===r)return o-this.zero;return-1},r.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),r=e.charCodeAt(3),o=this.readData(4);return t===o[0]&amp;&amp;i===o[1]&amp;&amp;s===o[2]&amp;&amp;r===o[3]},r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){"use strict";var s=e("../utils");function r(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length&lt;this.zero+e||e&lt;0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(e){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t&gt;=this.index;t--)i=(i&lt;&lt;8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return s.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e&gt;&gt;25&amp;127),(e&gt;&gt;21&amp;15)-1,e&gt;&gt;16&amp;31,e&gt;&gt;11&amp;31,e&gt;&gt;5&amp;63,(31&amp;e)&lt;&lt;1))}},t.exports=r},{"../utils":32}],19:[function(e,t,i){"use strict";var s=e("./Uint8ArrayReader");function r(e){s.call(this,e)}e("../utils").inherits(r,s),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){"use strict";var s=e("./DataReader");function r(e){s.call(this,e)}e("../utils").inherits(r,s),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){"use strict";var s=e("./ArrayReader");function r(e){s.call(this,e)}e("../utils").inherits(r,s),r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){"use strict";var s=e("../utils"),r=e("../support"),o=e("./ArrayReader"),n=e("./StringReader"),a=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(e){var t=s.getTypeOf(e);return s.checkSupport(t),"string"!==t||r.uint8array?"nodebuffer"===t?new a(e):r.uint8array?new h(s.transformTo("uint8array",e)):new o(s.transformTo("array",e)):new n(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){"use strict";i.LOCAL_FILE_HEADER="PK\x03\x04",i.CENTRAL_FILE_HEADER="PK\x01\x02",i.CENTRAL_DIRECTORY_END="PK\x05\x06",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,i){"use strict";var s=e("./GenericWorker"),r=e("../utils");function o(e){s.call(this,"ConvertWorker to "+e),this.destType=e}r.inherits(o,s),o.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){"use strict";var s=e("./GenericWorker"),r=e("../crc32");function o(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,s),o.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){"use strict";var s=e("../utils"),r=e("./GenericWorker");function o(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}s.inherits(o,r),o.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}r.prototype.processChunk.call(this,e)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){"use strict";var s=e("../utils"),r=e("./GenericWorker");function o(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&amp;&amp;e.length||0,t.type=s.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}s.inherits(o,r),o.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&amp;&amp;(!this._tickScheduled&amp;&amp;this.dataIsReady&amp;&amp;(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index&gt;=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){"use strict";function s(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&amp;&amp;(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&amp;&amp;this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i&lt;this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),this},pause:function(){return!this.isPaused&amp;&amp;!this.isFinished&amp;&amp;(this.isPaused=!0,this.previous&amp;&amp;this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&amp;&amp;(this.error(this.generatedError),e=!0),this.previous&amp;&amp;this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(e)&amp;&amp;(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&amp;&amp;this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -&gt; "+e:e}},t.exports=s},{}],29:[function(e,i,s){"use strict";var r=e("../utils"),o=e("./ConvertWorker"),n=e("./GenericWorker"),a=e("../base64"),h=e("../support"),d=e("../external"),l=null;if(h.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function u(e,t,i){var s=t;switch(t){case"blob":case"arraybuffer":s="uint8array";break;case"base64":s="string"}try{this._internalType=s,this._outputType=t,this._mimeType=i,r.checkSupport(s),this._worker=e.pipe(new o(s)),e.lock()}catch(e){this._worker=new n("error"),this._worker.error(e)}}u.prototype={accumulate:function(e){return function(e,i){return new d.Promise((function(s,o){var n=[],h=e._internalType,d=e._outputType,l=e._mimeType;e.on("data",(function(e,t){n.push(e),i&amp;&amp;i(t)})).on("error",(function(e){n=[],o(e)})).on("end",(function(){try{var e=function(e,t,i){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),i);case"base64":return a.encode(t);default:return r.transformTo(e,t)}}(d,function(e,i){var s,r=0,o=null,n=0;for(s=0;s&lt;i.length;s++)n+=i[s].length;switch(e){case"string":return i.join("");case"array":return Array.prototype.concat.apply([],i);case"uint8array":for(o=new Uint8Array(n),s=0;s&lt;i.length;s++)o.set(i[s],r),r+=i[s].length;return o;case"nodebuffer":return t.concat(i);default:throw new Error("concat : unsupported type '"+e+"'")}}(h,n),l);s(e)}catch(e){o(e)}n=[]})).resume()}))}(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,(function(e){t.call(i,e.data,e.meta)})):this._worker.on(e,(function(){r.delay(t,arguments,i)})),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},i.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,i,s){"use strict";if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer="undefined"!=typeof ArrayBuffer&amp;&amp;"undefined"!=typeof Uint8Array,s.nodebuffer="undefined"!=typeof t,s.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)s.blob=!1;else{var r=new ArrayBuffer(0);try{s.blob=0===new Blob([r],{type:"application/zip"}).size}catch(e){try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(r),s.blob=0===o.getBlob("application/zip").size}catch(e){s.blob=!1}}}try{s.nodestream=!!e("readable-stream").Readable}catch(e){s.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){"use strict";for(var s=e("./utils"),r=e("./support"),o=e("./nodejsUtils"),n=e("./stream/GenericWorker"),a=new Array(256),h=0;h&lt;256;h++)a[h]=252&lt;=h?6:248&lt;=h?5:240&lt;=h?4:224&lt;=h?3:192&lt;=h?2:1;function d(){n.call(this,"utf-8 decode"),this.leftOver=null}function l(){n.call(this,"utf-8 encode")}a[254]=a[254]=1,i.utf8encode=function(e){return r.nodebuffer?o.newBufferFrom(e,"utf-8"):function(e){var t,i,s,o,n,a=e.length,h=0;for(o=0;o&lt;a;o++)55296==(64512&amp;(i=e.charCodeAt(o)))&amp;&amp;o+1&lt;a&amp;&amp;56320==(64512&amp;(s=e.charCodeAt(o+1)))&amp;&amp;(i=65536+(i-55296&lt;&lt;10)+(s-56320),o++),h+=i&lt;128?1:i&lt;2048?2:i&lt;65536?3:4;for(t=r.uint8array?new Uint8Array(h):new Array(h),o=n=0;n&lt;h;o++)55296==(64512&amp;(i=e.charCodeAt(o)))&amp;&amp;o+1&lt;a&amp;&amp;56320==(64512&amp;(s=e.charCodeAt(o+1)))&amp;&amp;(i=65536+(i-55296&lt;&lt;10)+(s-56320),o++),i&lt;128?t[n++]=i:(i&lt;2048?t[n++]=192|i&gt;&gt;&gt;6:(i&lt;65536?t[n++]=224|i&gt;&gt;&gt;12:(t[n++]=240|i&gt;&gt;&gt;18,t[n++]=128|i&gt;&gt;&gt;12&amp;63),t[n++]=128|i&gt;&gt;&gt;6&amp;63),t[n++]=128|63&amp;i);return t}(e)},i.utf8decode=function(e){return r.nodebuffer?s.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,r,o,n=e.length,h=new Array(2*n);for(t=i=0;t&lt;n;)if((r=e[t++])&lt;128)h[i++]=r;else if(4&lt;(o=a[r]))h[i++]=65533,t+=o-1;else{for(r&amp;=2===o?31:3===o?15:7;1&lt;o&amp;&amp;t&lt;n;)r=r&lt;&lt;6|63&amp;e[t++],o--;1&lt;o?h[i++]=65533:r&lt;65536?h[i++]=r:(r-=65536,h[i++]=55296|r&gt;&gt;10&amp;1023,h[i++]=56320|1023&amp;r)}return h.length!==i&amp;&amp;(h.subarray?h=h.subarray(0,i):h.length=i),s.applyFromCharCode(h)}(e=s.transformTo(r.uint8array?"uint8array":"array",e))},s.inherits(d,n),d.prototype.processChunk=function(e){var t=s.transformTo(r.uint8array?"uint8array":"array",e.data);if(this.leftOver&amp;&amp;this.leftOver.length){if(r.uint8array){var o=t;(t=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),t.set(o,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=function(e,t){var i;for((t=t||e.length)&gt;e.length&amp;&amp;(t=e.length),i=t-1;0&lt;=i&amp;&amp;128==(192&amp;e[i]);)i--;return i&lt;0||0===i?t:i+a[e[i]]&gt;t?i:t}(t),h=t;n!==t.length&amp;&amp;(r.uint8array?(h=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(h=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:i.utf8decode(h),meta:e.meta})},d.prototype.flush=function(){this.leftOver&amp;&amp;this.leftOver.length&amp;&amp;(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=d,s.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){"use strict";var s=e("./support"),r=e("./base64"),o=e("./nodejsUtils"),n=e("set-immediate-shim"),a=e("./external");function h(e){return e}function d(e,t){for(var i=0;i&lt;e.length;++i)t[i]=255&amp;e.charCodeAt(i);return t}i.newBlob=function(t,s){i.checkSupport("blob");try{return new Blob([t],{type:s})}catch(e){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(t),r.getBlob(s)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var s=[],r=0,o=e.length;if(o&lt;=i)return String.fromCharCode.apply(null,e);for(;r&lt;o;)"array"===t||"nodebuffer"===t?s.push(String.fromCharCode.apply(null,e.slice(r,Math.min(r+i,o)))):s.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+i,o)))),r+=i;return s.join("")},stringifyByChar:function(e){for(var t="",i=0;i&lt;e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&amp;&amp;1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return s.nodebuffer&amp;&amp;1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(e){return!1}}()}};function u(e){var t=65536,s=i.getTypeOf(e),r=!0;if("uint8array"===s?r=l.applyCanBeUsed.uint8array:"nodebuffer"===s&amp;&amp;(r=l.applyCanBeUsed.nodebuffer),r)for(;1&lt;t;)try{return l.stringifyByChunk(e,s,t)}catch(e){t=Math.floor(t/2)}return l.stringifyByChar(e)}function f(e,t){for(var i=0;i&lt;e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=u;var c={};c.string={string:h,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return c.string.uint8array(e).buffer},uint8array:function(e){return d(e,new Uint8Array(e.length))},nodebuffer:function(e){return d(e,o.allocBuffer(e.length))}},c.array={string:u,array:h,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(e)}},c.arraybuffer={string:function(e){return u(new Uint8Array(e))},array:function(e){return f(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:h,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(new Uint8Array(e))}},c.uint8array={string:u,array:function(e){return f(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:h,nodebuffer:function(e){return o.newBufferFrom(e)}},c.nodebuffer={string:u,array:function(e){return f(e,new Array(e.length))},arraybuffer:function(e){return c.nodebuffer.uint8array(e).buffer},uint8array:function(e){return f(e,new Uint8Array(e.length))},nodebuffer:h},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var s=i.getTypeOf(t);return c[s][e](t)},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":s.nodebuffer&amp;&amp;o.isBuffer(e)?"nodebuffer":s.uint8array&amp;&amp;e instanceof Uint8Array?"uint8array":s.arraybuffer&amp;&amp;e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!s[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,s="";for(i=0;i&lt;(e||"").length;i++)s+="\\x"+((t=e.charCodeAt(i))&lt;16?"0":"")+t.toString(16).toUpperCase();return s},i.delay=function(e,t,i){n((function(){e.apply(i||null,t||[])}))},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e&lt;arguments.length;e++)for(t in arguments[e])arguments[e].hasOwnProperty(t)&amp;&amp;void 0===i[t]&amp;&amp;(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,o,n,h){return a.Promise.resolve(t).then((function(e){return s.blob&amp;&amp;(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&amp;&amp;"undefined"!=typeof FileReader?new a.Promise((function(t,i){var s=new FileReader;s.onload=function(e){t(e.target.result)},s.onerror=function(e){i(e.target.error)},s.readAsArrayBuffer(e)})):e})).then((function(t){var l=i.getTypeOf(t);return l?("arraybuffer"===l?t=i.transformTo("uint8array",t):"string"===l&amp;&amp;(h?t=r.decode(t):o&amp;&amp;!0!==n&amp;&amp;(t=function(e){return d(e,s.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):a.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(e,t,i){"use strict";var s=e("./reader/readerFor"),r=e("./utils"),o=e("./signature"),n=e("./zipEntry"),a=(e("./utf8"),e("./support"));function h(e){this.files=[],this.loadOptions=e}h.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(t)+", expected "+r.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var s=this.reader.readString(4)===t;return this.reader.setIndex(i),s},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",i=r.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,i,s=this.zip64EndOfCentralSize-44;0&lt;s;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1&lt;this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e&lt;this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(e=new n({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&amp;&amp;0!==this.centralDirRecords&amp;&amp;0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(e&lt;0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))&lt;0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&amp;&amp;(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir&lt;0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&amp;&amp;(i+=20,i+=12+this.zip64EndOfCentralSize);var s=t-i;if(0&lt;s)this.isSignature(t,o.CENTRAL_FILE_HEADER)||(this.reader.zero=s);else if(s&lt;0)throw new Error("Corrupted zip: missing "+Math.abs(s)+" bytes.")},prepareReader:function(e){this.reader=s(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){"use strict";var s=e("./reader/readerFor"),r=e("./utils"),o=e("./compressedObject"),n=e("./crc32"),a=e("./utf8"),h=e("./compressions"),d=e("./support");function l(e,t){this.options=e,this.loadOptions=t}l.prototype={isEncrypted:function(){return 1==(1&amp;this.bitFlag)},useUTF8:function(){return 2048==(2048&amp;this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in h)if(h.hasOwnProperty(t)&amp;&amp;h[t].magic===e)return h[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy&gt;&gt;8;this.dir=!!(16&amp;this.externalFileAttributes),0==e&amp;&amp;(this.dosPermissions=63&amp;this.externalFileAttributes),3==e&amp;&amp;(this.unixPermissions=this.externalFileAttributes&gt;&gt;16&amp;65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=s(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&amp;&amp;(this.uncompressedSize=t.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&amp;&amp;(this.compressedSize=t.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&amp;&amp;(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&amp;&amp;(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,i,s,r=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index&lt;r;)t=e.readInt(2),i=e.readInt(2),s=e.readData(i),this.extraFields[t]={id:t,length:i,value:s}},handleUTF8:function(){var e=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=r.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var s=this.findExtraFieldUnicodeComment();if(null!==s)this.fileCommentStr=s;else{var o=r.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=s(e.value);return 1!==t.readInt(1)||n(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=s(e.value);return 1!==t.readInt(1)||n(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){"use strict";function s(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var r=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),n=e("./utf8"),a=e("./compressedObject"),h=e("./stream/GenericWorker");s.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var s="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&amp;&amp;"text"!==i||(i="string"),t=this._decompressWorker();var o=!this._dataBinary;o&amp;&amp;!s&amp;&amp;(t=t.pipe(new n.Utf8EncodeWorker)),!o&amp;&amp;s&amp;&amp;(t=t.pipe(new n.Utf8DecodeWorker))}catch(e){(t=new h("error")).error(e)}return new r(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&amp;&amp;this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new n.Utf8EncodeWorker)),a.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof h?this._data:new o(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u&lt;d.length;u++)s.prototype[d[u]]=l;t.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,s){(function(e){"use strict";var i,s,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var o=0,n=new r(l),a=e.document.createTextNode("");n.observe(a,{characterData:!0}),i=function(){a.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&amp;&amp;"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var h=new e.MessageChannel;h.port1.onmessage=l,i=function(){h.port2.postMessage(0)}}var d=[];function l(){var e,t;s=!0;for(var i=d.length;i;){for(t=d,d=[],e=-1;++e&lt;i;)t[e]();i=d.length}s=!1}t.exports=function(e){1!==d.push(e)||s||i()}}).call(this,"undefined"!=typeof i?i:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){"use strict";var s=e("immediate");function r(){}var o={},n=["REJECTED"],a=["FULFILLED"],h=["PENDING"];function d(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,e!==r&amp;&amp;c(this,e)}function l(e,t,i){this.promise=e,"function"==typeof t&amp;&amp;(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&amp;&amp;(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(e,t,i){s((function(){var s;try{s=t(i)}catch(s){return o.reject(e,s)}s===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,s)}))}function f(e){var t=e&amp;&amp;e.then;if(e&amp;&amp;("object"==typeof e||"function"==typeof e)&amp;&amp;"function"==typeof t)return function(){t.apply(e,arguments)}}function c(e,t){var i=!1;function s(t){i||(i=!0,o.reject(e,t))}function r(t){i||(i=!0,o.resolve(e,t))}var n=m((function(){t(r,s)}));"error"===n.status&amp;&amp;s(n.value)}function m(e,t){var i={};try{i.value=e(t),i.status="success"}catch(e){i.status="error",i.value=e}return i}(t.exports=d).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(i){return t.resolve(e()).then((function(){return i}))}),(function(i){return t.resolve(e()).then((function(){throw i}))}))},d.prototype.catch=function(e){return this.then(null,e)},d.prototype.then=function(e,t){if("function"!=typeof e&amp;&amp;this.state===a||"function"!=typeof t&amp;&amp;this.state===n)return this;var i=new this.constructor(r);return this.state!==h?u(i,this.state===a?e:t,this.outcome):this.queue.push(new l(i,e,t)),i},l.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){o.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},o.resolve=function(e,t){var i=m(f,t);if("error"===i.status)return o.reject(e,i.value);var s=i.value;if(s)c(e,s);else{e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r&lt;n;)e.queue[r].callFulfilled(t)}return e},o.reject=function(e,t){e.state=n,e.outcome=t;for(var i=-1,s=e.queue.length;++i&lt;s;)e.queue[i].callRejected(t);return e},d.resolve=function(e){return e instanceof this?e:o.resolve(new this(r),e)},d.reject=function(e){var t=new this(r);return o.reject(t,e)},d.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var n=new Array(i),a=0,h=-1,d=new this(r);++h&lt;i;)l(e[h],h);return d;function l(e,r){t.resolve(e).then((function(e){n[r]=e,++a!==i||s||(s=!0,o.resolve(d,n))}),(function(e){s||(s=!0,o.reject(d,e))}))}},d.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,i=!1;if(!t)return this.resolve([]);for(var s,n=-1,a=new this(r);++n&lt;t;)s=e[n],this.resolve(s).then((function(e){i||(i=!0,o.resolve(a,e))}),(function(e){i||(i=!0,o.reject(a,e))}));return a}},{immediate:36}],38:[function(e,t,i){"use strict";var s={};(0,e("./lib/utils/common").assign)(s,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){"use strict";var s=e("./zlib/deflate"),r=e("./utils/common"),o=e("./utils/strings"),n=e("./zlib/messages"),a=e("./zlib/zstream"),h=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=r.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&amp;&amp;0&lt;t.windowBits?t.windowBits=-t.windowBits:t.gzip&amp;&amp;0&lt;t.windowBits&amp;&amp;t.windowBits&lt;16&amp;&amp;(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(n[i]);if(t.header&amp;&amp;s.deflateSetHeader(this.strm,t.header),t.dictionary){var l;if(l="string"==typeof t.dictionary?o.string2buf(t.dictionary):"[object ArrayBuffer]"===h.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=s.deflateSetDictionary(this.strm,l)))throw new Error(n[i]);this._dict_set=!0}}function l(e,t){var i=new d(t);if(i.push(e,!0),i.err)throw i.msg||n[i.err];return i.result}d.prototype.push=function(e,t){var i,n,a=this.strm,d=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=o.string2buf(e):"[object ArrayBuffer]"===h.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&amp;&amp;(a.output=new r.Buf8(d),a.next_out=0,a.avail_out=d),1!==(i=s.deflate(a,n))&amp;&amp;0!==i)return this.onEnd(i),!(this.ended=!0);0!==a.avail_out&amp;&amp;(0!==a.avail_in||4!==n&amp;&amp;2!==n)||("string"===this.options.to?this.onData(o.buf2binstring(r.shrinkBuf(a.output,a.next_out))):this.onData(r.shrinkBuf(a.output,a.next_out)))}while((0&lt;a.avail_in||0===a.avail_out)&amp;&amp;1!==i);return 4===n?(i=s.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==n||(this.onEnd(0),!(a.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){0===e&amp;&amp;("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=d,i.deflate=l,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,l(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,l(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){"use strict";var s=e("./zlib/inflate"),r=e("./utils/common"),o=e("./utils/strings"),n=e("./zlib/constants"),a=e("./zlib/messages"),h=e("./zlib/zstream"),d=e("./zlib/gzheader"),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&amp;&amp;0&lt;=t.windowBits&amp;&amp;t.windowBits&lt;16&amp;&amp;(t.windowBits=-t.windowBits,0===t.windowBits&amp;&amp;(t.windowBits=-15)),!(0&lt;=t.windowBits&amp;&amp;t.windowBits&lt;16)||e&amp;&amp;e.windowBits||(t.windowBits+=32),15&lt;t.windowBits&amp;&amp;t.windowBits&lt;48&amp;&amp;0==(15&amp;t.windowBits)&amp;&amp;(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var i=s.inflateInit2(this.strm,t.windowBits);if(i!==n.Z_OK)throw new Error(a[i]);this.header=new d,s.inflateGetHeader(this.strm,this.header)}function f(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||a[i.err];return i.result}u.prototype.push=function(e,t){var i,a,h,d,u,f,c=this.strm,m=this.options.chunkSize,_=this.options.dictionary,p=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?n.Z_FINISH:n.Z_NO_FLUSH,"string"==typeof e?c.input=o.binstring2buf(e):"[object ArrayBuffer]"===l.call(e)?c.input=new Uint8Array(e):c.input=e,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&amp;&amp;(c.output=new r.Buf8(m),c.next_out=0,c.avail_out=m),(i=s.inflate(c,n.Z_NO_FLUSH))===n.Z_NEED_DICT&amp;&amp;_&amp;&amp;(f="string"==typeof _?o.string2buf(_):"[object ArrayBuffer]"===l.call(_)?new Uint8Array(_):_,i=s.inflateSetDictionary(this.strm,f)),i===n.Z_BUF_ERROR&amp;&amp;!0===p&amp;&amp;(i=n.Z_OK,p=!1),i!==n.Z_STREAM_END&amp;&amp;i!==n.Z_OK)return this.onEnd(i),!(this.ended=!0);c.next_out&amp;&amp;(0!==c.avail_out&amp;&amp;i!==n.Z_STREAM_END&amp;&amp;(0!==c.avail_in||a!==n.Z_FINISH&amp;&amp;a!==n.Z_SYNC_FLUSH)||("string"===this.options.to?(h=o.utf8border(c.output,c.next_out),d=c.next_out-h,u=o.buf2string(c.output,h),c.next_out=d,c.avail_out=m-d,d&amp;&amp;r.arraySet(c.output,c.output,h,d,0),this.onData(u)):this.onData(r.shrinkBuf(c.output,c.next_out)))),0===c.avail_in&amp;&amp;0===c.avail_out&amp;&amp;(p=!0)}while((0&lt;c.avail_in||0===c.avail_out)&amp;&amp;i!==n.Z_STREAM_END);return i===n.Z_STREAM_END&amp;&amp;(a=n.Z_FINISH),a===n.Z_FINISH?(i=s.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===n.Z_OK):a!==n.Z_SYNC_FLUSH||(this.onEnd(n.Z_OK),!(c.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===n.Z_OK&amp;&amp;("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=u,i.inflate=f,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},i.ungzip=f},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){"use strict";var s="undefined"!=typeof Uint8Array&amp;&amp;"undefined"!=typeof Uint16Array&amp;&amp;"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var s in i)i.hasOwnProperty(s)&amp;&amp;(e[s]=i[s])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,i,s,r){if(t.subarray&amp;&amp;e.subarray)e.set(t.subarray(i,i+s),r);else for(var o=0;o&lt;s;o++)e[r+o]=t[i+o]},flattenChunks:function(e){var t,i,s,r,o,n;for(t=s=0,i=e.length;t&lt;i;t++)s+=e[t].length;for(n=new Uint8Array(s),t=r=0,i=e.length;t&lt;i;t++)o=e[t],n.set(o,r),r+=o.length;return n}},o={arraySet:function(e,t,i,s,r){for(var o=0;o&lt;s;o++)e[r+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,r)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(s)},{}],42:[function(e,t,i){"use strict";var s=e("./common"),r=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(e){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=!1}for(var n=new s.Buf8(256),a=0;a&lt;256;a++)n[a]=252&lt;=a?6:248&lt;=a?5:240&lt;=a?4:224&lt;=a?3:192&lt;=a?2:1;function h(e,t){if(t&lt;65537&amp;&amp;(e.subarray&amp;&amp;o||!e.subarray&amp;&amp;r))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var i="",n=0;n&lt;t;n++)i+=String.fromCharCode(e[n]);return i}n[254]=n[254]=1,i.string2buf=function(e){var t,i,r,o,n,a=e.length,h=0;for(o=0;o&lt;a;o++)55296==(64512&amp;(i=e.charCodeAt(o)))&amp;&amp;o+1&lt;a&amp;&amp;56320==(64512&amp;(r=e.charCodeAt(o+1)))&amp;&amp;(i=65536+(i-55296&lt;&lt;10)+(r-56320),o++),h+=i&lt;128?1:i&lt;2048?2:i&lt;65536?3:4;for(t=new s.Buf8(h),o=n=0;n&lt;h;o++)55296==(64512&amp;(i=e.charCodeAt(o)))&amp;&amp;o+1&lt;a&amp;&amp;56320==(64512&amp;(r=e.charCodeAt(o+1)))&amp;&amp;(i=65536+(i-55296&lt;&lt;10)+(r-56320),o++),i&lt;128?t[n++]=i:(i&lt;2048?t[n++]=192|i&gt;&gt;&gt;6:(i&lt;65536?t[n++]=224|i&gt;&gt;&gt;12:(t[n++]=240|i&gt;&gt;&gt;18,t[n++]=128|i&gt;&gt;&gt;12&amp;63),t[n++]=128|i&gt;&gt;&gt;6&amp;63),t[n++]=128|63&amp;i);return t},i.buf2binstring=function(e){return h(e,e.length)},i.binstring2buf=function(e){for(var t=new s.Buf8(e.length),i=0,r=t.length;i&lt;r;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,s,r,o,a=t||e.length,d=new Array(2*a);for(i=s=0;i&lt;a;)if((r=e[i++])&lt;128)d[s++]=r;else if(4&lt;(o=n[r]))d[s++]=65533,i+=o-1;else{for(r&amp;=2===o?31:3===o?15:7;1&lt;o&amp;&amp;i&lt;a;)r=r&lt;&lt;6|63&amp;e[i++],o--;1&lt;o?d[s++]=65533:r&lt;65536?d[s++]=r:(r-=65536,d[s++]=55296|r&gt;&gt;10&amp;1023,d[s++]=56320|1023&amp;r)}return h(d,s)},i.utf8border=function(e,t){var i;for((t=t||e.length)&gt;e.length&amp;&amp;(t=e.length),i=t-1;0&lt;=i&amp;&amp;128==(192&amp;e[i]);)i--;return i&lt;0||0===i?t:i+n[e[i]]&gt;t?i:t}},{"./common":41}],43:[function(e,t,i){"use strict";t.exports=function(e,t,i,s){for(var r=65535&amp;e|0,o=e&gt;&gt;&gt;16&amp;65535|0,n=0;0!==i;){for(i-=n=2e3&lt;i?2e3:i;o=o+(r=r+t[s++]|0)|0,--n;);r%=65521,o%=65521}return r|o&lt;&lt;16|0}},{}],44:[function(e,t,i){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,i){"use strict";var s=function(){for(var e,t=[],i=0;i&lt;256;i++){e=i;for(var s=0;s&lt;8;s++)e=1&amp;e?3988292384^e&gt;&gt;&gt;1:e&gt;&gt;&gt;1;t[i]=e}return t}();t.exports=function(e,t,i,r){var o=s,n=r+i;e^=-1;for(var a=r;a&lt;n;a++)e=e&gt;&gt;&gt;8^o[255&amp;(e^t[a])];return-1^e}},{}],46:[function(e,t,i){"use strict";var s,r=e("../utils/common"),o=e("./trees"),n=e("./adler32"),a=e("./crc32"),h=e("./messages"),d=-2,l=258,u=262,f=113;function c(e,t){return e.msg=h[t],t}function m(e){return(e&lt;&lt;1)-(4&lt;e?9:0)}function _(e){for(var t=e.length;0&lt;=--t;)e[t]=0}function p(e){var t=e.state,i=t.pending;i&gt;e.avail_out&amp;&amp;(i=e.avail_out),0!==i&amp;&amp;(r.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&amp;&amp;(t.pending_out=0))}function x(e,t){o._tr_flush_block(e,0&lt;=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,p(e.strm)}function g(e,t){e.pending_buf[e.pending++]=t}function v(e,t){e.pending_buf[e.pending++]=t&gt;&gt;&gt;8&amp;255,e.pending_buf[e.pending++]=255&amp;t}function y(e,t){var i,s,r=e.max_chain_length,o=e.strstart,n=e.prev_length,a=e.nice_match,h=e.strstart&gt;e.w_size-u?e.strstart-(e.w_size-u):0,d=e.window,f=e.w_mask,c=e.prev,m=e.strstart+l,_=d[o+n-1],p=d[o+n];e.prev_length&gt;=e.good_match&amp;&amp;(r&gt;&gt;=2),a&gt;e.lookahead&amp;&amp;(a=e.lookahead);do{if(d[(i=t)+n]===p&amp;&amp;d[i+n-1]===_&amp;&amp;d[i]===d[o]&amp;&amp;d[++i]===d[o+1]){o+=2,i++;do{}while(d[++o]===d[++i]&amp;&amp;d[++o]===d[++i]&amp;&amp;d[++o]===d[++i]&amp;&amp;d[++o]===d[++i]&amp;&amp;d[++o]===d[++i]&amp;&amp;d[++o]===d[++i]&amp;&amp;d[++o]===d[++i]&amp;&amp;d[++o]===d[++i]&amp;&amp;o&lt;m);if(s=l-(m-o),o=m-l,n&lt;s){if(e.match_start=t,a&lt;=(n=s))break;_=d[o+n-1],p=d[o+n]}}}while((t=c[t&amp;f])&gt;h&amp;&amp;0!=--r);return n&lt;=e.lookahead?n:e.lookahead}function b(e){var t,i,s,o,h,d,l,f,c,m,_=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart&gt;=_+(_-u)){for(r.arraySet(e.window,e.window,_,_,0),e.match_start-=_,e.strstart-=_,e.block_start-=_,t=i=e.hash_size;s=e.head[--t],e.head[t]=_&lt;=s?s-_:0,--i;);for(t=i=_;s=e.prev[--t],e.prev[t]=_&lt;=s?s-_:0,--i;);o+=_}if(0===e.strm.avail_in)break;if(d=e.strm,l=e.window,f=e.strstart+e.lookahead,m=void 0,(c=o)&lt;(m=d.avail_in)&amp;&amp;(m=c),i=0===m?0:(d.avail_in-=m,r.arraySet(l,d.input,d.next_in,m,f),1===d.state.wrap?d.adler=n(d.adler,l,m,f):2===d.state.wrap&amp;&amp;(d.adler=a(d.adler,l,m,f)),d.next_in+=m,d.total_in+=m,m),e.lookahead+=i,e.lookahead+e.insert&gt;=3)for(h=e.strstart-e.insert,e.ins_h=e.window[h],e.ins_h=(e.ins_h&lt;&lt;e.hash_shift^e.window[h+1])&amp;e.hash_mask;e.insert&amp;&amp;(e.ins_h=(e.ins_h&lt;&lt;e.hash_shift^e.window[h+3-1])&amp;e.hash_mask,e.prev[h&amp;e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=h,h++,e.insert--,!(e.lookahead+e.insert&lt;3)););}while(e.lookahead&lt;u&amp;&amp;0!==e.strm.avail_in)}function T(e,t){for(var i,s;;){if(e.lookahead&lt;u){if(b(e),e.lookahead&lt;u&amp;&amp;0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead&gt;=3&amp;&amp;(e.ins_h=(e.ins_h&lt;&lt;e.hash_shift^e.window[e.strstart+3-1])&amp;e.hash_mask,i=e.prev[e.strstart&amp;e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&amp;&amp;e.strstart-i&lt;=e.w_size-u&amp;&amp;(e.match_length=y(e,i)),e.match_length&gt;=3)if(s=o._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length&lt;=e.max_lazy_match&amp;&amp;e.lookahead&gt;=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h&lt;&lt;e.hash_shift^e.window[e.strstart+3-1])&amp;e.hash_mask,i=e.prev[e.strstart&amp;e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h&lt;&lt;e.hash_shift^e.window[e.strstart+1])&amp;e.hash_mask;else s=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&amp;&amp;(x(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart&lt;2?e.strstart:2,4===t?(x(e,!0),0===e.strm.avail_out?3:4):e.last_lit&amp;&amp;(x(e,!1),0===e.strm.avail_out)?1:2}function S(e,t){for(var i,s,r;;){if(e.lookahead&lt;u){if(b(e),e.lookahead&lt;u&amp;&amp;0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead&gt;=3&amp;&amp;(e.ins_h=(e.ins_h&lt;&lt;e.hash_shift^e.window[e.strstart+3-1])&amp;e.hash_mask,i=e.prev[e.strstart&amp;e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&amp;&amp;e.prev_length&lt;e.max_lazy_match&amp;&amp;e.strstart-i&lt;=e.w_size-u&amp;&amp;(e.match_length=y(e,i),e.match_length&lt;=5&amp;&amp;(1===e.strategy||3===e.match_length&amp;&amp;4096&lt;e.strstart-e.match_start)&amp;&amp;(e.match_length=2)),e.prev_length&gt;=3&amp;&amp;e.match_length&lt;=e.prev_length){for(r=e.strstart+e.lookahead-3,s=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart&lt;=r&amp;&amp;(e.ins_h=(e.ins_h&lt;&lt;e.hash_shift^e.window[e.strstart+3-1])&amp;e.hash_mask,i=e.prev[e.strstart&amp;e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,s&amp;&amp;(x(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((s=o._tr_tally(e,0,e.window[e.strstart-1]))&amp;&amp;x(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&amp;&amp;(s=o._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart&lt;2?e.strstart:2,4===t?(x(e,!0),0===e.strm.avail_out?3:4):e.last_lit&amp;&amp;(x(e,!1),0===e.strm.avail_out)?1:2}function w(e,t,i,s,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=r}function M(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(1146),this.dyn_dtree=new r.Buf16(122),this.bl_tree=new r.Buf16(78),_(this.dyn_ltree),_(this.dyn_dtree),_(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(16),this.heap=new r.Buf16(573),_(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(573),_(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E(e){var t;return e&amp;&amp;e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap&lt;0&amp;&amp;(t.wrap=-t.wrap),t.status=t.wrap?42:f,e.adler=2===t.wrap?0:1,t.last_flush=0,o._tr_init(t),0):c(e,d)}function F(e){var t=E(e);return 0===t&amp;&amp;function(e){e.window_size=2*e.w_size,_(e.head),e.max_lazy_match=s[e.level].max_lazy,e.good_match=s[e.level].good_length,e.nice_match=s[e.level].nice_length,e.max_chain_length=s[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function C(e,t,i,s,o,n){if(!e)return d;var a=1;if(-1===t&amp;&amp;(t=6),s&lt;0?(a=0,s=-s):15&lt;s&amp;&amp;(a=2,s-=16),o&lt;1||9&lt;o||8!==i||s&lt;8||15&lt;s||t&lt;0||9&lt;t||n&lt;0||4&lt;n)return c(e,d);8===s&amp;&amp;(s=9);var h=new M;return(e.state=h).strm=e,h.wrap=a,h.gzhead=null,h.w_bits=s,h.w_size=1&lt;&lt;h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=o+7,h.hash_size=1&lt;&lt;h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+3-1)/3),h.window=new r.Buf8(2*h.w_size),h.head=new r.Buf16(h.hash_size),h.prev=new r.Buf16(h.w_size),h.lit_bufsize=1&lt;&lt;o+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new r.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=t,h.strategy=n,h.method=i,F(e)}s=[new w(0,0,0,0,(function(e,t){var i=65535;for(i&gt;e.pending_buf_size-5&amp;&amp;(i=e.pending_buf_size-5);;){if(e.lookahead&lt;=1){if(b(e),0===e.lookahead&amp;&amp;0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var s=e.block_start+i;if((0===e.strstart||e.strstart&gt;=s)&amp;&amp;(e.lookahead=e.strstart-s,e.strstart=s,x(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start&gt;=e.w_size-u&amp;&amp;(x(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(x(e,!0),0===e.strm.avail_out?3:4):(e.strstart&gt;e.block_start&amp;&amp;(x(e,!1),e.strm.avail_out),1)})),new w(4,4,8,4,T),new w(4,5,16,8,T),new w(4,6,32,32,T),new w(4,4,16,16,S),new w(8,16,32,32,S),new w(8,16,128,128,S),new w(8,32,128,256,S),new w(32,128,258,1024,S),new w(32,258,258,4096,S)],i.deflateInit=function(e,t){return C(e,t,8,15,8,0)},i.deflateInit2=C,i.deflateReset=F,i.deflateResetKeep=E,i.deflateSetHeader=function(e,t){return e&amp;&amp;e.state?2!==e.state.wrap?d:(e.state.gzhead=t,0):d},i.deflate=function(e,t){var i,r,n,h;if(!e||!e.state||5&lt;t||t&lt;0)return e?c(e,d):d;if(r=e.state,!e.output||!e.input&amp;&amp;0!==e.avail_in||666===r.status&amp;&amp;4!==t)return c(e,0===e.avail_out?-5:d);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,g(r,31),g(r,139),g(r,8),r.gzhead?(g(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),g(r,255&amp;r.gzhead.time),g(r,r.gzhead.time&gt;&gt;8&amp;255),g(r,r.gzhead.time&gt;&gt;16&amp;255),g(r,r.gzhead.time&gt;&gt;24&amp;255),g(r,9===r.level?2:2&lt;=r.strategy||r.level&lt;2?4:0),g(r,255&amp;r.gzhead.os),r.gzhead.extra&amp;&amp;r.gzhead.extra.length&amp;&amp;(g(r,255&amp;r.gzhead.extra.length),g(r,r.gzhead.extra.length&gt;&gt;8&amp;255)),r.gzhead.hcrc&amp;&amp;(e.adler=a(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(g(r,0),g(r,0),g(r,0),g(r,0),g(r,0),g(r,9===r.level?2:2&lt;=r.strategy||r.level&lt;2?4:0),g(r,3),r.status=f);else{var u=8+(r.w_bits-8&lt;&lt;4)&lt;&lt;8;u|=(2&lt;=r.strategy||r.level&lt;2?0:r.level&lt;6?1:6===r.level?2:3)&lt;&lt;6,0!==r.strstart&amp;&amp;(u|=32),u+=31-u%31,r.status=f,v(r,u),0!==r.strstart&amp;&amp;(v(r,e.adler&gt;&gt;&gt;16),v(r,65535&amp;e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex&lt;(65535&amp;r.gzhead.extra.length)&amp;&amp;(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&amp;&amp;r.pending&gt;n&amp;&amp;(e.adler=a(e.adler,r.pending_buf,r.pending-n,n)),p(e),n=r.pending,r.pending!==r.pending_buf_size));)g(r,255&amp;r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&amp;&amp;r.pending&gt;n&amp;&amp;(e.adler=a(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&amp;&amp;(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&amp;&amp;(r.gzhead.hcrc&amp;&amp;r.pending&gt;n&amp;&amp;(e.adler=a(e.adler,r.pending_buf,r.pending-n,n)),p(e),n=r.pending,r.pending===r.pending_buf_size)){h=1;break}h=r.gzindex&lt;r.gzhead.name.length?255&amp;r.gzhead.name.charCodeAt(r.gzindex++):0,g(r,h)}while(0!==h);r.gzhead.hcrc&amp;&amp;r.pending&gt;n&amp;&amp;(e.adler=a(e.adler,r.pending_buf,r.pending-n,n)),0===h&amp;&amp;(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&amp;&amp;(r.gzhead.hcrc&amp;&amp;r.pending&gt;n&amp;&amp;(e.adler=a(e.adler,r.pending_buf,r.pending-n,n)),p(e),n=r.pending,r.pending===r.pending_buf_size)){h=1;break}h=r.gzindex&lt;r.gzhead.comment.length?255&amp;r.gzhead.comment.charCodeAt(r.gzindex++):0,g(r,h)}while(0!==h);r.gzhead.hcrc&amp;&amp;r.pending&gt;n&amp;&amp;(e.adler=a(e.adler,r.pending_buf,r.pending-n,n)),0===h&amp;&amp;(r.status=103)}else r.status=103;if(103===r.status&amp;&amp;(r.gzhead.hcrc?(r.pending+2&gt;r.pending_buf_size&amp;&amp;p(e),r.pending+2&lt;=r.pending_buf_size&amp;&amp;(g(r,255&amp;e.adler),g(r,e.adler&gt;&gt;8&amp;255),e.adler=0,r.status=f)):r.status=f),0!==r.pending){if(p(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&amp;&amp;m(t)&lt;=m(i)&amp;&amp;4!==t)return c(e,-5);if(666===r.status&amp;&amp;0!==e.avail_in)return c(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&amp;&amp;666!==r.status){var y=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&amp;&amp;(b(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&amp;&amp;(x(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(x(e,!0),0===e.strm.avail_out?3:4):e.last_lit&amp;&amp;(x(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,s,r,n,a=e.window;;){if(e.lookahead&lt;=l){if(b(e),e.lookahead&lt;=l&amp;&amp;0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead&gt;=3&amp;&amp;0&lt;e.strstart&amp;&amp;(s=a[r=e.strstart-1])===a[++r]&amp;&amp;s===a[++r]&amp;&amp;s===a[++r]){n=e.strstart+l;do{}while(s===a[++r]&amp;&amp;s===a[++r]&amp;&amp;s===a[++r]&amp;&amp;s===a[++r]&amp;&amp;s===a[++r]&amp;&amp;s===a[++r]&amp;&amp;s===a[++r]&amp;&amp;s===a[++r]&amp;&amp;r&lt;n);e.match_length=l-(n-r),e.match_length&gt;e.lookahead&amp;&amp;(e.match_length=e.lookahead)}if(e.match_length&gt;=3?(i=o._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&amp;&amp;(x(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(x(e,!0),0===e.strm.avail_out?3:4):e.last_lit&amp;&amp;(x(e,!1),0===e.strm.avail_out)?1:2}(r,t):s[r.level].func(r,t);if(3!==y&amp;&amp;4!==y||(r.status=666),1===y||3===y)return 0===e.avail_out&amp;&amp;(r.last_flush=-1),0;if(2===y&amp;&amp;(1===t?o._tr_align(r):5!==t&amp;&amp;(o._tr_stored_block(r,0,0,!1),3===t&amp;&amp;(_(r.head),0===r.lookahead&amp;&amp;(r.strstart=0,r.block_start=0,r.insert=0))),p(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap&lt;=0?1:(2===r.wrap?(g(r,255&amp;e.adler),g(r,e.adler&gt;&gt;8&amp;255),g(r,e.adler&gt;&gt;16&amp;255),g(r,e.adler&gt;&gt;24&amp;255),g(r,255&amp;e.total_in),g(r,e.total_in&gt;&gt;8&amp;255),g(r,e.total_in&gt;&gt;16&amp;255),g(r,e.total_in&gt;&gt;24&amp;255)):(v(r,e.adler&gt;&gt;&gt;16),v(r,65535&amp;e.adler)),p(e),0&lt;r.wrap&amp;&amp;(r.wrap=-r.wrap),0!==r.pending?0:1)},i.deflateEnd=function(e){var t;return e&amp;&amp;e.state?42!==(t=e.state.status)&amp;&amp;69!==t&amp;&amp;73!==t&amp;&amp;91!==t&amp;&amp;103!==t&amp;&amp;t!==f&amp;&amp;666!==t?c(e,d):(e.state=null,t===f?c(e,-3):0):d},i.deflateSetDictionary=function(e,t){var i,s,o,a,h,l,u,f,c=t.length;if(!e||!e.state)return d;if(2===(a=(i=e.state).wrap)||1===a&amp;&amp;42!==i.status||i.lookahead)return d;for(1===a&amp;&amp;(e.adler=n(e.adler,t,c,0)),i.wrap=0,c&gt;=i.w_size&amp;&amp;(0===a&amp;&amp;(_(i.head),i.strstart=0,i.block_start=0,i.insert=0),f=new r.Buf8(i.w_size),r.arraySet(f,t,c-i.w_size,i.w_size,0),t=f,c=i.w_size),h=e.avail_in,l=e.next_in,u=e.input,e.avail_in=c,e.next_in=0,e.input=t,b(i);i.lookahead&gt;=3;){for(s=i.strstart,o=i.lookahead-2;i.ins_h=(i.ins_h&lt;&lt;i.hash_shift^i.window[s+3-1])&amp;i.hash_mask,i.prev[s&amp;i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=s,s++,--o;);i.strstart=s,i.lookahead=2,b(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=l,e.input=u,e.avail_in=h,i.wrap=a,0},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,i){"use strict";t.exports=function(e,t){var i,s,r,o,n,a,h,d,l,u,f,c,m,_,p,x,g,v,y,b,T,S,w,M,E;i=e.state,s=e.next_in,M=e.input,r=s+(e.avail_in-5),o=e.next_out,E=e.output,n=o-(t-e.avail_out),a=o+(e.avail_out-257),h=i.dmax,d=i.wsize,l=i.whave,u=i.wnext,f=i.window,c=i.hold,m=i.bits,_=i.lencode,p=i.distcode,x=(1&lt;&lt;i.lenbits)-1,g=(1&lt;&lt;i.distbits)-1;e:do{m&lt;15&amp;&amp;(c+=M[s++]&lt;&lt;m,m+=8,c+=M[s++]&lt;&lt;m,m+=8),v=_[c&amp;x];t:for(;;){if(c&gt;&gt;&gt;=y=v&gt;&gt;&gt;24,m-=y,0===(y=v&gt;&gt;&gt;16&amp;255))E[o++]=65535&amp;v;else{if(!(16&amp;y)){if(0==(64&amp;y)){v=_[(65535&amp;v)+(c&amp;(1&lt;&lt;y)-1)];continue t}if(32&amp;y){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}b=65535&amp;v,(y&amp;=15)&amp;&amp;(m&lt;y&amp;&amp;(c+=M[s++]&lt;&lt;m,m+=8),b+=c&amp;(1&lt;&lt;y)-1,c&gt;&gt;&gt;=y,m-=y),m&lt;15&amp;&amp;(c+=M[s++]&lt;&lt;m,m+=8,c+=M[s++]&lt;&lt;m,m+=8),v=p[c&amp;g];i:for(;;){if(c&gt;&gt;&gt;=y=v&gt;&gt;&gt;24,m-=y,!(16&amp;(y=v&gt;&gt;&gt;16&amp;255))){if(0==(64&amp;y)){v=p[(65535&amp;v)+(c&amp;(1&lt;&lt;y)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(T=65535&amp;v,m&lt;(y&amp;=15)&amp;&amp;(c+=M[s++]&lt;&lt;m,(m+=8)&lt;y&amp;&amp;(c+=M[s++]&lt;&lt;m,m+=8)),h&lt;(T+=c&amp;(1&lt;&lt;y)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(c&gt;&gt;&gt;=y,m-=y,(y=o-n)&lt;T){if(l&lt;(y=T-y)&amp;&amp;i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(w=f,(S=0)===u){if(S+=d-y,y&lt;b){for(b-=y;E[o++]=f[S++],--y;);S=o-T,w=E}}else if(u&lt;y){if(S+=d+u-y,(y-=u)&lt;b){for(b-=y;E[o++]=f[S++],--y;);if(S=0,u&lt;b){for(b-=y=u;E[o++]=f[S++],--y;);S=o-T,w=E}}}else if(S+=u-y,y&lt;b){for(b-=y;E[o++]=f[S++],--y;);S=o-T,w=E}for(;2&lt;b;)E[o++]=w[S++],E[o++]=w[S++],E[o++]=w[S++],b-=3;b&amp;&amp;(E[o++]=w[S++],1&lt;b&amp;&amp;(E[o++]=w[S++]))}else{for(S=o-T;E[o++]=E[S++],E[o++]=E[S++],E[o++]=E[S++],2&lt;(b-=3););b&amp;&amp;(E[o++]=E[S++],1&lt;b&amp;&amp;(E[o++]=E[S++]))}break}}break}}while(s&lt;r&amp;&amp;o&lt;a);s-=b=m&gt;&gt;3,c&amp;=(1&lt;&lt;(m-=b&lt;&lt;3))-1,e.next_in=s,e.next_out=o,e.avail_in=s&lt;r?r-s+5:5-(s-r),e.avail_out=o&lt;a?a-o+257:257-(o-a),i.hold=c,i.bits=m}},{}],49:[function(e,t,i){"use strict";var s=e("../utils/common"),r=e("./adler32"),o=e("./crc32"),n=e("./inffast"),a=e("./inftrees"),h=-2;function d(e){return(e&gt;&gt;&gt;24&amp;255)+(e&gt;&gt;&gt;8&amp;65280)+((65280&amp;e)&lt;&lt;8)+((255&amp;e)&lt;&lt;24)}function l(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(e){var t;return e&amp;&amp;e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&amp;&amp;(e.adler=1&amp;t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(852),t.distcode=t.distdyn=new s.Buf32(592),t.sane=1,t.back=-1,0):h}function f(e){var t;return e&amp;&amp;e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):h}function c(e,t){var i,s;return e&amp;&amp;e.state?(s=e.state,t&lt;0?(i=0,t=-t):(i=1+(t&gt;&gt;4),t&lt;48&amp;&amp;(t&amp;=15)),t&amp;&amp;(t&lt;8||15&lt;t)?h:(null!==s.window&amp;&amp;s.wbits!==t&amp;&amp;(s.window=null),s.wrap=i,s.wbits=t,f(e))):h}function m(e,t){var i,s;return e?(s=new l,(e.state=s).window=null,0!==(i=c(e,t))&amp;&amp;(e.state=null),i):h}var _,p,x=!0;function g(e){if(x){var t;for(_=new s.Buf32(512),p=new s.Buf32(32),t=0;t&lt;144;)e.lens[t++]=8;for(;t&lt;256;)e.lens[t++]=9;for(;t&lt;280;)e.lens[t++]=7;for(;t&lt;288;)e.lens[t++]=8;for(a(1,e.lens,0,288,_,0,e.work,{bits:9}),t=0;t&lt;32;)e.lens[t++]=5;a(2,e.lens,0,32,p,0,e.work,{bits:5}),x=!1}e.lencode=_,e.lenbits=9,e.distcode=p,e.distbits=5}function v(e,t,i,r){var o,n=e.state;return null===n.window&amp;&amp;(n.wsize=1&lt;&lt;n.wbits,n.wnext=0,n.whave=0,n.window=new s.Buf8(n.wsize)),r&gt;=n.wsize?(s.arraySet(n.window,t,i-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(r&lt;(o=n.wsize-n.wnext)&amp;&amp;(o=r),s.arraySet(n.window,t,i-r,o,n.wnext),(r-=o)?(s.arraySet(n.window,t,i-r,r,0),n.wnext=r,n.whave=n.wsize):(n.wnext+=o,n.wnext===n.wsize&amp;&amp;(n.wnext=0),n.whave&lt;n.wsize&amp;&amp;(n.whave+=o))),0}i.inflateReset=f,i.inflateReset2=c,i.inflateResetKeep=u,i.inflateInit=function(e){return m(e,15)},i.inflateInit2=m,i.inflate=function(e,t){var i,l,u,f,c,m,_,p,x,y,b,T,S,w,M,E,F,C,A,R,I,N,P,D,V=0,L=new s.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&amp;&amp;0!==e.avail_in)return h;12===(i=e.state).mode&amp;&amp;(i.mode=13),c=e.next_out,u=e.output,_=e.avail_out,f=e.next_in,l=e.input,m=e.avail_in,p=i.hold,x=i.bits,y=m,b=_,N=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;x&lt;16;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(2&amp;i.wrap&amp;&amp;35615===p){L[i.check=0]=255&amp;p,L[1]=p&gt;&gt;&gt;8&amp;255,i.check=o(i.check,L,2,0),x=p=0,i.mode=2;break}if(i.flags=0,i.head&amp;&amp;(i.head.done=!1),!(1&amp;i.wrap)||(((255&amp;p)&lt;&lt;8)+(p&gt;&gt;8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&amp;p)){e.msg="unknown compression method",i.mode=30;break}if(x-=4,I=8+(15&amp;(p&gt;&gt;&gt;=4)),0===i.wbits)i.wbits=I;else if(I&gt;i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1&lt;&lt;I,e.adler=i.check=1,i.mode=512&amp;p?10:12,x=p=0;break;case 2:for(;x&lt;16;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(i.flags=p,8!=(255&amp;i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&amp;i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&amp;&amp;(i.head.text=p&gt;&gt;8&amp;1),512&amp;i.flags&amp;&amp;(L[0]=255&amp;p,L[1]=p&gt;&gt;&gt;8&amp;255,i.check=o(i.check,L,2,0)),x=p=0,i.mode=3;case 3:for(;x&lt;32;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}i.head&amp;&amp;(i.head.time=p),512&amp;i.flags&amp;&amp;(L[0]=255&amp;p,L[1]=p&gt;&gt;&gt;8&amp;255,L[2]=p&gt;&gt;&gt;16&amp;255,L[3]=p&gt;&gt;&gt;24&amp;255,i.check=o(i.check,L,4,0)),x=p=0,i.mode=4;case 4:for(;x&lt;16;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}i.head&amp;&amp;(i.head.xflags=255&amp;p,i.head.os=p&gt;&gt;8),512&amp;i.flags&amp;&amp;(L[0]=255&amp;p,L[1]=p&gt;&gt;&gt;8&amp;255,i.check=o(i.check,L,2,0)),x=p=0,i.mode=5;case 5:if(1024&amp;i.flags){for(;x&lt;16;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}i.length=p,i.head&amp;&amp;(i.head.extra_len=p),512&amp;i.flags&amp;&amp;(L[0]=255&amp;p,L[1]=p&gt;&gt;&gt;8&amp;255,i.check=o(i.check,L,2,0)),x=p=0}else i.head&amp;&amp;(i.head.extra=null);i.mode=6;case 6:if(1024&amp;i.flags&amp;&amp;(m&lt;(T=i.length)&amp;&amp;(T=m),T&amp;&amp;(i.head&amp;&amp;(I=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),s.arraySet(i.head.extra,l,f,T,I)),512&amp;i.flags&amp;&amp;(i.check=o(i.check,l,T,f)),m-=T,f+=T,i.length-=T),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&amp;i.flags){if(0===m)break e;for(T=0;I=l[f+T++],i.head&amp;&amp;I&amp;&amp;i.length&lt;65536&amp;&amp;(i.head.name+=String.fromCharCode(I)),I&amp;&amp;T&lt;m;);if(512&amp;i.flags&amp;&amp;(i.check=o(i.check,l,T,f)),m-=T,f+=T,I)break e}else i.head&amp;&amp;(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&amp;i.flags){if(0===m)break e;for(T=0;I=l[f+T++],i.head&amp;&amp;I&amp;&amp;i.length&lt;65536&amp;&amp;(i.head.comment+=String.fromCharCode(I)),I&amp;&amp;T&lt;m;);if(512&amp;i.flags&amp;&amp;(i.check=o(i.check,l,T,f)),m-=T,f+=T,I)break e}else i.head&amp;&amp;(i.head.comment=null);i.mode=9;case 9:if(512&amp;i.flags){for(;x&lt;16;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(p!==(65535&amp;i.check)){e.msg="header crc mismatch",i.mode=30;break}x=p=0}i.head&amp;&amp;(i.head.hcrc=i.flags&gt;&gt;9&amp;1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;x&lt;32;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}e.adler=i.check=d(p),x=p=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=c,e.avail_out=_,e.next_in=f,e.avail_in=m,i.hold=p,i.bits=x,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){p&gt;&gt;&gt;=7&amp;x,x-=7&amp;x,i.mode=27;break}for(;x&lt;3;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}switch(i.last=1&amp;p,x-=1,3&amp;(p&gt;&gt;&gt;=1)){case 0:i.mode=14;break;case 1:if(g(i),i.mode=20,6!==t)break;p&gt;&gt;&gt;=2,x-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}p&gt;&gt;&gt;=2,x-=2;break;case 14:for(p&gt;&gt;&gt;=7&amp;x,x-=7&amp;x;x&lt;32;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if((65535&amp;p)!=(p&gt;&gt;&gt;16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&amp;p,x=p=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(T=i.length){if(m&lt;T&amp;&amp;(T=m),_&lt;T&amp;&amp;(T=_),0===T)break e;s.arraySet(u,l,f,T,c),m-=T,f+=T,_-=T,c+=T,i.length-=T;break}i.mode=12;break;case 17:for(;x&lt;14;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(i.nlen=257+(31&amp;p),p&gt;&gt;&gt;=5,x-=5,i.ndist=1+(31&amp;p),p&gt;&gt;&gt;=5,x-=5,i.ncode=4+(15&amp;p),p&gt;&gt;&gt;=4,x-=4,286&lt;i.nlen||30&lt;i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have&lt;i.ncode;){for(;x&lt;3;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}i.lens[O[i.have++]]=7&amp;p,p&gt;&gt;&gt;=3,x-=3}for(;i.have&lt;19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,P={bits:i.lenbits},N=a(0,i.lens,0,19,i.lencode,0,i.work,P),i.lenbits=P.bits,N){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have&lt;i.nlen+i.ndist;){for(;E=(V=i.lencode[p&amp;(1&lt;&lt;i.lenbits)-1])&gt;&gt;&gt;16&amp;255,F=65535&amp;V,!((M=V&gt;&gt;&gt;24)&lt;=x);){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(F&lt;16)p&gt;&gt;&gt;=M,x-=M,i.lens[i.have++]=F;else{if(16===F){for(D=M+2;x&lt;D;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(p&gt;&gt;&gt;=M,x-=M,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}I=i.lens[i.have-1],T=3+(3&amp;p),p&gt;&gt;&gt;=2,x-=2}else if(17===F){for(D=M+3;x&lt;D;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}x-=M,I=0,T=3+(7&amp;(p&gt;&gt;&gt;=M)),p&gt;&gt;&gt;=3,x-=3}else{for(D=M+7;x&lt;D;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}x-=M,I=0,T=11+(127&amp;(p&gt;&gt;&gt;=M)),p&gt;&gt;&gt;=7,x-=7}if(i.have+T&gt;i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;T--;)i.lens[i.have++]=I}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,P={bits:i.lenbits},N=a(1,i.lens,0,i.nlen,i.lencode,0,i.work,P),i.lenbits=P.bits,N){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,P={bits:i.distbits},N=a(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,P),i.distbits=P.bits,N){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6&lt;=m&amp;&amp;258&lt;=_){e.next_out=c,e.avail_out=_,e.next_in=f,e.avail_in=m,i.hold=p,i.bits=x,n(e,b),c=e.next_out,u=e.output,_=e.avail_out,f=e.next_in,l=e.input,m=e.avail_in,p=i.hold,x=i.bits,12===i.mode&amp;&amp;(i.back=-1);break}for(i.back=0;E=(V=i.lencode[p&amp;(1&lt;&lt;i.lenbits)-1])&gt;&gt;&gt;16&amp;255,F=65535&amp;V,!((M=V&gt;&gt;&gt;24)&lt;=x);){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(E&amp;&amp;0==(240&amp;E)){for(C=M,A=E,R=F;E=(V=i.lencode[R+((p&amp;(1&lt;&lt;C+A)-1)&gt;&gt;C)])&gt;&gt;&gt;16&amp;255,F=65535&amp;V,!(C+(M=V&gt;&gt;&gt;24)&lt;=x);){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}p&gt;&gt;&gt;=C,x-=C,i.back+=C}if(p&gt;&gt;&gt;=M,x-=M,i.back+=M,i.length=F,0===E){i.mode=26;break}if(32&amp;E){i.back=-1,i.mode=12;break}if(64&amp;E){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&amp;E,i.mode=22;case 22:if(i.extra){for(D=i.extra;x&lt;D;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}i.length+=p&amp;(1&lt;&lt;i.extra)-1,p&gt;&gt;&gt;=i.extra,x-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;E=(V=i.distcode[p&amp;(1&lt;&lt;i.distbits)-1])&gt;&gt;&gt;16&amp;255,F=65535&amp;V,!((M=V&gt;&gt;&gt;24)&lt;=x);){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(0==(240&amp;E)){for(C=M,A=E,R=F;E=(V=i.distcode[R+((p&amp;(1&lt;&lt;C+A)-1)&gt;&gt;C)])&gt;&gt;&gt;16&amp;255,F=65535&amp;V,!(C+(M=V&gt;&gt;&gt;24)&lt;=x);){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}p&gt;&gt;&gt;=C,x-=C,i.back+=C}if(p&gt;&gt;&gt;=M,x-=M,i.back+=M,64&amp;E){e.msg="invalid distance code",i.mode=30;break}i.offset=F,i.extra=15&amp;E,i.mode=24;case 24:if(i.extra){for(D=i.extra;x&lt;D;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}i.offset+=p&amp;(1&lt;&lt;i.extra)-1,p&gt;&gt;&gt;=i.extra,x-=i.extra,i.back+=i.extra}if(i.offset&gt;i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===_)break e;if(T=b-_,i.offset&gt;T){if((T=i.offset-T)&gt;i.whave&amp;&amp;i.sane){e.msg="invalid distance too far back",i.mode=30;break}S=T&gt;i.wnext?(T-=i.wnext,i.wsize-T):i.wnext-T,T&gt;i.length&amp;&amp;(T=i.length),w=i.window}else w=u,S=c-i.offset,T=i.length;for(_&lt;T&amp;&amp;(T=_),_-=T,i.length-=T;u[c++]=w[S++],--T;);0===i.length&amp;&amp;(i.mode=21);break;case 26:if(0===_)break e;u[c++]=i.length,_--,i.mode=21;break;case 27:if(i.wrap){for(;x&lt;32;){if(0===m)break e;m--,p|=l[f++]&lt;&lt;x,x+=8}if(b-=_,e.total_out+=b,i.total+=b,b&amp;&amp;(e.adler=i.check=i.flags?o(i.check,u,b,c-b):r(i.check,u,b,c-b)),b=_,(i.flags?p:d(p))!==i.check){e.msg="incorrect data check",i.mode=30;break}x=p=0}i.mode=28;case 28:if(i.wrap&amp;&amp;i.flags){for(;x&lt;32;){if(0===m)break e;m--,p+=l[f++]&lt;&lt;x,x+=8}if(p!==(4294967295&amp;i.total)){e.msg="incorrect length check",i.mode=30;break}x=p=0}i.mode=29;case 29:N=1;break e;case 30:N=-3;break e;case 31:return-4;case 32:default:return h}return e.next_out=c,e.avail_out=_,e.next_in=f,e.avail_in=m,i.hold=p,i.bits=x,(i.wsize||b!==e.avail_out&amp;&amp;i.mode&lt;30&amp;&amp;(i.mode&lt;27||4!==t))&amp;&amp;v(e,e.output,e.next_out,b-e.avail_out)?(i.mode=31,-4):(y-=e.avail_in,b-=e.avail_out,e.total_in+=y,e.total_out+=b,i.total+=b,i.wrap&amp;&amp;b&amp;&amp;(e.adler=i.check=i.flags?o(i.check,u,b,e.next_out-b):r(i.check,u,b,e.next_out-b)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==y&amp;&amp;0===b||4===t)&amp;&amp;0===N&amp;&amp;(N=-5),N)},i.inflateEnd=function(e){if(!e||!e.state)return h;var t=e.state;return t.window&amp;&amp;(t.window=null),e.state=null,0},i.inflateGetHeader=function(e,t){var i;return e&amp;&amp;e.state?0==(2&amp;(i=e.state).wrap)?h:((i.head=t).done=!1,0):h},i.inflateSetDictionary=function(e,t){var i,s=t.length;return e&amp;&amp;e.state?0!==(i=e.state).wrap&amp;&amp;11!==i.mode?h:11===i.mode&amp;&amp;r(1,t,s,0)!==i.check?-3:v(e,t,s,s)?(i.mode=31,-4):(i.havedict=1,0):h},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){"use strict";var s=e("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],n=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,i,h,d,l,u,f){var c,m,_,p,x,g,v,y,b,T=f.bits,S=0,w=0,M=0,E=0,F=0,C=0,A=0,R=0,I=0,N=0,P=null,D=0,V=new s.Buf16(16),L=new s.Buf16(16),O=null,k=0;for(S=0;S&lt;=15;S++)V[S]=0;for(w=0;w&lt;h;w++)V[t[i+w]]++;for(F=T,E=15;1&lt;=E&amp;&amp;0===V[E];E--);if(E&lt;F&amp;&amp;(F=E),0===E)return d[l++]=20971520,d[l++]=20971520,f.bits=1,0;for(M=1;M&lt;E&amp;&amp;0===V[M];M++);for(F&lt;M&amp;&amp;(F=M),S=R=1;S&lt;=15;S++)if(R&lt;&lt;=1,(R-=V[S])&lt;0)return-1;if(0&lt;R&amp;&amp;(0===e||1!==E))return-1;for(L[1]=0,S=1;S&lt;15;S++)L[S+1]=L[S]+V[S];for(w=0;w&lt;h;w++)0!==t[i+w]&amp;&amp;(u[L[t[i+w]]++]=w);if(g=0===e?(P=O=u,19):1===e?(P=r,D-=257,O=o,k-=257,256):(P=n,O=a,-1),S=M,x=l,A=w=N=0,_=-1,p=(I=1&lt;&lt;(C=F))-1,1===e&amp;&amp;852&lt;I||2===e&amp;&amp;592&lt;I)return 1;for(;;){for(v=S-A,b=u[w]&lt;g?(y=0,u[w]):u[w]&gt;g?(y=O[k+u[w]],P[D+u[w]]):(y=96,0),c=1&lt;&lt;S-A,M=m=1&lt;&lt;C;d[x+(N&gt;&gt;A)+(m-=c)]=v&lt;&lt;24|y&lt;&lt;16|b|0,0!==m;);for(c=1&lt;&lt;S-1;N&amp;c;)c&gt;&gt;=1;if(0!==c?(N&amp;=c-1,N+=c):N=0,w++,0==--V[S]){if(S===E)break;S=t[i+u[w]]}if(F&lt;S&amp;&amp;(N&amp;p)!==_){for(0===A&amp;&amp;(A=F),x+=M,R=1&lt;&lt;(C=S-A);C+A&lt;E&amp;&amp;!((R-=V[C+A])&lt;=0);)C++,R&lt;&lt;=1;if(I+=1&lt;&lt;C,1===e&amp;&amp;852&lt;I||2===e&amp;&amp;592&lt;I)return 1;d[_=N&amp;p]=F&lt;&lt;24|C&lt;&lt;16|x-l|0}}return 0!==N&amp;&amp;(d[x+N]=S-A&lt;&lt;24|64&lt;&lt;16|0),f.bits=F,0}},{"../utils/common":41}],51:[function(e,t,i){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,i){"use strict";var s=e("../utils/common");function r(e){for(var t=e.length;0&lt;=--t;)e[t]=0}var o=256,n=286,a=30,h=15,d=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],l=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);r(c);var m=new Array(60);r(m);var _=new Array(512);r(_);var p=new Array(256);r(p);var x=new Array(29);r(x);var g,v,y,b=new Array(a);function T(e,t,i,s,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=r,this.has_stree=e&amp;&amp;e.length}function S(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function w(e){return e&lt;256?_[e]:_[256+(e&gt;&gt;&gt;7)]}function M(e,t){e.pending_buf[e.pending++]=255&amp;t,e.pending_buf[e.pending++]=t&gt;&gt;&gt;8&amp;255}function E(e,t,i){e.bi_valid&gt;16-i?(e.bi_buf|=t&lt;&lt;e.bi_valid&amp;65535,M(e,e.bi_buf),e.bi_buf=t&gt;&gt;16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t&lt;&lt;e.bi_valid&amp;65535,e.bi_valid+=i)}function F(e,t,i){E(e,i[2*t],i[2*t+1])}function C(e,t){for(var i=0;i|=1&amp;e,e&gt;&gt;&gt;=1,i&lt;&lt;=1,0&lt;--t;);return i&gt;&gt;&gt;1}function A(e,t,i){var s,r,o=new Array(16),n=0;for(s=1;s&lt;=h;s++)o[s]=n=n+i[s-1]&lt;&lt;1;for(r=0;r&lt;=t;r++){var a=e[2*r+1];0!==a&amp;&amp;(e[2*r]=C(o[a]++,a))}}function R(e){var t;for(t=0;t&lt;n;t++)e.dyn_ltree[2*t]=0;for(t=0;t&lt;a;t++)e.dyn_dtree[2*t]=0;for(t=0;t&lt;19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function I(e){8&lt;e.bi_valid?M(e,e.bi_buf):0&lt;e.bi_valid&amp;&amp;(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function N(e,t,i,s){var r=2*t,o=2*i;return e[r]&lt;e[o]||e[r]===e[o]&amp;&amp;s[t]&lt;=s[i]}function P(e,t,i){for(var s=e.heap[i],r=i&lt;&lt;1;r&lt;=e.heap_len&amp;&amp;(r&lt;e.heap_len&amp;&amp;N(t,e.heap[r+1],e.heap[r],e.depth)&amp;&amp;r++,!N(t,s,e.heap[r],e.depth));)e.heap[i]=e.heap[r],i=r,r&lt;&lt;=1;e.heap[i]=s}function D(e,t,i){var s,r,n,a,h=0;if(0!==e.last_lit)for(;s=e.pending_buf[e.d_buf+2*h]&lt;&lt;8|e.pending_buf[e.d_buf+2*h+1],r=e.pending_buf[e.l_buf+h],h++,0===s?F(e,r,t):(F(e,(n=p[r])+o+1,t),0!==(a=d[n])&amp;&amp;E(e,r-=x[n],a),F(e,n=w(--s),i),0!==(a=l[n])&amp;&amp;E(e,s-=b[n],a)),h&lt;e.last_lit;);F(e,256,t)}function V(e,t){var i,s,r,o=t.dyn_tree,n=t.stat_desc.static_tree,a=t.stat_desc.has_stree,d=t.stat_desc.elems,l=-1;for(e.heap_len=0,e.heap_max=573,i=0;i&lt;d;i++)0!==o[2*i]?(e.heap[++e.heap_len]=l=i,e.depth[i]=0):o[2*i+1]=0;for(;e.heap_len&lt;2;)o[2*(r=e.heap[++e.heap_len]=l&lt;2?++l:0)]=1,e.depth[r]=0,e.opt_len--,a&amp;&amp;(e.static_len-=n[2*r+1]);for(t.max_code=l,i=e.heap_len&gt;&gt;1;1&lt;=i;i--)P(e,o,i);for(r=d;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],P(e,o,1),s=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=s,o[2*r]=o[2*i]+o[2*s],e.depth[r]=(e.depth[i]&gt;=e.depth[s]?e.depth[i]:e.depth[s])+1,o[2*i+1]=o[2*s+1]=r,e.heap[1]=r++,P(e,o,1),2&lt;=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,s,r,o,n,a,d=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,f=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,m=t.stat_desc.extra_base,_=t.stat_desc.max_length,p=0;for(o=0;o&lt;=h;o++)e.bl_count[o]=0;for(d[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i&lt;573;i++)_&lt;(o=d[2*d[2*(s=e.heap[i])+1]+1]+1)&amp;&amp;(o=_,p++),d[2*s+1]=o,l&lt;s||(e.bl_count[o]++,n=0,m&lt;=s&amp;&amp;(n=c[s-m]),a=d[2*s],e.opt_len+=a*(o+n),f&amp;&amp;(e.static_len+=a*(u[2*s+1]+n)));if(0!==p){do{for(o=_-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[_]--,p-=2}while(0&lt;p);for(o=_;0!==o;o--)for(s=e.bl_count[o];0!==s;)l&lt;(r=e.heap[--i])||(d[2*r+1]!==o&amp;&amp;(e.opt_len+=(o-d[2*r+1])*d[2*r],d[2*r+1]=o),s--)}}(e,t),A(o,l,e.bl_count)}function L(e,t,i){var s,r,o=-1,n=t[1],a=0,h=7,d=4;for(0===n&amp;&amp;(h=138,d=3),t[2*(i+1)+1]=65535,s=0;s&lt;=i;s++)r=n,n=t[2*(s+1)+1],++a&lt;h&amp;&amp;r===n||(a&lt;d?e.bl_tree[2*r]+=a:0!==r?(r!==o&amp;&amp;e.bl_tree[2*r]++,e.bl_tree[32]++):a&lt;=10?e.bl_tree[34]++:e.bl_tree[36]++,o=r,d=(a=0)===n?(h=138,3):r===n?(h=6,3):(h=7,4))}function O(e,t,i){var s,r,o=-1,n=t[1],a=0,h=7,d=4;for(0===n&amp;&amp;(h=138,d=3),s=0;s&lt;=i;s++)if(r=n,n=t[2*(s+1)+1],!(++a&lt;h&amp;&amp;r===n)){if(a&lt;d)for(;F(e,r,e.bl_tree),0!=--a;);else 0!==r?(r!==o&amp;&amp;(F(e,r,e.bl_tree),a--),F(e,16,e.bl_tree),E(e,a-3,2)):a&lt;=10?(F(e,17,e.bl_tree),E(e,a-3,3)):(F(e,18,e.bl_tree),E(e,a-11,7));o=r,d=(a=0)===n?(h=138,3):r===n?(h=6,3):(h=7,4)}}r(b);var k=!1;function B(e,t,i,r){E(e,0+(r?1:0),3),function(e,t,i,r){I(e),M(e,i),M(e,~i),s.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i)}i._tr_init=function(e){k||(function(){var e,t,i,s,r,o=new Array(16);for(s=i=0;s&lt;28;s++)for(x[s]=i,e=0;e&lt;1&lt;&lt;d[s];e++)p[i++]=s;for(p[i-1]=s,s=r=0;s&lt;16;s++)for(b[s]=r,e=0;e&lt;1&lt;&lt;l[s];e++)_[r++]=s;for(r&gt;&gt;=7;s&lt;a;s++)for(b[s]=r&lt;&lt;7,e=0;e&lt;1&lt;&lt;l[s]-7;e++)_[256+r++]=s;for(t=0;t&lt;=h;t++)o[t]=0;for(e=0;e&lt;=143;)c[2*e+1]=8,e++,o[8]++;for(;e&lt;=255;)c[2*e+1]=9,e++,o[9]++;for(;e&lt;=279;)c[2*e+1]=7,e++,o[7]++;for(;e&lt;=287;)c[2*e+1]=8,e++,o[8]++;for(A(c,287,o),e=0;e&lt;a;e++)m[2*e+1]=5,m[2*e]=C(e,5);g=new T(c,d,257,n,h),v=new T(m,l,0,a,h),y=new T(new Array(0),u,0,19,7)}(),k=!0),e.l_desc=new S(e.dyn_ltree,g),e.d_desc=new S(e.dyn_dtree,v),e.bl_desc=new S(e.bl_tree,y),e.bi_buf=0,e.bi_valid=0,R(e)},i._tr_stored_block=B,i._tr_flush_block=function(e,t,i,s){var r,n,a=0;0&lt;e.level?(2===e.strm.data_type&amp;&amp;(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t&lt;=31;t++,i&gt;&gt;&gt;=1)if(1&amp;i&amp;&amp;0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t&lt;o;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),V(e,e.l_desc),V(e,e.d_desc),a=function(e){var t;for(L(e,e.dyn_ltree,e.l_desc.max_code),L(e,e.dyn_dtree,e.d_desc.max_code),V(e,e.bl_desc),t=18;3&lt;=t&amp;&amp;0===e.bl_tree[2*f[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),r=e.opt_len+3+7&gt;&gt;&gt;3,(n=e.static_len+3+7&gt;&gt;&gt;3)&lt;=r&amp;&amp;(r=n)):r=n=i+5,i+4&lt;=r&amp;&amp;-1!==t?B(e,t,i,s):4===e.strategy||n===r?(E(e,2+(s?1:0),3),D(e,c,m)):(E(e,4+(s?1:0),3),function(e,t,i,s){var r;for(E(e,t-257,5),E(e,i-1,5),E(e,s-4,4),r=0;r&lt;s;r++)E(e,e.bl_tree[2*f[r]+1],3);O(e,e.dyn_ltree,t-1),O(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),D(e,e.dyn_ltree,e.dyn_dtree)),R(e),s&amp;&amp;I(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t&gt;&gt;&gt;8&amp;255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&amp;t,e.pending_buf[e.l_buf+e.last_lit]=255&amp;i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(p[i]+o+1)]++,e.dyn_dtree[2*w(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){E(e,2,3),F(e,256,c),function(e){16===e.bi_valid?(M(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8&lt;=e.bi_valid&amp;&amp;(e.pending_buf[e.pending++]=255&amp;e.bi_buf,e.bi_buf&gt;&gt;=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,i){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){"use strict";t.exports="function"==typeof s?s:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}},{}]},{},[10])(10)}).call(this,i(614).Buffer,i(78),i(618).setImmediate)},614:function(e,t,i){"use strict";(function(e){var s=i(615),r=i(616),o=i(617);function n(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()&lt;t)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=h.prototype:(null===e&amp;&amp;(e=new h(t)),e.length=t),e}function h(e,t,i){if(!h.TYPED_ARRAY_SUPPORT&amp;&amp;!(this instanceof h))return new h(e,t,i);if("number"===typeof e){if("string"===typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(this,e)}return d(this,e,t,i)}function d(e,t,i,s){if("number"===typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!==typeof ArrayBuffer&amp;&amp;t instanceof ArrayBuffer?function(e,t,i,s){if(t.byteLength,i&lt;0||t.byteLength&lt;i)throw new RangeError("'offset' is out of bounds");if(t.byteLength&lt;i+(s||0))throw new RangeError("'length' is out of bounds");t=void 0===i&amp;&amp;void 0===s?new Uint8Array(t):void 0===s?new Uint8Array(t,i):new Uint8Array(t,i,s);h.TYPED_ARRAY_SUPPORT?(e=t).__proto__=h.prototype:e=f(e,t);return e}(e,t,i,s):"string"===typeof t?function(e,t,i){"string"===typeof i&amp;&amp;""!==i||(i="utf8");if(!h.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var s=0|m(t,i),r=(e=a(e,s)).write(t,i);r!==s&amp;&amp;(e=e.slice(0,r));return e}(e,t,i):function(e,t){if(h.isBuffer(t)){var i=0|c(t.length);return 0===(e=a(e,i)).length||t.copy(e,0,0,i),e}if(t){if("undefined"!==typeof ArrayBuffer&amp;&amp;t.buffer instanceof ArrayBuffer||"length"in t)return"number"!==typeof t.length||(s=t.length)!==s?a(e,0):f(e,t);if("Buffer"===t.type&amp;&amp;o(t.data))return f(e,t.data)}var s;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be a number');if(e&lt;0)throw new RangeError('"size" argument must not be negative')}function u(e,t){if(l(t),e=a(e,t&lt;0?0:0|c(t)),!h.TYPED_ARRAY_SUPPORT)for(var i=0;i&lt;t;++i)e[i]=0;return e}function f(e,t){var i=t.length&lt;0?0:0|c(t.length);e=a(e,i);for(var s=0;s&lt;i;s+=1)e[s]=255&amp;t[s];return e}function c(e){if(e&gt;=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function m(e,t){if(h.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&amp;&amp;"function"===typeof ArrayBuffer.isView&amp;&amp;(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&amp;&amp;(e=""+e);var i=e.length;if(0===i)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i&gt;&gt;&gt;1;case"base64":return z(e).length;default:if(s)return U(e).length;t=(""+t).toLowerCase(),s=!0}}function _(e,t,i){var s=!1;if((void 0===t||t&lt;0)&amp;&amp;(t=0),t&gt;this.length)return"";if((void 0===i||i&gt;this.length)&amp;&amp;(i=this.length),i&lt;=0)return"";if((i&gt;&gt;&gt;=0)&lt;=(t&gt;&gt;&gt;=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,i);case"utf8":case"utf-8":return E(this,t,i);case"ascii":return F(this,t,i);case"latin1":case"binary":return C(this,t,i);case"base64":return M(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,i);default:if(s)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function p(e,t,i){var s=e[t];e[t]=e[i],e[i]=s}function x(e,t,i,s,r){if(0===e.length)return-1;if("string"===typeof i?(s=i,i=0):i&gt;2147483647?i=2147483647:i&lt;-2147483648&amp;&amp;(i=-2147483648),i=+i,isNaN(i)&amp;&amp;(i=r?0:e.length-1),i&lt;0&amp;&amp;(i=e.length+i),i&gt;=e.length){if(r)return-1;i=e.length-1}else if(i&lt;0){if(!r)return-1;i=0}if("string"===typeof t&amp;&amp;(t=h.from(t,s)),h.isBuffer(t))return 0===t.length?-1:g(e,t,i,s,r);if("number"===typeof t)return t&amp;=255,h.TYPED_ARRAY_SUPPORT&amp;&amp;"function"===typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):g(e,[t],i,s,r);throw new TypeError("val must be string, number or Buffer")}function g(e,t,i,s,r){var o,n=1,a=e.length,h=t.length;if(void 0!==s&amp;&amp;("ucs2"===(s=String(s).toLowerCase())||"ucs-2"===s||"utf16le"===s||"utf-16le"===s)){if(e.length&lt;2||t.length&lt;2)return-1;n=2,a/=2,h/=2,i/=2}function d(e,t){return 1===n?e[t]:e.readUInt16BE(t*n)}if(r){var l=-1;for(o=i;o&lt;a;o++)if(d(e,o)===d(t,-1===l?0:o-l)){if(-1===l&amp;&amp;(l=o),o-l+1===h)return l*n}else-1!==l&amp;&amp;(o-=o-l),l=-1}else for(i+h&gt;a&amp;&amp;(i=a-h),o=i;o&gt;=0;o--){for(var u=!0,f=0;f&lt;h;f++)if(d(e,o+f)!==d(t,f)){u=!1;break}if(u)return o}return-1}function v(e,t,i,s){i=Number(i)||0;var r=e.length-i;s?(s=Number(s))&gt;r&amp;&amp;(s=r):s=r;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");s&gt;o/2&amp;&amp;(s=o/2);for(var n=0;n&lt;s;++n){var a=parseInt(t.substr(2*n,2),16);if(isNaN(a))return n;e[i+n]=a}return n}function y(e,t,i,s){return G(U(t,e.length-i),e,i,s)}function b(e,t,i,s){return G(function(e){for(var t=[],i=0;i&lt;e.length;++i)t.push(255&amp;e.charCodeAt(i));return t}(t),e,i,s)}function T(e,t,i,s){return b(e,t,i,s)}function S(e,t,i,s){return G(z(t),e,i,s)}function w(e,t,i,s){return G(function(e,t){for(var i,s,r,o=[],n=0;n&lt;e.length&amp;&amp;!((t-=2)&lt;0);++n)i=e.charCodeAt(n),s=i&gt;&gt;8,r=i%256,o.push(r),o.push(s);return o}(t,e.length-i),e,i,s)}function M(e,t,i){return 0===t&amp;&amp;i===e.length?s.fromByteArray(e):s.fromByteArray(e.slice(t,i))}function E(e,t,i){i=Math.min(e.length,i);for(var s=[],r=t;r&lt;i;){var o,n,a,h,d=e[r],l=null,u=d&gt;239?4:d&gt;223?3:d&gt;191?2:1;if(r+u&lt;=i)switch(u){case 1:d&lt;128&amp;&amp;(l=d);break;case 2:128===(192&amp;(o=e[r+1]))&amp;&amp;(h=(31&amp;d)&lt;&lt;6|63&amp;o)&gt;127&amp;&amp;(l=h);break;case 3:o=e[r+1],n=e[r+2],128===(192&amp;o)&amp;&amp;128===(192&amp;n)&amp;&amp;(h=(15&amp;d)&lt;&lt;12|(63&amp;o)&lt;&lt;6|63&amp;n)&gt;2047&amp;&amp;(h&lt;55296||h&gt;57343)&amp;&amp;(l=h);break;case 4:o=e[r+1],n=e[r+2],a=e[r+3],128===(192&amp;o)&amp;&amp;128===(192&amp;n)&amp;&amp;128===(192&amp;a)&amp;&amp;(h=(15&amp;d)&lt;&lt;18|(63&amp;o)&lt;&lt;12|(63&amp;n)&lt;&lt;6|63&amp;a)&gt;65535&amp;&amp;h&lt;1114112&amp;&amp;(l=h)}null===l?(l=65533,u=1):l&gt;65535&amp;&amp;(l-=65536,s.push(l&gt;&gt;&gt;10&amp;1023|55296),l=56320|1023&amp;l),s.push(l),r+=u}return function(e){var t=e.length;if(t&lt;=4096)return String.fromCharCode.apply(String,e);var i="",s=0;for(;s&lt;t;)i+=String.fromCharCode.apply(String,e.slice(s,s+=4096));return i}(s)}t.Buffer=h,t.SlowBuffer=function(e){+e!=e&amp;&amp;(e=0);return h.alloc(+e)},t.INSPECT_MAX_BYTES=50,h.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&amp;&amp;"function"===typeof e.subarray&amp;&amp;0===e.subarray(1,1).byteLength}catch(t){return!1}}(),t.kMaxLength=n(),h.poolSize=8192,h._augment=function(e){return e.__proto__=h.prototype,e},h.from=function(e,t,i){return d(null,e,t,i)},h.TYPED_ARRAY_SUPPORT&amp;&amp;(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array,"undefined"!==typeof Symbol&amp;&amp;Symbol.species&amp;&amp;h[Symbol.species]===h&amp;&amp;Object.defineProperty(h,Symbol.species,{value:null,configurable:!0})),h.alloc=function(e,t,i){return function(e,t,i,s){return l(t),t&lt;=0?a(e,t):void 0!==i?"string"===typeof s?a(e,t).fill(i,s):a(e,t).fill(i):a(e,t)}(null,e,t,i)},h.allocUnsafe=function(e){return u(null,e)},h.allocUnsafeSlow=function(e){return u(null,e)},h.isBuffer=function(e){return!(null==e||!e._isBuffer)},h.compare=function(e,t){if(!h.isBuffer(e)||!h.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,s=t.length,r=0,o=Math.min(i,s);r&lt;o;++r)if(e[r]!==t[r]){i=e[r],s=t[r];break}return i&lt;s?-1:s&lt;i?1:0},h.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return h.alloc(0);var i;if(void 0===t)for(t=0,i=0;i&lt;e.length;++i)t+=e[i].length;var s=h.allocUnsafe(t),r=0;for(i=0;i&lt;e.length;++i){var n=e[i];if(!h.isBuffer(n))throw new TypeError('"list" argument must be an Array of Buffers');n.copy(s,r),r+=n.length}return s},h.byteLength=m,h.prototype._isBuffer=!0,h.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t&lt;e;t+=2)p(this,t,t+1);return this},h.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t&lt;e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},h.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t&lt;e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},h.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?E(this,0,e):_.apply(this,arguments)},h.prototype.equals=function(e){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===h.compare(this,e)},h.prototype.inspect=function(){var e="",i=t.INSPECT_MAX_BYTES;return this.length&gt;0&amp;&amp;(e=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length&gt;i&amp;&amp;(e+=" ... ")),"&lt;Buffer "+e+"&gt;"},h.prototype.compare=function(e,t,i,s,r){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&amp;&amp;(t=0),void 0===i&amp;&amp;(i=e?e.length:0),void 0===s&amp;&amp;(s=0),void 0===r&amp;&amp;(r=this.length),t&lt;0||i&gt;e.length||s&lt;0||r&gt;this.length)throw new RangeError("out of range index");if(s&gt;=r&amp;&amp;t&gt;=i)return 0;if(s&gt;=r)return-1;if(t&gt;=i)return 1;if(this===e)return 0;for(var o=(r&gt;&gt;&gt;=0)-(s&gt;&gt;&gt;=0),n=(i&gt;&gt;&gt;=0)-(t&gt;&gt;&gt;=0),a=Math.min(o,n),d=this.slice(s,r),l=e.slice(t,i),u=0;u&lt;a;++u)if(d[u]!==l[u]){o=d[u],n=l[u];break}return o&lt;n?-1:n&lt;o?1:0},h.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},h.prototype.indexOf=function(e,t,i){return x(this,e,t,i,!0)},h.prototype.lastIndexOf=function(e,t,i){return x(this,e,t,i,!1)},h.prototype.write=function(e,t,i,s){if(void 0===t)s="utf8",i=this.length,t=0;else if(void 0===i&amp;&amp;"string"===typeof t)s=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(i)?(i|=0,void 0===s&amp;&amp;(s="utf8")):(s=i,i=void 0)}var r=this.length-t;if((void 0===i||i&gt;r)&amp;&amp;(i=r),e.length&gt;0&amp;&amp;(i&lt;0||t&lt;0)||t&gt;this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");for(var o=!1;;)switch(s){case"hex":return v(this,e,t,i);case"utf8":case"utf-8":return y(this,e,t,i);case"ascii":return b(this,e,t,i);case"latin1":case"binary":return T(this,e,t,i);case"base64":return S(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),o=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(e,t,i){var s="";i=Math.min(e.length,i);for(var r=t;r&lt;i;++r)s+=String.fromCharCode(127&amp;e[r]);return s}function C(e,t,i){var s="";i=Math.min(e.length,i);for(var r=t;r&lt;i;++r)s+=String.fromCharCode(e[r]);return s}function A(e,t,i){var s=e.length;(!t||t&lt;0)&amp;&amp;(t=0),(!i||i&lt;0||i&gt;s)&amp;&amp;(i=s);for(var r="",o=t;o&lt;i;++o)r+=B(e[o]);return r}function R(e,t,i){for(var s=e.slice(t,i),r="",o=0;o&lt;s.length;o+=2)r+=String.fromCharCode(s[o]+256*s[o+1]);return r}function I(e,t,i){if(e%1!==0||e&lt;0)throw new RangeError("offset is not uint");if(e+t&gt;i)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,i,s,r,o){if(!h.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t&gt;r||t&lt;o)throw new RangeError('"value" argument is out of bounds');if(i+s&gt;e.length)throw new RangeError("Index out of range")}function P(e,t,i,s){t&lt;0&amp;&amp;(t=65535+t+1);for(var r=0,o=Math.min(e.length-i,2);r&lt;o;++r)e[i+r]=(t&amp;255&lt;&lt;8*(s?r:1-r))&gt;&gt;&gt;8*(s?r:1-r)}function D(e,t,i,s){t&lt;0&amp;&amp;(t=4294967295+t+1);for(var r=0,o=Math.min(e.length-i,4);r&lt;o;++r)e[i+r]=t&gt;&gt;&gt;8*(s?r:3-r)&amp;255}function V(e,t,i,s,r,o){if(i+s&gt;e.length)throw new RangeError("Index out of range");if(i&lt;0)throw new RangeError("Index out of range")}function L(e,t,i,s,o){return o||V(e,0,i,4),r.write(e,t,i,s,23,4),i+4}function O(e,t,i,s,o){return o||V(e,0,i,8),r.write(e,t,i,s,52,8),i+8}h.prototype.slice=function(e,t){var i,s=this.length;if((e=~~e)&lt;0?(e+=s)&lt;0&amp;&amp;(e=0):e&gt;s&amp;&amp;(e=s),(t=void 0===t?s:~~t)&lt;0?(t+=s)&lt;0&amp;&amp;(t=0):t&gt;s&amp;&amp;(t=s),t&lt;e&amp;&amp;(t=e),h.TYPED_ARRAY_SUPPORT)(i=this.subarray(e,t)).__proto__=h.prototype;else{var r=t-e;i=new h(r,void 0);for(var o=0;o&lt;r;++o)i[o]=this[o+e]}return i},h.prototype.readUIntLE=function(e,t,i){e|=0,t|=0,i||I(e,t,this.length);for(var s=this[e],r=1,o=0;++o&lt;t&amp;&amp;(r*=256);)s+=this[e+o]*r;return s},h.prototype.readUIntBE=function(e,t,i){e|=0,t|=0,i||I(e,t,this.length);for(var s=this[e+--t],r=1;t&gt;0&amp;&amp;(r*=256);)s+=this[e+--t]*r;return s},h.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]&lt;&lt;8},h.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]&lt;&lt;8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]&lt;&lt;8|this[e+2]&lt;&lt;16)+16777216*this[e+3]},h.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]&lt;&lt;16|this[e+2]&lt;&lt;8|this[e+3])},h.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||I(e,t,this.length);for(var s=this[e],r=1,o=0;++o&lt;t&amp;&amp;(r*=256);)s+=this[e+o]*r;return s&gt;=(r*=128)&amp;&amp;(s-=Math.pow(2,8*t)),s},h.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||I(e,t,this.length);for(var s=t,r=1,o=this[e+--s];s&gt;0&amp;&amp;(r*=256);)o+=this[e+--s]*r;return o&gt;=(r*=128)&amp;&amp;(o-=Math.pow(2,8*t)),o},h.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&amp;this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var i=this[e]|this[e+1]&lt;&lt;8;return 32768&amp;i?4294901760|i:i},h.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var i=this[e+1]|this[e]&lt;&lt;8;return 32768&amp;i?4294901760|i:i},h.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]&lt;&lt;8|this[e+2]&lt;&lt;16|this[e+3]&lt;&lt;24},h.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]&lt;&lt;24|this[e+1]&lt;&lt;16|this[e+2]&lt;&lt;8|this[e+3]},h.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),r.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),r.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),r.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),r.read(this,e,!1,52,8)},h.prototype.writeUIntLE=function(e,t,i,s){(e=+e,t|=0,i|=0,s)||N(this,e,t,i,Math.pow(2,8*i)-1,0);var r=1,o=0;for(this[t]=255&amp;e;++o&lt;i&amp;&amp;(r*=256);)this[t+o]=e/r&amp;255;return t+i},h.prototype.writeUIntBE=function(e,t,i,s){(e=+e,t|=0,i|=0,s)||N(this,e,t,i,Math.pow(2,8*i)-1,0);var r=i-1,o=1;for(this[t+r]=255&amp;e;--r&gt;=0&amp;&amp;(o*=256);)this[t+r]=e/o&amp;255;return t+i},h.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,1,255,0),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&amp;e,t+1},h.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=255&amp;e,this[t+1]=e&gt;&gt;&gt;8):P(this,e,t,!0),t+2},h.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e&gt;&gt;&gt;8,this[t+1]=255&amp;e):P(this,e,t,!1),t+2},h.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t+3]=e&gt;&gt;&gt;24,this[t+2]=e&gt;&gt;&gt;16,this[t+1]=e&gt;&gt;&gt;8,this[t]=255&amp;e):D(this,e,t,!0),t+4},h.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[t]=e&gt;&gt;&gt;24,this[t+1]=e&gt;&gt;&gt;16,this[t+2]=e&gt;&gt;&gt;8,this[t+3]=255&amp;e):D(this,e,t,!1),t+4},h.prototype.writeIntLE=function(e,t,i,s){if(e=+e,t|=0,!s){var r=Math.pow(2,8*i-1);N(this,e,t,i,r-1,-r)}var o=0,n=1,a=0;for(this[t]=255&amp;e;++o&lt;i&amp;&amp;(n*=256);)e&lt;0&amp;&amp;0===a&amp;&amp;0!==this[t+o-1]&amp;&amp;(a=1),this[t+o]=(e/n&gt;&gt;0)-a&amp;255;return t+i},h.prototype.writeIntBE=function(e,t,i,s){if(e=+e,t|=0,!s){var r=Math.pow(2,8*i-1);N(this,e,t,i,r-1,-r)}var o=i-1,n=1,a=0;for(this[t+o]=255&amp;e;--o&gt;=0&amp;&amp;(n*=256);)e&lt;0&amp;&amp;0===a&amp;&amp;0!==this[t+o+1]&amp;&amp;(a=1),this[t+o]=(e/n&gt;&gt;0)-a&amp;255;return t+i},h.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,1,127,-128),h.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e&lt;0&amp;&amp;(e=255+e+1),this[t]=255&amp;e,t+1},h.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=255&amp;e,this[t+1]=e&gt;&gt;&gt;8):P(this,e,t,!0),t+2},h.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[t]=e&gt;&gt;&gt;8,this[t+1]=255&amp;e):P(this,e,t,!1),t+2},h.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[t]=255&amp;e,this[t+1]=e&gt;&gt;&gt;8,this[t+2]=e&gt;&gt;&gt;16,this[t+3]=e&gt;&gt;&gt;24):D(this,e,t,!0),t+4},h.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,4,2147483647,-2147483648),e&lt;0&amp;&amp;(e=4294967295+e+1),h.TYPED_ARRAY_SUPPORT?(this[t]=e&gt;&gt;&gt;24,this[t+1]=e&gt;&gt;&gt;16,this[t+2]=e&gt;&gt;&gt;8,this[t+3]=255&amp;e):D(this,e,t,!1),t+4},h.prototype.writeFloatLE=function(e,t,i){return L(this,e,t,!0,i)},h.prototype.writeFloatBE=function(e,t,i){return L(this,e,t,!1,i)},h.prototype.writeDoubleLE=function(e,t,i){return O(this,e,t,!0,i)},h.prototype.writeDoubleBE=function(e,t,i){return O(this,e,t,!1,i)},h.prototype.copy=function(e,t,i,s){if(i||(i=0),s||0===s||(s=this.length),t&gt;=e.length&amp;&amp;(t=e.length),t||(t=0),s&gt;0&amp;&amp;s&lt;i&amp;&amp;(s=i),s===i)return 0;if(0===e.length||0===this.length)return 0;if(t&lt;0)throw new RangeError("targetStart out of bounds");if(i&lt;0||i&gt;=this.length)throw new RangeError("sourceStart out of bounds");if(s&lt;0)throw new RangeError("sourceEnd out of bounds");s&gt;this.length&amp;&amp;(s=this.length),e.length-t&lt;s-i&amp;&amp;(s=e.length-t+i);var r,o=s-i;if(this===e&amp;&amp;i&lt;t&amp;&amp;t&lt;s)for(r=o-1;r&gt;=0;--r)e[r+t]=this[r+i];else if(o&lt;1e3||!h.TYPED_ARRAY_SUPPORT)for(r=0;r&lt;o;++r)e[r+t]=this[r+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+o),t);return o},h.prototype.fill=function(e,t,i,s){if("string"===typeof e){if("string"===typeof t?(s=t,t=0,i=this.length):"string"===typeof i&amp;&amp;(s=i,i=this.length),1===e.length){var r=e.charCodeAt(0);r&lt;256&amp;&amp;(e=r)}if(void 0!==s&amp;&amp;"string"!==typeof s)throw new TypeError("encoding must be a string");if("string"===typeof s&amp;&amp;!h.isEncoding(s))throw new TypeError("Unknown encoding: "+s)}else"number"===typeof e&amp;&amp;(e&amp;=255);if(t&lt;0||this.length&lt;t||this.length&lt;i)throw new RangeError("Out of range index");if(i&lt;=t)return this;var o;if(t&gt;&gt;&gt;=0,i=void 0===i?this.length:i&gt;&gt;&gt;0,e||(e=0),"number"===typeof e)for(o=t;o&lt;i;++o)this[o]=e;else{var n=h.isBuffer(e)?e:U(new h(e,s).toString()),a=n.length;for(o=0;o&lt;i-t;++o)this[o+t]=n[o%a]}return this};var k=/[^+\/0-9A-Za-z-_]/g;function B(e){return e&lt;16?"0"+e.toString(16):e.toString(16)}function U(e,t){var i;t=t||1/0;for(var s=e.length,r=null,o=[],n=0;n&lt;s;++n){if((i=e.charCodeAt(n))&gt;55295&amp;&amp;i&lt;57344){if(!r){if(i&gt;56319){(t-=3)&gt;-1&amp;&amp;o.push(239,191,189);continue}if(n+1===s){(t-=3)&gt;-1&amp;&amp;o.push(239,191,189);continue}r=i;continue}if(i&lt;56320){(t-=3)&gt;-1&amp;&amp;o.push(239,191,189),r=i;continue}i=65536+(r-55296&lt;&lt;10|i-56320)}else r&amp;&amp;(t-=3)&gt;-1&amp;&amp;o.push(239,191,189);if(r=null,i&lt;128){if((t-=1)&lt;0)break;o.push(i)}else if(i&lt;2048){if((t-=2)&lt;0)break;o.push(i&gt;&gt;6|192,63&amp;i|128)}else if(i&lt;65536){if((t-=3)&lt;0)break;o.push(i&gt;&gt;12|224,i&gt;&gt;6&amp;63|128,63&amp;i|128)}else{if(!(i&lt;1114112))throw new Error("Invalid code point");if((t-=4)&lt;0)break;o.push(i&gt;&gt;18|240,i&gt;&gt;12&amp;63|128,i&gt;&gt;6&amp;63|128,63&amp;i|128)}}return o}function z(e){return s.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(k,"")).length&lt;2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function G(e,t,i,s){for(var r=0;r&lt;s&amp;&amp;!(r+i&gt;=t.length||r&gt;=e.length);++r)t[r+i]=e[r];return r}}).call(this,i(78))},615:function(e,t,i){"use strict";t.byteLength=function(e){var t=d(e),i=t[0],s=t[1];return 3*(i+s)/4-s},t.toByteArray=function(e){var t,i,s=d(e),n=s[0],a=s[1],h=new o(function(e,t,i){return 3*(t+i)/4-i}(0,n,a)),l=0,u=a&gt;0?n-4:n;for(i=0;i&lt;u;i+=4)t=r[e.charCodeAt(i)]&lt;&lt;18|r[e.charCodeAt(i+1)]&lt;&lt;12|r[e.charCodeAt(i+2)]&lt;&lt;6|r[e.charCodeAt(i+3)],h[l++]=t&gt;&gt;16&amp;255,h[l++]=t&gt;&gt;8&amp;255,h[l++]=255&amp;t;2===a&amp;&amp;(t=r[e.charCodeAt(i)]&lt;&lt;2|r[e.charCodeAt(i+1)]&gt;&gt;4,h[l++]=255&amp;t);1===a&amp;&amp;(t=r[e.charCodeAt(i)]&lt;&lt;10|r[e.charCodeAt(i+1)]&lt;&lt;4|r[e.charCodeAt(i+2)]&gt;&gt;2,h[l++]=t&gt;&gt;8&amp;255,h[l++]=255&amp;t);return h},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,o=[],n=0,a=i-r;n&lt;a;n+=16383)o.push(l(e,n,n+16383&gt;a?a:n+16383));1===r?(t=e[i-1],o.push(s[t&gt;&gt;2]+s[t&lt;&lt;4&amp;63]+"==")):2===r&amp;&amp;(t=(e[i-2]&lt;&lt;8)+e[i-1],o.push(s[t&gt;&gt;10]+s[t&gt;&gt;4&amp;63]+s[t&lt;&lt;2&amp;63]+"="));return o.join("")};for(var s=[],r=[],o="undefined"!==typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,h=n.length;a&lt;h;++a)s[a]=n[a],r[n.charCodeAt(a)]=a;function d(e){var t=e.length;if(t%4&gt;0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");return-1===i&amp;&amp;(i=t),[i,i===t?0:4-i%4]}function l(e,t,i){for(var r,o,n=[],a=t;a&lt;i;a+=3)r=(e[a]&lt;&lt;16&amp;16711680)+(e[a+1]&lt;&lt;8&amp;65280)+(255&amp;e[a+2]),n.push(s[(o=r)&gt;&gt;18&amp;63]+s[o&gt;&gt;12&amp;63]+s[o&gt;&gt;6&amp;63]+s[63&amp;o]);return n.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},616:function(e,t){t.read=function(e,t,i,s,r){var o,n,a=8*r-s-1,h=(1&lt;&lt;a)-1,d=h&gt;&gt;1,l=-7,u=i?r-1:0,f=i?-1:1,c=e[t+u];for(u+=f,o=c&amp;(1&lt;&lt;-l)-1,c&gt;&gt;=-l,l+=a;l&gt;0;o=256*o+e[t+u],u+=f,l-=8);for(n=o&amp;(1&lt;&lt;-l)-1,o&gt;&gt;=-l,l+=s;l&gt;0;n=256*n+e[t+u],u+=f,l-=8);if(0===o)o=1-d;else{if(o===h)return n?NaN:1/0*(c?-1:1);n+=Math.pow(2,s),o-=d}return(c?-1:1)*n*Math.pow(2,o-s)},t.write=function(e,t,i,s,r,o){var n,a,h,d=8*o-r-1,l=(1&lt;&lt;d)-1,u=l&gt;&gt;1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,c=s?0:o-1,m=s?1:-1,_=t&lt;0||0===t&amp;&amp;1/t&lt;0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,n=l):(n=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-n))&lt;1&amp;&amp;(n--,h*=2),(t+=n+u&gt;=1?f/h:f*Math.pow(2,1-u))*h&gt;=2&amp;&amp;(n++,h/=2),n+u&gt;=l?(a=0,n=l):n+u&gt;=1?(a=(t*h-1)*Math.pow(2,r),n+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,r),n=0));r&gt;=8;e[i+c]=255&amp;a,c+=m,a/=256,r-=8);for(n=n&lt;&lt;r|a,d+=r;d&gt;0;e[i+c]=255&amp;n,c+=m,n/=256,d-=8);e[i+c-m]|=128*_}},617:function(e,t){var i={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},618:function(e,t,i){(function(e){var s="undefined"!==typeof e&amp;&amp;e||"undefined"!==typeof self&amp;&amp;self||window,r=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(r.call(setTimeout,s,arguments),clearTimeout)},t.setInterval=function(){return new o(r.call(setInterval,s,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&amp;&amp;e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(s,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t&gt;=0&amp;&amp;(e._idleTimeoutId=setTimeout((function(){e._onTimeout&amp;&amp;e._onTimeout()}),t))},i(619),t.setImmediate="undefined"!==typeof self&amp;&amp;self.setImmediate||"undefined"!==typeof e&amp;&amp;e.setImmediate||this&amp;&amp;this.setImmediate,t.clearImmediate="undefined"!==typeof self&amp;&amp;self.clearImmediate||"undefined"!==typeof e&amp;&amp;e.clearImmediate||this&amp;&amp;this.clearImmediate}).call(this,i(78))},619:function(e,t,i){(function(e,t){!function(e,i){"use strict";if(!e.setImmediate){var s,r=1,o={},n=!1,a=e.document,h=Object.getPrototypeOf&amp;&amp;Object.getPrototypeOf(e);h=h&amp;&amp;h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?s=function(e){t.nextTick((function(){l(e)}))}:function(){if(e.postMessage&amp;&amp;!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?function(){var t="setImmediate$"+Math.random()+"$",i=function(i){i.source===e&amp;&amp;"string"===typeof i.data&amp;&amp;0===i.data.indexOf(t)&amp;&amp;l(+i.data.slice(t.length))};e.addEventListener?e.addEventListener("message",i,!1):e.attachEvent("onmessage",i),s=function(i){e.postMessage(t+i,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){l(e.data)},s=function(t){e.port2.postMessage(t)}}():a&amp;&amp;"onreadystatechange"in a.createElement("script")?function(){var e=a.documentElement;s=function(t){var i=a.createElement("script");i.onreadystatechange=function(){l(t),i.onreadystatechange=null,e.removeChild(i),i=null},e.appendChild(i)}}():s=function(e){setTimeout(l,0,e)},h.setImmediate=function(e){"function"!==typeof e&amp;&amp;(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i&lt;t.length;i++)t[i]=arguments[i+1];var n={callback:e,args:t};return o[r]=n,s(r),r++},h.clearImmediate=d}function d(e){delete o[e]}function l(e){if(n)setTimeout(l,0,e);else{var t=o[e];if(t){n=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(void 0,i)}}(t)}finally{d(e),n=!1}}}}}("undefined"===typeof self?"undefined"===typeof e?this:e:self)}).call(this,i(78),i(173))},620:function(e,t,i){(function(i){var s,r,o;r=[],void 0===(o="function"===typeof(s=function(){"use strict";function t(e,t,i){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){n(s.response,t,i)},s.onerror=function(){console.error("could not download file")},s.send()}function s(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200&lt;=t.status&amp;&amp;299&gt;=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(t){var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(i)}}var o="object"==typeof window&amp;&amp;window.window===window?window:"object"==typeof self&amp;&amp;self.self===self?self:"object"==typeof i&amp;&amp;i.global===i?i:void 0,n=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype?function(e,i,n){var a=o.URL||o.webkitURL,h=document.createElement("a");i=i||e.name||"download",h.download=i,h.rel="noopener","string"==typeof e?(h.href=e,h.origin===location.origin?r(h):s(h.href)?t(e,i,n):r(h,h.target="_blank")):(h.href=a.createObjectURL(e),setTimeout((function(){a.revokeObjectURL(h.href)}),4e4),setTimeout((function(){r(h)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,i,o){if(i=i||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(function(e,t){return"undefined"==typeof t?t={autoBom:!1}:"object"!=typeof t&amp;&amp;(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&amp;&amp;/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}(e,o),i);else if(s(e))t(e,i,o);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout((function(){r(n)}))}}:function(e,i,s,r){if((r=r||open("","_blank"))&amp;&amp;(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return t(e,i,s);var n="application/octet-stream"===e.type,a=/constructor/i.test(o.HTMLElement)||o.safari,h=/CriOS\/[\d]+/.test(navigator.userAgent);if((h||n&amp;&amp;a)&amp;&amp;"object"==typeof FileReader){var d=new FileReader;d.onloadend=function(){var e=d.result;e=h?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},d.readAsDataURL(e)}else{var l=o.URL||o.webkitURL,u=l.createObjectURL(e);r?r.location=u:location.href=u,r=null,setTimeout((function(){l.revokeObjectURL(u)}),4e4)}});o.saveAs=n.saveAs=n,e.exports=n})?s.apply(t,r):s)||(e.exports=o)}).call(this,i(78))},621:function(e,t,i){"use strict";function s(e){return+e}function r(e){return e*e}function o(e){return e*(2-e)}function n(e){return((e*=2)&lt;=1?e*e:--e*(2-e)+1)/2}function a(e){return e*e*e}function h(e){return--e*e*e+1}function d(e){return((e*=2)&lt;=1?e*e*e:(e-=2)*e*e+2)/2}i.r(t),i.d(t,"easeLinear",(function(){return s})),i.d(t,"easeQuad",(function(){return n})),i.d(t,"easeQuadIn",(function(){return r})),i.d(t,"easeQuadOut",(function(){return o})),i.d(t,"easeQuadInOut",(function(){return n})),i.d(t,"easeCubic",(function(){return d})),i.d(t,"easeCubicIn",(function(){return a})),i.d(t,"easeCubicOut",(function(){return h})),i.d(t,"easeCubicInOut",(function(){return d})),i.d(t,"easePoly",(function(){return f})),i.d(t,"easePolyIn",(function(){return l})),i.d(t,"easePolyOut",(function(){return u})),i.d(t,"easePolyInOut",(function(){return f})),i.d(t,"easeSin",(function(){return x})),i.d(t,"easeSinIn",(function(){return _})),i.d(t,"easeSinOut",(function(){return p})),i.d(t,"easeSinInOut",(function(){return x})),i.d(t,"easeExp",(function(){return y})),i.d(t,"easeExpIn",(function(){return g})),i.d(t,"easeExpOut",(function(){return v})),i.d(t,"easeExpInOut",(function(){return y})),i.d(t,"easeCircle",(function(){return S})),i.d(t,"easeCircleIn",(function(){return b})),i.d(t,"easeCircleOut",(function(){return T})),i.d(t,"easeCircleInOut",(function(){return S})),i.d(t,"easeBounce",(function(){return E})),i.d(t,"easeBounceIn",(function(){return M})),i.d(t,"easeBounceOut",(function(){return E})),i.d(t,"easeBounceInOut",(function(){return F})),i.d(t,"easeBack",(function(){return R})),i.d(t,"easeBackIn",(function(){return C})),i.d(t,"easeBackOut",(function(){return A})),i.d(t,"easeBackInOut",(function(){return R})),i.d(t,"easeElastic",(function(){return P})),i.d(t,"easeElasticIn",(function(){return N})),i.d(t,"easeElasticOut",(function(){return P})),i.d(t,"easeElasticInOut",(function(){return D}));var l=function e(t){function i(e){return Math.pow(e,t)}return t=+t,i.exponent=e,i}(3),u=function e(t){function i(e){return 1-Math.pow(1-e,t)}return t=+t,i.exponent=e,i}(3),f=function e(t){function i(e){return((e*=2)&lt;=1?Math.pow(e,t):2-Math.pow(2-e,t))/2}return t=+t,i.exponent=e,i}(3),c=Math.PI,m=c/2;function _(e){return 1-Math.cos(e*m)}function p(e){return Math.sin(e*m)}function x(e){return(1-Math.cos(c*e))/2}function g(e){return Math.pow(2,10*e-10)}function v(e){return 1-Math.pow(2,-10*e)}function y(e){return((e*=2)&lt;=1?Math.pow(2,10*e-10):2-Math.pow(2,10-10*e))/2}function b(e){return 1-Math.sqrt(1-e*e)}function T(e){return Math.sqrt(1- --e*e)}function S(e){return((e*=2)&lt;=1?1-Math.sqrt(1-e*e):Math.sqrt(1-(e-=2)*e)+1)/2}var w=7.5625;function M(e){return 1-E(1-e)}function E(e){return(e=+e)&lt;4/11?w*e*e:e&lt;8/11?w*(e-=6/11)*e+3/4:e&lt;10/11?w*(e-=9/11)*e+15/16:w*(e-=21/22)*e+63/64}function F(e){return((e*=2)&lt;=1?1-E(1-e):E(e-1)+1)/2}var C=function e(t){function i(e){return e*e*((t+1)*e-t)}return t=+t,i.overshoot=e,i}(1.70158),A=function e(t){function i(e){return--e*e*((t+1)*e+t)+1}return t=+t,i.overshoot=e,i}(1.70158),R=function e(t){function i(e){return((e*=2)&lt;1?e*e*((t+1)*e-t):(e-=2)*e*((t+1)*e+t)+2)/2}return t=+t,i.overshoot=e,i}(1.70158),I=2*Math.PI,N=function e(t,i){var s=Math.asin(1/(t=Math.max(1,t)))*(i/=I);function r(e){return t*Math.pow(2,10*--e)*Math.sin((s-e)/i)}return r.amplitude=function(t){return e(t,i*I)},r.period=function(i){return e(t,i)},r}(1,.3),P=function e(t,i){var s=Math.asin(1/(t=Math.max(1,t)))*(i/=I);function r(e){return 1-t*Math.pow(2,-10*(e=+e))*Math.sin((e+s)/i)}return r.amplitude=function(t){return e(t,i*I)},r.period=function(i){return e(t,i)},r}(1,.3),D=function e(t,i){var s=Math.asin(1/(t=Math.max(1,t)))*(i/=I);function r(e){return((e=2*e-1)&lt;0?t*Math.pow(2,10*e)*Math.sin((s-e)/i):2-t*Math.pow(2,-10*e)*Math.sin((s+e)/i))/2}return r.amplitude=function(t){return e(t,i*I)},r.period=function(i){return e(t,i)},r}(1,.3)},630:function(e,t,i){"use strict";var s=i(83),r=i(161);t.a=function(e,t,i){var o=null==e?0:e.length;return o?(t=o-(t=i||void 0===t?1:Object(r.a)(t)),Object(s.a)(e,t&lt;0?0:t,o)):[]}},631:function(e,t,i){"use strict";var s=i(83),r=i(161);t.a=function(e,t,i){var o=null==e?0:e.length;return o?(t=o-(t=i||void 0===t?1:Object(r.a)(t)),Object(s.a)(e,0,t&lt;0?0:t)):[]}},632:function(e,t,i){"use strict";var s=i(108),r=i(14),o=i(48),n=i(2),a=i(27),h=i(23),d=i(33),l=i(52),u=Object.prototype.hasOwnProperty;t.a=function(e){if(null==e)return!0;if(Object(a.a)(e)&amp;&amp;(Object(n.a)(e)||"string"==typeof e||"function"==typeof e.splice||Object(h.a)(e)||Object(l.a)(e)||Object(o.a)(e)))return!e.length;var t=Object(r.a)(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Object(d.a)(e))return!Object(s.a)(e).length;for(var i in e)if(u.call(e,i))return!1;return!0}},633:function(e,t,i){"use strict";var s=i(194);t.a=function(e){return e&amp;&amp;e.length?Object(s.a)(e):[]}},634:function(e,t,i){"use strict";var s=i(83),r=i(161);t.a=function(e,t,i){return e&amp;&amp;e.length?(t=i||void 0===t?1:Object(r.a)(t),Object(s.a)(e,0,t&lt;0?0:t)):[]}},635:function(e,t,i){"use strict";var s=i(76),r=i(44),o=i(228),n=i(2);t.a=function(e,t){return(Object(n.a)(e)?s.a:o.a)(e,Object(r.a)(t,3))}},637:function(e,t,i){"use strict";var s=function(e,t,i){e.prototype=t.prototype=i,i.constructor=e};function r(e,t){var i=Object.create(e.prototype);for(var s in t)i[s]=t[s];return i}function o(){}var n="\\s*([+-]?\\d+)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",h="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",d=/^#([0-9a-f]{3,8})$/,l=new RegExp("^rgb\\("+[n,n,n]+"\\)$"),u=new RegExp("^rgb\\("+[h,h,h]+"\\)$"),f=new RegExp("^rgba\\("+[n,n,n,a]+"\\)$"),c=new RegExp("^rgba\\("+[h,h,h,a]+"\\)$"),m=new RegExp("^hsl\\("+[a,h,h]+"\\)$"),_=new RegExp("^hsla\\("+[a,h,h,a]+"\\)$"),p={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function x(){return this.rgb().formatHex()}function g(){return this.rgb().formatRgb()}function v(e){var t,i;return e=(e+"").trim().toLowerCase(),(t=d.exec(e))?(i=t[1].length,t=parseInt(t[1],16),6===i?y(t):3===i?new w(t&gt;&gt;8&amp;15|t&gt;&gt;4&amp;240,t&gt;&gt;4&amp;15|240&amp;t,(15&amp;t)&lt;&lt;4|15&amp;t,1):8===i?b(t&gt;&gt;24&amp;255,t&gt;&gt;16&amp;255,t&gt;&gt;8&amp;255,(255&amp;t)/255):4===i?b(t&gt;&gt;12&amp;15|t&gt;&gt;8&amp;240,t&gt;&gt;8&amp;15|t&gt;&gt;4&amp;240,t&gt;&gt;4&amp;15|240&amp;t,((15&amp;t)&lt;&lt;4|15&amp;t)/255):null):(t=l.exec(e))?new w(t[1],t[2],t[3],1):(t=u.exec(e))?new w(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=f.exec(e))?b(t[1],t[2],t[3],t[4]):(t=c.exec(e))?b(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=m.exec(e))?C(t[1],t[2]/100,t[3]/100,1):(t=_.exec(e))?C(t[1],t[2]/100,t[3]/100,t[4]):p.hasOwnProperty(e)?y(p[e]):"transparent"===e?new w(NaN,NaN,NaN,0):null}function y(e){return new w(e&gt;&gt;16&amp;255,e&gt;&gt;8&amp;255,255&amp;e,1)}function b(e,t,i,s){return s&lt;=0&amp;&amp;(e=t=i=NaN),new w(e,t,i,s)}function T(e){return e instanceof o||(e=v(e)),e?new w((e=e.rgb()).r,e.g,e.b,e.opacity):new w}function S(e,t,i,s){return 1===arguments.length?T(e):new w(e,t,i,null==s?1:s)}function w(e,t,i,s){this.r=+e,this.g=+t,this.b=+i,this.opacity=+s}function M(){return"#"+F(this.r)+F(this.g)+F(this.b)}function E(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function F(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))&lt;16?"0":"")+e.toString(16)}function C(e,t,i,s){return s&lt;=0?e=t=i=NaN:i&lt;=0||i&gt;=1?e=t=NaN:t&lt;=0&amp;&amp;(e=NaN),new R(e,t,i,s)}function A(e){if(e instanceof R)return new R(e.h,e.s,e.l,e.opacity);if(e instanceof o||(e=v(e)),!e)return new R;if(e instanceof R)return e;var t=(e=e.rgb()).r/255,i=e.g/255,s=e.b/255,r=Math.min(t,i,s),n=Math.max(t,i,s),a=NaN,h=n-r,d=(n+r)/2;return h?(a=t===n?(i-s)/h+6*(i&lt;s):i===n?(s-t)/h+2:(t-i)/h+4,h/=d&lt;.5?n+r:2-n-r,a*=60):h=d&gt;0&amp;&amp;d&lt;1?0:a,new R(a,h,d,e.opacity)}function R(e,t,i,s){this.h=+e,this.s=+t,this.l=+i,this.opacity=+s}function I(e,t,i){return 255*(e&lt;60?t+(i-t)*e/60:e&lt;180?i:e&lt;240?t+(i-t)*(240-e)/60:t)}function N(e,t,i,s,r){var o=e*e,n=o*e;return((1-3*e+3*o-n)*t+(4-6*o+3*n)*i+(1+3*e+3*o-3*n)*s+n*r)/6}s(o,v,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:x,formatHex:x,formatHsl:function(){return A(this).formatHsl()},formatRgb:g,toString:g}),s(w,S,r(o,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new w(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new w(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5&lt;=this.r&amp;&amp;this.r&lt;255.5&amp;&amp;-.5&lt;=this.g&amp;&amp;this.g&lt;255.5&amp;&amp;-.5&lt;=this.b&amp;&amp;this.b&lt;255.5&amp;&amp;0&lt;=this.opacity&amp;&amp;this.opacity&lt;=1},hex:M,formatHex:M,formatRgb:E,toString:E})),s(R,(function(e,t,i,s){return 1===arguments.length?A(e):new R(e,t,i,null==s?1:s)}),r(o,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new R(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new R(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h&lt;0),t=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,s=i+(i&lt;.5?i:1-i)*t,r=2*i-s;return new w(I(e&gt;=240?e-240:e+120,r,s),I(e,r,s),I(e&lt;120?e+240:e-120,r,s),this.opacity)},displayable:function(){return(0&lt;=this.s&amp;&amp;this.s&lt;=1||isNaN(this.s))&amp;&amp;0&lt;=this.l&amp;&amp;this.l&lt;=1&amp;&amp;0&lt;=this.opacity&amp;&amp;this.opacity&lt;=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var P=function(e){return function(){return e}};function D(e,t){return function(i){return e+i*t}}function V(e){return 1===(e=+e)?L:function(t,i){return i-t?function(e,t,i){return e=Math.pow(e,i),t=Math.pow(t,i)-e,i=1/i,function(s){return Math.pow(e+s*t,i)}}(t,i,e):P(isNaN(t)?i:t)}}function L(e,t){var i=t-e;return i?D(e,i):P(isNaN(e)?t:e)}var O=function e(t){var i=V(t);function s(e,t){var s=i((e=S(e)).r,(t=S(t)).r),r=i(e.g,t.g),o=i(e.b,t.b),n=L(e.opacity,t.opacity);return function(t){return e.r=s(t),e.g=r(t),e.b=o(t),e.opacity=n(t),e+""}}return s.gamma=e,s}(1);function k(e){return function(t){var i,s,r=t.length,o=new Array(r),n=new Array(r),a=new Array(r);for(i=0;i&lt;r;++i)s=S(t[i]),o[i]=s.r||0,n[i]=s.g||0,a[i]=s.b||0;return o=e(o),n=e(n),a=e(a),s.opacity=1,function(e){return s.r=o(e),s.g=n(e),s.b=a(e),s+""}}}k((function(e){var t=e.length-1;return function(i){var s=i&lt;=0?i=0:i&gt;=1?(i=1,t-1):Math.floor(i*t),r=e[s],o=e[s+1],n=s&gt;0?e[s-1]:2*r-o,a=s&lt;t-1?e[s+2]:2*o-r;return N((i-s/t)*t,n,r,o,a)}})),k((function(e){var t=e.length;return function(i){var s=Math.floor(((i%=1)&lt;0?++i:i)*t),r=e[(s+t-1)%t],o=e[s%t],n=e[(s+1)%t],a=e[(s+2)%t];return N((i-s/t)*t,r,o,n,a)}}));var B=function(e,t){t||(t=[]);var i,s=e?Math.min(t.length,e.length):0,r=t.slice();return function(o){for(i=0;i&lt;s;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}};function U(e){return ArrayBuffer.isView(e)&amp;&amp;!(e instanceof DataView)}function z(e,t){var i,s=t?t.length:0,r=e?Math.min(s,e.length):0,o=new Array(r),n=new Array(s);for(i=0;i&lt;r;++i)o[i]=Y(e[i],t[i]);for(;i&lt;s;++i)n[i]=t[i];return function(e){for(i=0;i&lt;r;++i)n[i]=o[i](e);return n}}var G=function(e,t){var i=new Date;return e=+e,t=+t,function(s){return i.setTime(e*(1-s)+t*s),i}},X=function(e,t){return e=+e,t=+t,function(i){return e*(1-i)+t*i}},j=function(e,t){var i,s={},r={};for(i in null!==e&amp;&amp;"object"===typeof e||(e={}),null!==t&amp;&amp;"object"===typeof t||(t={}),t)i in e?s[i]=Y(e[i],t[i]):r[i]=t[i];return function(e){for(i in s)r[i]=s[i](e);return r}},H=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,W=new RegExp(H.source,"g");var q=function(e,t){var i,s,r,o=H.lastIndex=W.lastIndex=0,n=-1,a=[],h=[];for(e+="",t+="";(i=H.exec(e))&amp;&amp;(s=W.exec(t));)(r=s.index)&gt;o&amp;&amp;(r=t.slice(o,r),a[n]?a[n]+=r:a[++n]=r),(i=i[0])===(s=s[0])?a[n]?a[n]+=s:a[++n]=s:(a[++n]=null,h.push({i:n,x:X(i,s)})),o=W.lastIndex;return o&lt;t.length&amp;&amp;(r=t.slice(o),a[n]?a[n]+=r:a[++n]=r),a.length&lt;2?h[0]?function(e){return function(t){return e(t)+""}}(h[0].x):function(e){return function(){return e}}(t):(t=h.length,function(e){for(var i,s=0;s&lt;t;++s)a[(i=h[s]).i]=i.x(e);return a.join("")})},Y=t.a=function(e,t){var i,s=typeof t;return null==t||"boolean"===s?P(t):("number"===s?X:"string"===s?(i=v(t))?(t=i,O):q:t instanceof v?O:t instanceof Date?G:U(t)?B:Array.isArray(t)?z:"function"!==typeof t.valueOf&amp;&amp;"function"!==typeof t.toString||isNaN(t)?j:X)(e,t)}},639:function(e,t,i){"use strict";var s=i(34);var r=function(e,t,i,s){for(var r=-1,o=null==e?0:e.length;++r&lt;o;){var n=e[r];t(s,n,i(n),e)}return s},o=i(192);var n=function(e,t,i,s){return Object(o.a)(e,(function(e,r,o){t(s,e,i(e),o)})),s},a=i(44),h=i(2);var d=function(e,t){return function(i,s){var o=Object(h.a)(i)?r:n,d=t?t():{};return o(i,e,Object(a.a)(s,2),d)}},l=Object.prototype.hasOwnProperty,u=d((function(e,t,i){l.call(e,i)?++e[i]:Object(s.a)(e,i,1)}));t.a=u},640:function(e,t,i){"use strict";var s=i(196),r=i(76),o=i(44),n=i(228);var a=function(e,t){var i=e.length;for(e.sort(t);i--;)e[i]=e[i].value;return e},h=i(31),d=i(222);var l=function(e,t,i){for(var s=-1,r=e.criteria,o=t.criteria,n=r.length,a=i.length;++s&lt;n;){var h=Object(d.a)(r[s],o[s]);if(h)return s&gt;=a?h:h*("desc"==i[s]?-1:1)}return e.index-t.index},u=i(79);var f=function(e,t,i){var s=-1;t=Object(r.a)(t.length?t:[u.a],Object(h.a)(o.a));var d=Object(n.a)(e,(function(e,i,o){return{criteria:Object(r.a)(t,(function(t){return t(e)})),index:++s,value:e}}));return a(d,(function(e,t){return l(e,t,i)}))},c=i(226),m=i(227),_=Object(c.a)((function(e,t){if(null==e)return[];var i=t.length;return i&gt;1&amp;&amp;Object(m.a)(e,t[0],t[1])?t=[]:i&gt;2&amp;&amp;Object(m.a)(t[0],t[1],t[2])&amp;&amp;(t=[t[0]]),f(e,Object(s.a)(t,1),[])}));t.a=_},642:function(e,t,i){"use strict";var s=i(76),r=i(97);var o=function(e,t){for(var i=-1,s=t.length,o=Array(s),n=null==e;++i&lt;s;)o[i]=n?void 0:Object(r.a)(e,t[i]);return o},n=i(232),a=i(29),h=Array.prototype.splice;var d=function(e,t){for(var i=e?t.length:0,s=i-1;i--;){var r=t[i];if(i==s||r!==o){var o=r;Object(a.a)(r)?h.call(e,r,1):Object(n.a)(e,r)}}return e},l=i(222),u=i(195),f=Object(u.a)((function(e,t){var i=null==e?0:e.length,r=o(e,t);return d(e,Object(s.a)(t,(function(e){return Object(a.a)(e,i)?+e:e})).sort(l.a)),r}));t.a=f},643:function(e,t,i){"use strict";var s=i(213),r=i(84);var o=function(e,t,i,s){return Object(r.a)(e,(function(e,r,o){t(s,i(e),r,o)})),s};var n=function(e,t){return function(i,s){return o(i,e,t(s),{})}},a=i(79),h=Object.prototype.toString,d=n((function(e,t,i){null!=t&amp;&amp;"function"!=typeof t.toString&amp;&amp;(t=h.call(t)),e[t]=i}),Object(s.a)(a.a));t.a=d},644:function(e,t,i){"use strict";var s=i(87),r=i(226),o=i(90),n=i(231),a=i(206),h=i(76),d=i(31),l=i(85);var u=function(e,t,i,s){var r=-1,u=n.a,f=!0,c=e.length,m=[],_=t.length;if(!c)return m;i&amp;&amp;(t=Object(h.a)(t,Object(d.a)(i))),s?(u=a.a,f=!1):t.length&gt;=200&amp;&amp;(u=l.a,f=!1,t=new o.a(t));e:for(;++r&lt;c;){var p=e[r],x=null==i?p:i(p);if(p=s||0!==p?p:0,f&amp;&amp;x===x){for(var g=_;g--;)if(t[g]===x)continue e;m.push(p)}else u(t,x,s)||m.push(p)}return m},f=i(196),c=i(194);var m=function(e,t,i){var s=e.length;if(s&lt;2)return s?Object(c.a)(e[0]):[];for(var r=-1,o=Array(s);++r&lt;s;)for(var n=e[r],a=-1;++a&lt;s;)a!=r&amp;&amp;(o[r]=u(o[r]||n,e[a],t,i));return Object(c.a)(Object(f.a)(o,1),t,i)},_=i(214),p=Object(r.a)((function(e){return m(Object(s.a)(e,_.a))}));t.a=p},645:function(e,t,i){"use strict";var s=Math.ceil,r=Math.max;var o=function(e,t,i,o){for(var n=-1,a=r(s((t-e)/(i||1)),0),h=Array(a);a--;)h[o?a:++n]=e,e+=i;return h},n=i(227),a=i(223);var h=function(e){return function(t,i,s){return s&amp;&amp;"number"!=typeof s&amp;&amp;Object(n.a)(t,i,s)&amp;&amp;(i=s=void 0),t=Object(a.a)(t),void 0===i?(i=t,t=0):i=Object(a.a)(i),s=void 0===s?t&lt;i?1:-1:Object(a.a)(s),o(t,i,s,e)}}();t.a=h},646:function(e,t,i){"use strict";var s=function(e,t,i){var s;return i(e,(function(e,i,r){if(t(e,i,r))return s=i,!1})),s},r=i(84),o=i(44);t.a=function(e,t){return s(e,Object(o.a)(t,3),r.a)}},647:function(e,t,i){"use strict";var s=i(161);var r=function(e,t){var i;if("function"!=typeof t)throw new TypeError("Expected a function");return e=Object(s.a)(e),function(){return--e&gt;0&amp;&amp;(i=t.apply(this,arguments)),e&lt;=1&amp;&amp;(t=void 0),i}};t.a=function(e){return r(2,e)}},648:function(e,t,i){"use strict";var s=i(225);var r=function(e,t){return e&gt;t},o=i(44);t.a=function(e,t){return e&amp;&amp;e.length?Object(s.a)(e,Object(o.a)(t,2),r):void 0}},649:function(e,t,i){"use strict";var s=i(225),r=i(44);var o=function(e,t){return e&lt;t};t.a=function(e,t){return e&amp;&amp;e.length?Object(s.a)(e,Object(r.a)(t,2),o):void 0}},650:function(e,t,i){"use strict";var s=function(e,t){for(var i,s=-1,r=e.length;++s&lt;r;){var o=t(e[s]);void 0!==o&amp;&amp;(i=void 0===i?o:i+o)}return i},r=i(79);t.a=function(e){return e&amp;&amp;e.length?s(e,r.a):0}},651:function(e,t,i){"use strict";var s=i(104),r=i(192),o=i(79);var n=function(e){return"function"==typeof e?e:o.a},a=i(2);t.a=function(e,t){return(Object(a.a)(e)?s.a:r.a)(e,n(t))}},652:function(e,t,i){"use strict";var s=i(210),r=i(107);var o=function(e,t){return Object(s.a)(e,t,(function(t,i){return Object(r.a)(e,i)}))},n=i(195),a=Object(n.a)((function(e,t){return null==e?{}:o(e,t)}));t.a=a},653:function(e,t,i){"use strict";var s=i(3),r=i(161),o=i(224),n=i(18),a=s.a.isFinite,h=Math.min;var d=function(e){var t=Math[e];return function(e,i){if(e=Object(o.a)(e),(i=null==i?0:h(Object(r.a)(i),292))&amp;&amp;a(e)){var s=(Object(n.a)(e)+"e").split("e"),d=t(s[0]+"e"+(+s[1]+i));return+((s=(Object(n.a)(d)+"e").split("e"))[0]+"e"+(+s[1]-i))}return t(e)}}("round");t.a=d}}]);
//# sourceMappingURL=6.7de32f86.chunk.js.map</pre></body></html>