/** * Copyright (c) 2017, Baidu Inc. * All rights reserved. * github: https://github.com/ecomfe/echarts-gl * license: BSD 3-Clause "New" or "Revised" License * version: 1.1.1 */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],t):"object"==typeof exports?exports["echarts-gl"]=t(require("echarts")):e["echarts-gl"]=t(e.echarts)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=106)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){return!e||"none"===e}function i(e){return e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof Image}function a(e){return e.getZr&&e.setOption}function o(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function s(e){if((e.wrapS===c.a.REPEAT||e.wrapT===c.a.REPEAT)&&e.image){var t=o(e.width),r=o(e.height);if(t!==e.width||r!==e.height){var n=document.createElement("canvas");n.width=t,n.height=r;n.getContext("2d").drawImage(e.image,0,0,t,r),e.image=n}}}var u=r(40),l=r(52),h=r(5),c=r(4),d=r(8),f=r(19),p=r(35),m=r(15),g=r(0),_=r.n(g),v=r(36),y=r(60),x=r.n(y),T=r(61),b=r(124),w=r(125),E=r(129),S=r(130),A=r(2),M=r(132),C=r(43),L=r(76),D=r(133),N=r(134),R=r(135),P=r(136),I=r(41),O=r(37),F=r(26),B=r(3),U=r(137),z=r(56),G=r(138),H=r(139),V=r(140),k=r(9),W=r(74),j=r(54),X=r(18),q=r(59),Z=r(141),Y=r(146),K=r(71),Q=r(147),J=r(148),$=r(149),ee=r(150),te=r(151),re=r(152);_.a.util.extend(p.a.prototype,Z.a),d.a.import(Y.a),d.a.import(K.a),d.a.import(Q.a),d.a.import(J.a),d.a.import($.a),d.a.import(ee.a),d.a.import(te.a),d.a.import(re.a);var ne=v.a.prototype.addToScene,ie=v.a.prototype.removeFromScene;v.a.prototype.addToScene=function(e){if(ne.call(this,e),this.__zr){var t=this.__zr;e.traverse(function(e){e.__zr=t,e.addAnimatorsToZr&&e.addAnimatorsToZr(t)})}},v.a.prototype.removeFromScene=function(e){ie.call(this,e),e.traverse(function(e){var t=e.__zr;e.__zr=null,t&&e.removeAnimatorsFromZr&&e.removeAnimatorsFromZr(t)})},f.a.prototype.setTextureImage=function(e,t,r,i){if(this.shader){var a,o=r.getZr(),s=this;return s.autoUpdateTextureStatus=!1,s.disableTexture(e),n(t)||(a=ae.loadTexture(t,r,i,function(t){s.enableTexture(e),o&&o.refresh()}),s.set(e,a)),a}};var ae={};ae.Renderer=l.a,ae.Node=p.a,ae.Mesh=u.a,ae.Shader=d.a,ae.Material=f.a,ae.Texture=c.a,ae.Texture2D=h.a,ae.Geometry=m.a,ae.SphereGeometry=M.a,ae.PlaneGeometry=C.a,ae.CubeGeometry=L.a,ae.AmbientLight=D.a,ae.DirectionalLight=N.a,ae.PointLight=R.a,ae.SpotLight=P.a,ae.PerspectiveCamera=I.a,ae.OrthographicCamera=O.a,ae.Vector2=F.a,ae.Vector3=B.a,ae.Vector4=U.a,ae.Quaternion=z.a,ae.Matrix2=G.a,ae.Matrix2d=H.a,ae.Matrix3=V.a,ae.Matrix4=k.a,ae.Plane=W.a,ae.Ray=j.a,ae.BoundingBox=X.a,ae.Frustum=q.a;var oe=T.a.createBlank("rgba(255,255,255,0)").image;ae.loadTexture=function(e,t,r,n){"function"==typeof r&&(n=r,r={}),r=r||{};for(var o=Object.keys(r).sort(),u="",l=0;l3?t[3]=e[3]:t[3]=1,t):(t=_.a.color.parse(e||"#000",t)||[0,0,0,0],t[0]/=255,t[1]/=255,t[2]/=255,t)},ae.directionFromAlphaBeta=function(e,t){var r=e/180*Math.PI+Math.PI/2,n=-t/180*Math.PI+Math.PI/2,i=[],a=Math.sin(r);return i[0]=a*Math.cos(n),i[1]=-Math.cos(r),i[2]=a*Math.sin(n),i},ae.getShadowResolution=function(e){var t=1024;switch(e){case"low":t=512;break;case"medium":break;case"high":t=2048;break;case"ultra":t=4096}return t},ae.COMMON_SHADERS=["lambert","color","realistic","hatching"],ae.createShader=function(e){var t=d.a.source(e+".vertex"),r=d.a.source(e+".fragment");t||console.error("Vertex shader of '%s' not exits",e),r||console.error("Fragment shader of '%s' not exits",e);var n=new d.a(t,r);return n.name=e,n},ae.createMaterial=function(e,t){t instanceof Array||(t=[t]);var r=ae.createShader(e),n=new f.a({shader:r});return t.forEach(function(e){"string"==typeof e&&n.define(e)}),n},ae.setMaterialFromModel=function(e,t,r,n){t.autoUpdateTextureStatus=!1;var i=r.getModel(e+"Material"),a=i.get("detailTexture"),o=A.a.firstNotNull(i.get("textureTiling"),1),s=A.a.firstNotNull(i.get("textureOffset"),0);"number"==typeof o&&(o=[o,o]),"number"==typeof s&&(s=[s,s]);var u=o[0]>1||o[1]>1?ae.Texture.REPEAT:ae.Texture.CLAMP_TO_EDGE,l={anisotropic:8,wrapS:u,wrapT:u};if("realistic"===e){var h=i.get("roughness"),c=i.get("metalness");null!=c?isNaN(c)&&(t.setTextureImage("metalnessMap",c,n,l),c=A.a.firstNotNull(i.get("metalnessAdjust"),.5)):c=0,null!=h?isNaN(h)&&(t.setTextureImage("roughnessMap",h,n,l),h=A.a.firstNotNull(i.get("roughnessAdjust"),.5)):h=.5;var d=i.get("normalTexture");t.setTextureImage("detailMap",a,n,l),t.setTextureImage("normalMap",d,n,l),t.set({roughness:h,metalness:c,detailUvRepeat:o,detailUvOffset:s})}else if("lambert"===e)t.setTextureImage("detailMap",a,n,l),t.set({detailUvRepeat:o,detailUvOffset:s});else if("color"===e)t.setTextureImage("detailMap",a,n,l),t.set({detailUvRepeat:o,detailUvOffset:s});else if("hatching"===e){for(var f=i.get("hatchingTextures")||[],p=0;p<6;p++)t.setTextureImage("hatch"+(p+1),f[p],n,{anisotropic:8,wrapS:ae.Texture.REPEAT,wrapT:ae.Texture.REPEAT});t.set({detailUvRepeat:o,detailUvOffset:s})}},ae.updateVertexAnimation=function(e,t,r,n){var i=n.get("animation"),a=n.get("animationDurationUpdate"),o=n.get("animationEasingUpdate"),s=r.shadowDepthMaterial;if(i&&t&&a>0&&t.geometry.vertexCount===r.geometry.vertexCount){r.material.define("vertex","VERTEX_ANIMATION"),r.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var u=0;ur?r:e}var i=r(12),a=function(e,t,r){e=e||0,t=t||0,r=r||0,this.array=i.a.fromValues(e,t,r),this._dirty=!0};a.prototype={constructor:a,add:function(e){return i.a.add(this.array,this.array,e.array),this._dirty=!0,this},set:function(e,t,r){return this.array[0]=e,this.array[1]=t,this.array[2]=r,this._dirty=!0,this},setArray:function(e){return this.array[0]=e[0],this.array[1]=e[1],this.array[2]=e[2],this._dirty=!0,this},clone:function(){return new a(this.x,this.y,this.z)},copy:function(e){return i.a.copy(this.array,e.array),this._dirty=!0,this},cross:function(e,t){return i.a.cross(this.array,e.array,t.array),this._dirty=!0,this},dist:function(e){return i.a.dist(this.array,e.array)},distance:function(e){return i.a.distance(this.array,e.array)},div:function(e){return i.a.div(this.array,this.array,e.array),this._dirty=!0,this},divide:function(e){return i.a.divide(this.array,this.array,e.array),this._dirty=!0,this},dot:function(e){return i.a.dot(this.array,e.array)},len:function(){return i.a.len(this.array)},length:function(){return i.a.length(this.array)},lerp:function(e,t,r){return i.a.lerp(this.array,e.array,t.array,r),this._dirty=!0,this},min:function(e){return i.a.min(this.array,this.array,e.array),this._dirty=!0,this},max:function(e){return i.a.max(this.array,this.array,e.array),this._dirty=!0,this},mul:function(e){return i.a.mul(this.array,this.array,e.array),this._dirty=!0,this},multiply:function(e){return i.a.multiply(this.array,this.array,e.array),this._dirty=!0,this},negate:function(){return i.a.negate(this.array,this.array),this._dirty=!0,this},normalize:function(){return i.a.normalize(this.array,this.array),this._dirty=!0,this},random:function(e){return i.a.random(this.array,e),this._dirty=!0,this},scale:function(e){return i.a.scale(this.array,this.array,e),this._dirty=!0,this},scaleAndAdd:function(e,t){return i.a.scaleAndAdd(this.array,this.array,e.array,t),this._dirty=!0,this},sqrDist:function(e){return i.a.sqrDist(this.array,e.array)},squaredDistance:function(e){return i.a.squaredDistance(this.array,e.array)},sqrLen:function(){return i.a.sqrLen(this.array)},squaredLength:function(){return i.a.squaredLength(this.array)},sub:function(e){return i.a.sub(this.array,this.array,e.array),this._dirty=!0,this},subtract:function(e){return i.a.subtract(this.array,this.array,e.array),this._dirty=!0,this},transformMat3:function(e){return i.a.transformMat3(this.array,this.array,e.array),this._dirty=!0,this},transformMat4:function(e){return i.a.transformMat4(this.array,this.array,e.array),this._dirty=!0,this},transformQuat:function(e){return i.a.transformQuat(this.array,this.array,e.array),this._dirty=!0,this},applyProjection:function(e){var t=this.array;if(e=e.array,0===e[15]){var r=-1/t[2];t[0]=e[0]*t[0]*r,t[1]=e[5]*t[1]*r,t[2]=(e[10]*t[2]+e[14])*r}else t[0]=e[0]*t[0]+e[12],t[1]=e[5]*t[1]+e[13],t[2]=e[10]*t[2]+e[14];return this._dirty=!0,this},eulerFromQuat:function(e,t){a.eulerFromQuat(this,e,t)},eulerFromMat3:function(e,t){a.eulerFromMat3(this,e,t)},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}};var o=Object.defineProperty;if(o){var s=a.prototype;o(s,"x",{get:function(){return this.array[0]},set:function(e){this.array[0]=e,this._dirty=!0}}),o(s,"y",{get:function(){return this.array[1]},set:function(e){this.array[1]=e,this._dirty=!0}}),o(s,"z",{get:function(){return this.array[2]},set:function(e){this.array[2]=e,this._dirty=!0}})}a.add=function(e,t,r){return i.a.add(e.array,t.array,r.array),e._dirty=!0,e},a.set=function(e,t,r,n){i.a.set(e.array,t,r,n),e._dirty=!0},a.copy=function(e,t){return i.a.copy(e.array,t.array),e._dirty=!0,e},a.cross=function(e,t,r){return i.a.cross(e.array,t.array,r.array),e._dirty=!0,e},a.dist=function(e,t){return i.a.distance(e.array,t.array)},a.distance=a.dist,a.div=function(e,t,r){return i.a.divide(e.array,t.array,r.array),e._dirty=!0,e},a.divide=a.div,a.dot=function(e,t){return i.a.dot(e.array,t.array)},a.len=function(e){return i.a.length(e.array)},a.lerp=function(e,t,r,n){return i.a.lerp(e.array,t.array,r.array,n),e._dirty=!0,e},a.min=function(e,t,r){return i.a.min(e.array,t.array,r.array),e._dirty=!0,e},a.max=function(e,t,r){return i.a.max(e.array,t.array,r.array),e._dirty=!0,e},a.mul=function(e,t,r){return i.a.multiply(e.array,t.array,r.array),e._dirty=!0,e},a.multiply=a.mul,a.negate=function(e,t){return i.a.negate(e.array,t.array),e._dirty=!0,e},a.normalize=function(e,t){return i.a.normalize(e.array,t.array),e._dirty=!0,e},a.random=function(e,t){return i.a.random(e.array,t),e._dirty=!0,e},a.scale=function(e,t,r){return i.a.scale(e.array,t.array,r),e._dirty=!0,e},a.scaleAndAdd=function(e,t,r,n){return i.a.scaleAndAdd(e.array,t.array,r.array,n),e._dirty=!0,e},a.sqrDist=function(e,t){return i.a.sqrDist(e.array,t.array)},a.squaredDistance=a.sqrDist,a.sqrLen=function(e){return i.a.sqrLen(e.array)},a.squaredLength=a.sqrLen,a.sub=function(e,t,r){return i.a.subtract(e.array,t.array,r.array),e._dirty=!0,e},a.subtract=a.sub,a.transformMat3=function(e,t,r){return i.a.transformMat3(e.array,t.array,r.array),e._dirty=!0,e},a.transformMat4=function(e,t,r){return i.a.transformMat4(e.array,t.array,r.array),e._dirty=!0,e},a.transformQuat=function(e,t,r){return i.a.transformQuat(e.array,t.array,r.array),e._dirty=!0,e};var u=Math.atan2,l=Math.asin,h=Math.abs;a.eulerFromQuat=function(e,t,r){e._dirty=!0,t=t.array;var i=e.array,a=t[0],o=t[1],s=t[2],h=t[3],c=a*a,d=o*o,f=s*s,p=h*h,r=(r||"XYZ").toUpperCase();switch(r){case"XYZ":i[0]=u(2*(a*h-o*s),p-c-d+f),i[1]=l(n(2*(a*s+o*h),-1,1)),i[2]=u(2*(s*h-a*o),p+c-d-f);break;case"YXZ":i[0]=l(n(2*(a*h-o*s),-1,1)),i[1]=u(2*(a*s+o*h),p-c-d+f),i[2]=u(2*(a*o+s*h),p-c+d-f);break;case"ZXY":i[0]=l(n(2*(a*h+o*s),-1,1)),i[1]=u(2*(o*h-s*a),p-c-d+f),i[2]=u(2*(s*h-a*o),p-c+d-f);break;case"ZYX":i[0]=u(2*(a*h+s*o),p-c-d+f),i[1]=l(n(2*(o*h-a*s),-1,1)),i[2]=u(2*(a*o+s*h),p+c-d-f);break;case"YZX":i[0]=u(2*(a*h-s*o),p-c+d-f),i[1]=u(2*(o*h-a*s),p+c-d-f),i[2]=l(n(2*(a*o+s*h),-1,1));break;case"XZY":i[0]=u(2*(a*h+o*s),p-c+d-f),i[1]=u(2*(a*s+o*h),p+c-d-f),i[2]=l(n(2*(s*h-a*o),-1,1));break;default:console.warn("Unkown order: "+r)}return e},a.eulerFromMat3=function(e,t,r){var i=t.array,a=i[0],o=i[3],s=i[6],c=i[1],d=i[4],f=i[7],p=i[2],m=i[5],g=i[8],_=e.array,r=(r||"XYZ").toUpperCase();switch(r){case"XYZ":_[1]=l(n(s,-1,1)),h(s)<.99999?(_[0]=u(-f,g),_[2]=u(-o,a)):(_[0]=u(m,d),_[2]=0);break;case"YXZ":_[0]=l(-n(f,-1,1)),h(f)<.99999?(_[1]=u(s,g),_[2]=u(c,d)):(_[1]=u(-p,a),_[2]=0);break;case"ZXY":_[0]=l(n(m,-1,1)),h(m)<.99999?(_[1]=u(-p,g),_[2]=u(-o,d)):(_[1]=0,_[2]=u(c,a));break;case"ZYX":_[1]=l(-n(p,-1,1)),h(p)<.99999?(_[0]=u(m,g),_[2]=u(c,a)):(_[0]=0,_[2]=u(-o,d));break;case"YZX":_[2]=l(n(c,-1,1)),h(c)<.99999?(_[0]=u(-f,d),_[1]=u(-p,a)):(_[0]=0,_[1]=u(s,g));break;case"XZY":_[2]=l(-n(o,-1,1)),h(o)<.99999?(_[0]=u(m,d),_[1]=u(s,a)):(_[0]=u(-f,g),_[1]=0);break;default:console.warn("Unkown order: "+r)}return e._dirty=!0,e},Object.defineProperties(a,{POSITIVE_X:{get:function(){return new a(1,0,0)}},NEGATIVE_X:{get:function(){return new a(-1,0,0)}},POSITIVE_Y:{get:function(){return new a(0,1,0)}},NEGATIVE_Y:{get:function(){return new a(0,-1,0)}},POSITIVE_Z:{get:function(){return new a(0,0,1)}},NEGATIVE_Z:{get:function(){return new a(0,0,-1)}},UP:{get:function(){return new a(0,1,0)}},ZERO:{get:function(){return new a}}}),t.a=a},function(e,t,r){"use strict";var n=r(7),i=r(11),a=r(57),o=n.a.extend({width:512,height:512,type:i.a.UNSIGNED_BYTE,format:i.a.RGBA,wrapS:i.a.REPEAT,wrapT:i.a.REPEAT,minFilter:i.a.LINEAR_MIPMAP_LINEAR,magFilter:i.a.LINEAR,useMipmap:!0,anisotropic:1,flipY:!0,sRGB:!0,unpackAlignment:4,premultiplyAlpha:!1,dynamic:!1,NPOT:!1,__used:0},function(){this._cache=new a.a},{getWebGLTexture:function(e){var t=e.gl,r=this._cache;return r.use(e.__uid__),r.miss("webgl_texture")&&r.put("webgl_texture",t.createTexture()),this.dynamic?this.update(e):r.isDirty()&&(this.update(e),r.fresh()),r.get("webgl_texture")},bind:function(){},unbind:function(){},dirty:function(){this._cache&&this._cache.dirtyAll()},update:function(e){},updateCommon:function(e){var t=e.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,this.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,this.unpackAlignment),this.format===i.a.DEPTH_COMPONENT&&(this.useMipmap=!1);var r=e.getGLExtension("EXT_sRGB");this.format!==o.SRGB||r||(this.format=o.RGB),this.format!==o.SRGB_ALPHA||r||(this.format=o.RGBA),this.NPOT=!this.isPowerOfTwo()},getAvailableWrapS:function(){return this.NPOT?i.a.CLAMP_TO_EDGE:this.wrapS},getAvailableWrapT:function(){return this.NPOT?i.a.CLAMP_TO_EDGE:this.wrapT},getAvailableMinFilter:function(){var e=this.minFilter;return this.NPOT||!this.useMipmap?e===i.a.NEAREST_MIPMAP_NEAREST||e===i.a.NEAREST_MIPMAP_LINEAR?i.a.NEAREST:e===i.a.LINEAR_MIPMAP_LINEAR||e===i.a.LINEAR_MIPMAP_NEAREST?i.a.LINEAR:e:e},getAvailableMagFilter:function(){return this.magFilter},nextHighestPowerOfTwo:function(e){--e;for(var t=1;t<32;t<<=1)e|=e>>t;return e+1},dispose:function(e){var t=this._cache;t.use(e.__uid__);var r=t.get("webgl_texture");r&&e.gl.deleteTexture(r),t.deleteContext(e.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(o.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e}}),Object.defineProperty(o.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e}}),o.BYTE=i.a.BYTE,o.UNSIGNED_BYTE=i.a.UNSIGNED_BYTE,o.SHORT=i.a.SHORT,o.UNSIGNED_SHORT=i.a.UNSIGNED_SHORT,o.INT=i.a.INT,o.UNSIGNED_INT=i.a.UNSIGNED_INT,o.FLOAT=i.a.FLOAT,o.HALF_FLOAT=36193,o.UNSIGNED_INT_24_8_WEBGL=34042,o.DEPTH_COMPONENT=i.a.DEPTH_COMPONENT,o.DEPTH_STENCIL=i.a.DEPTH_STENCIL,o.ALPHA=i.a.ALPHA,o.RGB=i.a.RGB,o.RGBA=i.a.RGBA,o.LUMINANCE=i.a.LUMINANCE,o.LUMINANCE_ALPHA=i.a.LUMINANCE_ALPHA,o.SRGB=35904,o.SRGB_ALPHA=35906,o.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,o.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,o.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,o.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,o.NEAREST=i.a.NEAREST,o.LINEAR=i.a.LINEAR,o.NEAREST_MIPMAP_NEAREST=i.a.NEAREST_MIPMAP_NEAREST,o.LINEAR_MIPMAP_NEAREST=i.a.LINEAR_MIPMAP_NEAREST,o.NEAREST_MIPMAP_LINEAR=i.a.NEAREST_MIPMAP_LINEAR,o.LINEAR_MIPMAP_LINEAR=i.a.LINEAR_MIPMAP_LINEAR,o.REPEAT=i.a.REPEAT,o.CLAMP_TO_EDGE=i.a.CLAMP_TO_EDGE,o.MIRRORED_REPEAT=i.a.MIRRORED_REPEAT,t.a=o},function(e,t,r){"use strict";function n(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function i(e,t){var r=n(e.width),i=n(e.height);return t=t||document.createElement("canvas"),t.width=r,t.height=i,t.getContext("2d").drawImage(e.image,0,0,r,i),t}var a=r(4),o=r(11),s=r(14),u=r(73),l=u.a.isPowerOfTwo,h=a.a.extend(function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}},{textureType:"texture2D",update:function(e){var t=e.gl;t.bindTexture(t.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(e);var r=this.format,n=this.type,i=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==a.a.REPEAT&&this.wrapT!==a.a.REPEAT||!this.NPOT);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i?this.wrapS:this.getAvailableWrapS()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i?this.wrapT:this.getAvailableWrapT()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,i?this.magFilter:this.getAvailableMagFilter()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,i?this.minFilter:this.getAvailableMinFilter());var s=e.getGLExtension("EXT_texture_filter_anisotropic");if(s&&this.anisotropic>1&&t.texParameterf(t.TEXTURE_2D,s.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===n){e.getGLExtension("OES_texture_half_float")||(n=o.a.FLOAT)}if(this.mipmaps.length)for(var u=this.width,l=this.height,h=0;h=a.a.COMPRESSED_RGB_S3TC_DXT1_EXT?e.compressedTexImage2D(e.TEXTURE_2D,r,s,n,o,0,t.pixels):e.texImage2D(e.TEXTURE_2D,r,s,n,o,0,s,u,t.pixels)},generateMipmap:function(e){var t=e.gl;this.useMipmap&&!this.NPOT&&(t.bindTexture(t.TEXTURE_2D,this._cache.get("webgl_texture")),t.generateMipmap(t.TEXTURE_2D))},isPowerOfTwo:function(){return l(this.width)&&l(this.height)},isRenderable:function(){return this.image?"CANVAS"===this.image.nodeName||"VIDEO"===this.image.nodeName||this.image.complete:!(!this.width||!this.height)},bind:function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,this.getWebGLTexture(e))},unbind:function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,null)},load:function(e,t){var r=s.a.createImage();t&&(r.crossOrigin=t);var n=this;return r.onload=function(){n.dirty(),n.trigger("success",n),r.onload=null},r.onerror=function(){n.trigger("error",n),r.onerror=null},r.src=e,this.image=r,this}});Object.defineProperty(h.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(e){this.image?console.warn("Texture from image can't set width"):(this._width!==e&&this.dirty(),this._width=e)}}),Object.defineProperty(h.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(e){this.image?console.warn("Texture from image can't set height"):(this._height!==e&&this.dirty(),this._height=e)}}),t.a=h},function(e,t,r){"use strict";var n=r(161);t.a=n.a},function(e,t,r){"use strict";var n=r(110),i=r(53),a=r(23),o=function(){this.__uid__=a.a.genGUID()};o.__initializers__=[function(e){a.a.extend(this,e)}],a.a.extend(o,n.a),a.a.extend(o.prototype,i.a),t.a=o},function(e,t,r){"use strict";function n(e){for(var t=[],r=0;r=0){if(1!==l&&4!==l){o();break}l=2,d=[]}else if(1!==l)if(4!==l)r(f),l=0;else{var p=f;g.indexOf(p)>=0||_.indexOf(p)>=0||v.indexOf(p)>=0?c[u].semantic=p:"ignore"===p||"unconfigurable"===p?c[u].ignore=!0:c[u].value="bool"===e?"true"===p:parseFloat(p)}else c[u].value="bool"===e?"true"===f:parseFloat(f),d=null;else{if(2!==l){o();break}if(!(d instanceof Array)){o();break}d.push(+i[++s])}else c[u].value=new h.a.Float32Array(d),d=null,l=5;else if(2===l){if(!(d instanceof Array)){o();break}d.push(+i[++s])}else l=5;else l=4;else{if(0!==l&&3!==l){o();break}l=1}}return c}function u(e,t){"object"==typeof e&&(t=e.fragment,e=e.vertex),e=a(e),t=a(t),this._shaderID=i(e,t),this._vertexCode=u.parseImport(e),this._fragmentCode=u.parseImport(t),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}var l=r(23),h=r(14),c=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g,d=/attribute\s+(float|int|vec2|vec3|vec4)\s+([\s\S]*?);/g,f=/#define\s+(\w+)?(\s+[\d-.]+)?\s*;?\s*\n/g,p={bool:"1i",int:"1i",sampler2D:"t",samplerCube:"t",float:"1f",vec2:"2f",vec3:"3f",vec4:"4f",ivec2:"2i",ivec3:"3i",ivec4:"4i",mat2:"m2",mat3:"m3",mat4:"m4"},m={bool:function(){return!0},int:function(){return 0},float:function(){return 0},sampler2D:function(){return null},samplerCube:function(){return null},vec2:function(){return n(2)},vec3:function(){return n(3)},vec4:function(){return n(4)},ivec2:function(){return n(2)},ivec3:function(){return n(3)},ivec4:function(){return n(4)},mat2:function(){return n(4)},mat3:function(){return n(9)},mat4:function(){return n(16)},array:function(){return[]}},g=["POSITION","NORMAL","BINORMAL","TANGENT","TEXCOORD","TEXCOORD_0","TEXCOORD_1","COLOR","JOINT","WEIGHT"],_=["SKIN_MATRIX","VIEWPORT_SIZE","VIEWPORT","DEVICEPIXELRATIO","WINDOW_SIZE","NEAR","FAR","TIME"],v=["WORLD","VIEW","PROJECTION","WORLDVIEW","VIEWPROJECTION","WORLDVIEWPROJECTION","WORLDINVERSE","VIEWINVERSE","PROJECTIONINVERSE","WORLDVIEWINVERSE","VIEWPROJECTIONINVERSE","WORLDVIEWPROJECTIONINVERSE","WORLDTRANSPOSE","VIEWTRANSPOSE","PROJECTIONTRANSPOSE","WORLDVIEWTRANSPOSE","VIEWPROJECTIONTRANSPOSE","WORLDVIEWPROJECTIONTRANSPOSE","WORLDINVERSETRANSPOSE","VIEWINVERSETRANSPOSE","PROJECTIONINVERSETRANSPOSE","WORLDVIEWINVERSETRANSPOSE","VIEWPROJECTIONINVERSETRANSPOSE","WORLDVIEWPROJECTIONINVERSETRANSPOSE"],y={vec4:4,vec3:3,vec2:2,float:1},x={},T={};u.prototype={constructor:u,createUniforms:function(){var e={};for(var t in this.uniformTemplates){var r=this.uniformTemplates[t];e[t]={type:r.type,value:r.value()}}return e},_parseImport:function(){this._vertexCode=u.parseImport(this.vertex),this._fragmentCode=u.parseImport(this.fragment)},_addSemanticUniform:function(e,t,r){if(g.indexOf(r)>=0)this.attributeSemantics[r]={symbol:e,type:t};else if(v.indexOf(r)>=0){var n=!1,i=r;r.match(/TRANSPOSE$/)&&(n=!0,i=r.slice(0,-9)),this.matrixSemantics[r]={symbol:e,type:t,isTranspose:n,semanticNoTranspose:i}}else _.indexOf(r)>=0&&(this.uniformSemantics[r]={symbol:e,type:t})},_addMaterialUniform:function(e,t,r,n,i,a){a[e]={type:r,value:i?m.array:n||m[t],semantic:null}},_parseUniforms:function(){function e(e){return null!=e?function(){return e}:null}function t(t,a,o){var u=s(a,o),l=[];for(var h in u){var c=u[h],d=c.semantic,f=h,m=p[a],g=e(u[h].value);u[h].isArray&&(f+="["+u[h].arraySize+"]",m+="v"),l.push(f),n._uniformList.push(h),c.ignore||("sampler2D"!==a&&"samplerCube"!==a||(n.textures[h]={shaderType:i,type:a}),d?n._addSemanticUniform(h,m,d):n._addMaterialUniform(h,a,m,g,u[h].isArray,r))}return l.length>0?"uniform "+a+" "+l.join(",")+";\n":""}var r={},n=this,i="vertex";this._uniformList=[],this._vertexCode=this._vertexCode.replace(c,t),i="fragment",this._fragmentCode=this._fragmentCode.replace(c,t),n.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=r},_parseAttributes:function(){function e(e,n,i){var a=s(n,i),o=y[n]||1,u=[];for(var l in a){var h=a[l].semantic;if(t[l]={type:"float",size:o,semantic:h||null},h){if(g.indexOf(h)<0)throw new Error('Unkown semantic "'+h+'"');r.attributeSemantics[h]={symbol:l,type:n}}u.push(l)}return"attribute "+n+" "+u.join(",")+";\n"}var t={},r=this;this._vertexCode=this._vertexCode.replace(d,e),this.attributes=t},_parseDefines:function(){function e(e,n,i){var a="vertex"===r?t.vertexDefines:t.fragmentDefines;return a[n]||(a[n]="false"!==i&&("true"===i||(i?isNaN(parseFloat(i))?i.trim():parseFloat(i):null))),""}var t=this,r="vertex";this._vertexCode=this._vertexCode.replace(f,e),r="fragment",this._fragmentCode=this._fragmentCode.replace(f,e)},clone:function(){var e=T[this._shaderID];return new u(e.vertex,e.fragment)}},Object.defineProperty&&(Object.defineProperty(u.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(u.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(u.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(u.prototype,"uniforms",{get:function(){return this._uniformList}}));var b=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;u.parseImport=function(e){return e=e.replace(b,function(e,t,r){var e=u.source(r);return e?u.parseImport(e):(console.error('Shader chunk "'+r+'" not existed in library'),"")})};var w=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;u.import=function(e){e.replace(w,function(e,t,r,n){var n=n.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"");if(n){for(var i,a=r.split("."),o=u.codes,s=0;s0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e},i.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.cross=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e},i.lerp=function(e,t,r,n){var i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e},i.random=function(e,t){t=t||1;var r=2*Object(n.c)()*Math.PI,i=2*Object(n.c)()-1,a=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*a,e[1]=Math.sin(r)*a,e[2]=i*t,e},i.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e},i.transformMat3=function(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e},i.transformQuat=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],l=r[3],h=l*n+s*a-u*i,c=l*i+u*n-o*a,d=l*a+o*i-s*n,f=-o*n-s*i-u*a;return e[0]=h*l+f*-o+c*-u-d*-s,e[1]=c*l+f*-s+d*-o-h*-u,e[2]=d*l+f*-u+h*-s-c*-o,e},i.rotateX=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},i.rotateY=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},i.rotateZ=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},i.forEach=function(){var e=i.create();return function(t,r,n,i,a,o){var s,u;for(r||(r=3),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s1?0:Math.acos(a)},t.a=i},function(e,t){function r(e,t){"createCanvas"===e&&(J=null),K[e]=t}function n(e){if(null==e||"object"!=typeof e)return e;var t=e,r=k.call(e);if("[object Array]"===r){if(!F(e)){t=[];for(var i=0,a=e.length;is[0]&&(s[0]=l),h>s[1]&&(s[1]=h),c>s[2]&&(s[2]=c)}r._dirty=!0,n._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var e=this.indices,t=this.attributes,r=t.position.value,a=t.normal.value;if(a&&a.length===r.length)for(var o=0;o65535&&(this.indices=new n.a.Uint32Array(this.indices));for(var e=this.attributes,t=this.indices,r=this.getEnabledAttributes(),i={},a=0;a=r.COLOR_ATTACHMENT0&&a<=r.COLOR_ATTACHMENT0+8&&i.push(a);n.drawBuffersEXT(i)}}this.trigger("beforerender",this,e);var o=this.clearDepth?r.DEPTH_BUFFER_BIT:0;if(r.depthMask(!0),this.clearColor){o|=r.COLOR_BUFFER_BIT,r.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&r.clearColor(s[0],s[1],s[2],s[3])}r.clear(o),this.blendWithPrevious?(r.enable(r.BLEND),this.material.transparent=!0):(r.disable(r.BLEND),this.material.transparent=!1),this.renderQuad(e),this.trigger("afterrender",this,e),t&&this.unbind(e,t)},renderQuad:function(e){d.material=this.material,e.renderPass([d],f)},dispose:function(e){}});t.a=p},function(e,t,r){"use strict";t.a=function(e,t,r){return{seriesType:e,reset:function(e,t){function r(e,t){var r=e.getItemModel(t),n=r.get(i,!0);null!=n&&e.setItemVisual(t,"opacity",n)}var n=e.getData(),i=e.visualColorAccessPath.split(".");i[i.length-1]="opacity";var a=e.get(i);return n.setVisual("opacity",null==a?1:a),{dataEach:n.hasItemOption?r:null}}}}},function(e,t,r){"use strict";var n=r(3),i=r(12),a=i.a.set,o=i.a.copy,s=function(e,t){this.min=e||new n.a(1/0,1/0,1/0),this.max=t||new n.a(-1/0,-1/0,-1/0),this.vertices=null};s.prototype={constructor:s,updateFromVertices:function(e){if(e.length>0){var t=this.min,r=this.max,n=t.array,i=r.array;o(n,e[0]),o(i,e[0]);for(var a=1;ai[0]&&(i[0]=s[0]),s[1]>i[1]&&(i[1]=s[1]),s[2]>i[2]&&(i[2]=s[2])}t._dirty=!0,r._dirty=!0}},union:function(e){var t=this.min,r=this.max;return i.a.min(t.array,t.array,e.min.array),i.a.max(r.array,r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},intersection:function(e){var t=this.min,r=this.max;return i.a.max(t.array,t.array,e.min.array),i.a.min(r.array,r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},intersectBoundingBox:function(e){var t=this.min.array,r=this.max.array,n=e.min.array,i=e.max.array;return!(t[0]>i[0]||t[1]>i[1]||t[2]>i[2]||r[0]=i[0]&&r[1]>=i[1]&&r[2]>=i[2]},containPoint:function(e){var t=this.min.array,r=this.max.array,n=e.array;return t[0]<=n[0]&&t[1]<=n[1]&&t[2]<=n[2]&&r[0]>=n[0]&&r[1]>=n[1]&&r[2]>=n[2]},isFinite:function(){var e=this.min.array,t=this.max.array;return isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])&&isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])},applyTransform:function(e){this.transformFrom(this,e)},transformFrom:function(){var e=i.a.create(),t=i.a.create(),r=i.a.create(),n=i.a.create(),a=i.a.create(),o=i.a.create();return function(i,s){var u=i.min.array,l=i.max.array,h=s.array;return e[0]=h[0]*u[0],e[1]=h[1]*u[0],e[2]=h[2]*u[0],t[0]=h[0]*l[0],t[1]=h[1]*l[0],t[2]=h[2]*l[0],r[0]=h[4]*u[1],r[1]=h[5]*u[1],r[2]=h[6]*u[1],n[0]=h[4]*l[1],n[1]=h[5]*l[1],n[2]=h[6]*l[1],a[0]=h[8]*u[2],a[1]=h[9]*u[2],a[2]=h[10]*u[2],o[0]=h[8]*l[2],o[1]=h[9]*l[2],o[2]=h[10]*l[2],u=this.min.array,l=this.max.array,u[0]=Math.min(e[0],t[0])+Math.min(r[0],n[0])+Math.min(a[0],o[0])+h[12],u[1]=Math.min(e[1],t[1])+Math.min(r[1],n[1])+Math.min(a[1],o[1])+h[13],u[2]=Math.min(e[2],t[2])+Math.min(r[2],n[2])+Math.min(a[2],o[2])+h[14],l[0]=Math.max(e[0],t[0])+Math.max(r[0],n[0])+Math.max(a[0],o[0])+h[12],l[1]=Math.max(e[1],t[1])+Math.max(r[1],n[1])+Math.max(a[1],o[1])+h[13],l[2]=Math.max(e[2],t[2])+Math.max(r[2],n[2])+Math.max(a[2],o[2])+h[14],this.min._dirty=!0,this.max._dirty=!0,this}}(),applyProjection:function(e){var t=this.min.array,r=this.max.array,n=e.array,i=t[0],a=t[1],o=t[2],s=r[0],u=r[1],l=t[2],h=r[0],c=r[1],d=r[2];if(1===n[15])t[0]=n[0]*i+n[12],t[1]=n[5]*a+n[13],r[2]=n[10]*o+n[14],r[0]=n[0]*h+n[12],r[1]=n[5]*c+n[13],t[2]=n[10]*d+n[14];else{var f=-1/o;t[0]=n[0]*i*f,t[1]=n[5]*a*f,r[2]=(n[10]*o+n[14])*f,f=-1/l,r[0]=n[0]*s*f,r[1]=n[5]*u*f,f=-1/d,t[2]=(n[10]*d+n[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var e=this.vertices;if(!e){e=[];for(var t=0;t<8;t++)e[t]=i.a.fromValues(0,0,0);this.vertices=e}var r=this.min.array,n=this.max.array;return a(e[0],r[0],r[1],r[2]),a(e[1],r[0],n[1],r[2]),a(e[2],n[0],r[1],r[2]),a(e[3],n[0],n[1],r[2]),a(e[4],r[0],r[1],n[2]),a(e[5],r[0],n[1],n[2]),a(e[6],n[0],r[1],n[2]),a(e[7],n[0],n[1],n[2]),this},copy:function(e){var t=this.min,r=this.max;return o(t.array,e.min.array),o(r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},clone:function(){var e=new s;return e.copy(this),e}},t.a=s},function(e,t,r){"use strict";function n(e){var t=Object.keys(e);t.sort();for(var r=[],n=0;n=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(e,t){if("object"==typeof e)for(var r in e){var n=e[r];this.setUniform(r,n)}else this.setUniform(e,t)},get:function(e){var t=this.uniforms[e];if(t)return t.value},attachShader:function(e,t){var r=this.uniforms;this.uniforms=e.createUniforms(),this.shader=e;var n=this.uniforms;this._enabledUniforms=Object.keys(n),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter(function(e){var t=this.uniforms[e].type;return"t"===t||"tv"===t},this);var i=this.vertexDefines,a=this.fragmentDefines;if(this.vertexDefines=o.a.clone(e.vertexDefines),this.fragmentDefines=o.a.clone(e.fragmentDefines),t){for(var s in r)n[s]&&(n[s].value=r[s].value);o.a.defaults(this.vertexDefines,i),o.a.defaults(this.fragmentDefines,a)}var u={};for(var l in e.textures)u[l]={shaderType:e.textures[l].shaderType,type:e.textures[l].type,enabled:!(!t||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=u,this._programKey=""},clone:function(){var e=new this.constructor({name:this.name,shader:this.shader});for(var t in this.uniforms)e.uniforms[t].value=this.uniforms[t].value;return e.depthTest=this.depthTest,e.depthMask=this.depthMask,e.transparent=this.transparent,e.blend=this.blend,e.vertexDefines=o.a.clone(this.vertexDefines),e.fragmentDefines=o.a.clone(this.fragmentDefines),e.enableTexture(this.getEnabledTextures()),e.precision=this.precision,e},define:function(e,t,r){var n=this.vertexDefines,i=this.fragmentDefines;"vertex"!==e&&"fragment"!==e&&"both"!==e&&arguments.length<3&&(r=t,t=e,e="both"),r=null!=r?r:null,"vertex"!==e&&"both"!==e||n[t]!==r&&(n[t]=r,this._programKey=""),"fragment"!==e&&"both"!==e||i[t]!==r&&(i[t]=r,"both"!==e&&(this._programKey=""))},undefine:function(e,t){"vertex"!==e&&"fragment"!==e&&"both"!==e&&arguments.length<2&&(t=e,e="both"),"vertex"!==e&&"both"!==e||this.isDefined("vertex",t)&&(delete this.vertexDefines[t],this._programKey=""),"fragment"!==e&&"both"!==e||this.isDefined("fragment",t)&&(delete this.fragmentDefines[t],"both"!==e&&(this._programKey=""))},isDefined:function(e,t){switch(e){case"vertex":return void 0!==this.vertexDefines[t];case"fragment":return void 0!==this.fragmentDefines[t]}},getDefine:function(e,t){switch(e){case"vertex":return this.vertexDefines[t];case"fragment":return this.fragmentDefines[t]}},enableTexture:function(e){if(Array.isArray(e))for(var t=0;t=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height};var _=new d.a;n.prototype.castRay=function(e,t,r){var n=this.layer.renderer,i=n.viewport;return n.viewport=this.viewport,n.screenToNDC(e,t,_),this.camera.castRay(_,r),n.viewport=i,r},n.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var e=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var t=0;t30},n.prototype._doRender=function(e,t,r){var n=this.scene,i=this.camera;r=r||0,this._updateTransparent(e,n,i,r),t||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(e,n,i,!0)),this._updateShadowPCFKernel(r);var a=e.clearColor;if(e.gl.clearColor(a[0],a[1],a[2],a[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(e,i),this._compositor.updateNormal(e,n,i,this._temporalSS.getFrame())),this._updateSSAO(e,n,i,this._temporalSS.getFrame()),this._enablePostEffect){var o=this._compositor.getSourceFrameBuffer();o.bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),e.render(n,i,!0,!0),o.unbind(e),this.needsTemporalSS()&&t?(this._compositor.composite(e,n,i,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),e.setViewport(this.viewport),this._temporalSS.render(e)):(e.setViewport(this.viewport),this._compositor.composite(e,n,i,null,0))}else if(this.needsTemporalSS()&&t){var o=this._temporalSS.getSourceFrameBuffer();o.bind(e),e.saveClear(),e.clearBit=e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT,e.render(n,i,!0,!0),e.restoreClear(),o.unbind(e),e.setViewport(this.viewport),this._temporalSS.render(e)}else e.setViewport(this.viewport),e.render(n,i,!0,!0)},n.prototype._updateTransparent=function(e,t,r,n){for(var i=new c.a,a=new h.a,o=r.getWorldPosition(),s=t.getRenderList(r).transparent,u=0;uthis.camera.far||e65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,n){return 1/(u.dist(e,t)+u.dist(r,t)+u.dist(n,r)+1)*this.segmentScale},getCubicCurveVertexCount:function(e,t,r,n){var i=this._getCubicCurveApproxStep(e,t,r,n),a=Math.ceil(1/i);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,n){var i=this._getCubicCurveApproxStep(e,t,r,n),a=Math.ceil(1/i);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(l)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(l)},getPolylineVertexCount:function(e){var t;if("number"==typeof e)t=e;else{t="number"!=typeof e[0]?e.length:e.length/3}return this.useNativeLine?2*(t-1):2*(t-1)+2},getPolylineTriangleCount:function(e){var t;if("number"==typeof e)t=e;else{t="number"!=typeof e[0]?e.length:e.length/3}return this.useNativeLine?0:2*Math.max(t-1,0)},addCubicCurve:function(e,t,r,n,i,a){null==a&&(a=1);for(var o=e[0],s=e[1],u=e[2],l=t[0],h=t[1],c=t[2],d=r[0],f=r[1],p=r[2],m=n[0],g=n[1],_=n[2],v=this._getCubicCurveApproxStep(e,t,r,n),y=v*v,x=y*v,T=3*v,b=3*y,w=6*y,E=6*x,S=o-2*l+d,A=s-2*h+f,M=u-2*c+p,C=3*(l-d)-o+m,L=3*(h-f)-s+g,D=3*(c-p)-u+_,N=o,R=s,P=u,I=(l-o)*T+S*b+C*x,O=(h-s)*T+A*b+L*x,F=(c-u)*T+M*b+D*x,B=S*w+C*E,U=A*w+L*E,z=M*w+D*E,G=C*E,H=L*E,V=D*E,k=0,W=0,j=Math.ceil(1/v),X=new Float32Array(3*(j+1)),X=[],q=0,W=0;W1&&(N=I>0?Math.min(N,m):Math.max(N,m),R=O>0?Math.min(R,g):Math.max(R,g),P=F>0?Math.min(P,_):Math.max(P,_));return this.addPolyline(X,i,a)},addLine:function(e,t,r,n){return this.addPolyline([e,t],r,n)},addPolyline:function(e,t,r,n,i){if(e.length){var a="number"!=typeof e[0];if(null==i&&(i=a?e.length:e.length/3),!(i<2)){null==n&&(n=0),null==r&&(r=1),this._itemVertexOffsets.push(this._vertexOffset);var o,s,a="number"!=typeof e[0],u=a?"number"!=typeof t[0]:t.length/4===i,l=this.attributes.position,h=this.attributes.positionPrev,c=this.attributes.positionNext,d=this.attributes.color,f=this.attributes.offset,p=this.indices,m=this._vertexOffset;r=Math.max(r,.01);for(var g=n;g1&&(l.copy(m,m-1),d.copy(m,m-1),m++):(g0&&(c.set(m-2,o),c.set(m-1,o)),l.set(m,o),l.set(m+1,o),d.set(m,s),d.set(m+1,s),f.set(m,r/2),f.set(m+1,-r/2),m+=2),this.useNativeLine)d.set(m,s),l.set(m,o),m++;else if(g>0){var y=3*this._triangleOffset,p=this.indices;p[y]=m-4,p[y+1]=m-3,p[y+2]=m-2,p[y+3]=m-3,p[y+4]=m-1,p[y+5]=m-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,T=this._vertexOffset+2*i;h.copy(x,x+2),h.copy(x+1,x+3),c.copy(T-1,T-3),c.copy(T-2,T-4)}return this._vertexOffset=m,this._vertexOffset}}},setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],n=e1&&t.texParameterf(t.TEXTURE_CUBE_MAP,i.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===n){e.getGLExtension("OES_texture_half_float")||(n=a.a.FLOAT)}if(this.mipmaps.length)for(var o=this.width,s=this.height,u=0;u0&&(o=1/Math.sqrt(o),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e[3]=t[3]*o),e},i.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},i.lerp=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e},i.random=function(e,t){return t=t||1,e[0]=Object(n.c)(),e[1]=Object(n.c)(),e[2]=Object(n.c)(),e[3]=Object(n.c)(),i.normalize(e,e),i.scale(e,e,t),e},i.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e},i.transformQuat=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],l=r[3],h=l*n+s*a-u*i,c=l*i+u*n-o*a,d=l*a+o*i-s*n,f=-o*n-s*i-u*a;return e[0]=h*l+f*-o+c*-u-d*-s,e[1]=c*l+f*-s+d*-o-h*-u,e[2]=d*l+f*-u+h*-s-c*-o,e},i.forEach=function(){var e=i.create();return function(t,r,n,i,a,o){var s,u;for(r||(r=4),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(e)):e instanceof s.a&&this.lights.push(e),e.name&&(this._nodeRepository[e.name]=e)},removeFromScene:function(e){var t;e instanceof u.a?(t=this._cameraList.indexOf(e))>=0&&this._cameraList.splice(t,1):e instanceof s.a&&(t=this.lights.indexOf(e))>=0&&this.lights.splice(t,1),e.name&&delete this._nodeRepository[e.name]},getNode:function(e){return this._nodeRepository[e]},setMainCamera:function(e){var t=this._cameraList.indexOf(e);t>=0&&this._cameraList.splice(t,1),this._cameraList.unshift(e)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var e=this.lights;this._previousLightNumber=this._lightNumber;for(var t={},r=0;r0&&this._doUpdateRenderList(o,t,r,n,i)}},isFrustumCulled:function(){var e=new l.a,t=new f.a;return function(r,n,i){var a=r.boundingBox;if(a||(a=r.skeleton&&r.skeleton.boundingBox?r.skeleton.boundingBox:r.geometry.boundingBox),!a)return!1;if(t.array=i,e.transformFrom(a,t),r.castShadow&&this.viewBoundingBoxLastFrame.union(e),r.frustumCulling){if(!e.intersectBoundingBox(n.frustum.boundingBox))return!0;t.array=n.projectionMatrix.array,e.max.array[2]>0&&e.min.array[2]<0&&(e.max.array[2]=-1e-20),e.applyProjection(t);var o=e.min.array,s=e.max.array;if(s[0]<-1||o[0]>1||s[1]<-1||o[1]>1||s[2]<-1||o[2]>1)return!0}return!1}}(),_updateLightUniforms:function(){var e=this.lights;e.sort(a);var t=this._lightUniforms;for(var r in t)for(var n in t[r])t[r][n].value.length=0;for(var i=0;i0?e[t].value=new Float32Array(e[t].value):e[t].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}}},function(e,t,r){"use strict";function n(e,t){var r=[];return a.a.util.each(e.dimensions,function(n){var i=e.getDimensionInfo(n),a=i.otherDims,o=a[t];null!=o&&!1!==o&&(r[o]=i.name)}),r}var i=r(0),a=r.n(i);t.a=function(e,t,r){var i=e.getData(),o=e.getRawValue(t),s=a.a.util.isArray(o)?function(e){function o(e,t){var n=i.getDimensionInfo(t);if(n&&!1!==n.otherDims.tooltip){var o=n.type,l=(s?"- "+(n.tooltipName||n.name)+": ":"")+("ordinal"===o?e+"":"time"===o?r?"":a.a.format.formatTime("yyyy/MM/dd hh:mm:ss",e):a.a.format.addCommas(e));l&&u.push(a.a.format.encodeHTML(l))}}var s=!0,u=[],l=n(i,"tooltip");return l.length?a.a.util.each(l,function(e){o(i.get(e,t),e)}):a.a.util.each(e,o),(s?"
":"")+u.join(s?"
":", ")}(o):a.a.format.encodeHTML(a.a.format.addCommas(o)),u=i.getName(t),l=i.getItemVisual(t,"color");a.a.util.isObject(l)&&l.colorStops&&(l=(l.colorStops[0]||{}).color),l=l||"transparent";var h=a.a.format.getTooltipMarker(l),c=e.name;return"\0-"===c&&(c=""),c=c?a.a.format.encodeHTML(c)+(r?": ":"
"):"",r?h+c+s:c+h+(u?a.a.format.encodeHTML(u)+": "+s:s)}},function(e,t,r){"use strict";var n=r(72),i=r(11),a=n.a.extend({skeleton:null,joints:null,useSkinMatricesTexture:!1},function(){this.joints||(this.joints=[])},{isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var e=n.a.prototype.clone.call(this);return e.skeleton=this.skeleton,this.joints&&(e.joints=this.joints.slice()),e}});a.POINTS=i.a.POINTS,a.LINES=i.a.LINES,a.LINE_LOOP=i.a.LINE_LOOP,a.LINE_STRIP=i.a.LINE_STRIP,a.TRIANGLES=i.a.TRIANGLES,a.TRIANGLE_STRIP=i.a.TRIANGLE_STRIP,a.TRIANGLE_FAN=i.a.TRIANGLE_FAN,a.BACK=i.a.BACK,a.FRONT=i.a.FRONT,a.FRONT_AND_BACK=i.a.FRONT_AND_BACK,a.CW=i.a.CW,a.CCW=i.a.CCW,t.a=a},function(e,t,r){"use strict";var n=r(58),i=n.a.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var e=this.fov/180*Math.PI;this.projectionMatrix.perspective(e,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var e=this.projectionMatrix.array,t=2*Math.atan(1/e[5]);this.fov=t/Math.PI*180,this.aspect=e[5]/e[0],this.near=e[14]/(e[10]-1),this.far=e[14]/(e[10]+1)},clone:function(){var e=n.a.prototype.clone.call(this);return e.fov=this.fov,e.aspect=this.aspect,e.near=this.near,e.far=this.far,e}});t.a=i},function(e,t,r){"use strict";var n=r(40),i=r(76),a=r(8),o=r(19),s=r(4),u=r(121);a.a.import(u.a);var l=n.a.extend(function(){var e=new a.a({vertex:a.a.source("clay.skybox.vertex"),fragment:a.a.source("clay.skybox.fragment")}),t=new o.a({shader:e,depthMask:!1});return{scene:null,geometry:new i.a,material:t,environmentMap:null,culling:!1}},function(){var e=this.scene;e&&this.attachScene(e),this.environmentMap&&this.setEnvironmentMap(this.environmentMap)},{attachScene:function(e){this.scene&&this.detachScene(),e.skybox=this,this.scene=e,e.on("beforerender",this._beforeRenderScene,this)},detachScene:function(){this.scene&&(this.scene.off("beforerender",this._beforeRenderScene),this.scene.skybox=null),this.scene=null},dispose:function(e){this.detachScene(),this.geometry.dispose(e)},setEnvironmentMap:function(e){"texture2D"===e.textureType?(this.material.define("EQUIRECTANGULAR"),e.minFilter=s.a.LINEAR):this.material.undefine("EQUIRECTANGULAR"),this.material.set("environmentMap",e)},getEnvironmentMap:function(){return this.material.get("environmentMap")},_beforeRenderScene:function(e,t,r){this.renderSkybox(e,r)},renderSkybox:function(e,t){this.position.copy(t.getWorldPosition()),this.update(),e.gl.disable(e.gl.BLEND),this.material.get("lod")>0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),e.renderPass([this],t)}});t.a=l},function(e,t,r){"use strict";var n=r(15),i=r(18),a=n.a.extend({dynamic:!1,widthSegments:1,heightSegments:1},function(){this.build()},{build:function(){for(var e=this.heightSegments,t=this.widthSegments,r=this.attributes,n=[],a=[],o=[],s=[],u=0;u<=e;u++)for(var l=u/e,h=0;h<=t;h++){var c=h/t;if(n.push([2*c-1,2*l-1,0]),a&&a.push([c,l]),o&&o.push([0,0,1]),h0&&this._notFirst?this.animateTo({alpha:h,beta:c,center:d,distance:a,targetOrthographicSize:o,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(a),this.setAlpha(h),this.setBeta(c),this.setCenter(d),this.setOrthographicSize(o)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){},animateTo:function(e){var t=this.zr,r=this,n={},i={};return null!=e.distance&&(n.distance=this.getDistance(),i.distance=e.distance),null!=e.orthographicSize&&(n.orthographicSize=this.getOrthographicSize(),i.orthographicSize=e.orthographicSize),null!=e.alpha&&(n.alpha=this.getAlpha(),i.alpha=e.alpha),null!=e.beta&&(n.beta=this.getBeta(),i.beta=e.beta),null!=e.center&&(n.center=this.getCenter(),i.center=e.center),this._addAnimator(t.animation.animate(n).when(e.duration||1e3,i).during(function(){null!=n.alpha&&r.setAlpha(n.alpha),null!=n.beta&&r.setBeta(n.beta),null!=n.distance&&r.setDistance(n.distance),null!=n.center&&r.setCenter(n.center),null!=n.orthographicSize&&r.setOrthographicSize(n.orthographicSize),r._needsUpdate=!0})).start(e.easing||"linear")},stopAllAnimation:function(){for(var e=0;e0},_update:function(e){if(this._rotating){var t=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=t*e/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(e=Math.min(e,50),this._updateDistanceOrSize(e),this._updatePan(e),this._updateRotate(e),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(e){var t=this._rotateVelocity;this._phi=t.y*e/20+this._phi,this._theta=t.x*e/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(t,Math.pow(this.damping,e/16))},_updateDistanceOrSize:function(e){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*e/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*e/20),this._zoomSpeed*=Math.pow(this.damping,e/16)},_setDistance:function(e){this._distance=Math.max(Math.min(e,this.maxDistance),this.minDistance)},_setOrthoSize:function(e){this._orthoSize=Math.max(Math.min(e,this.maxOrthographicSize),this.minOrthographicSize);var t=this.getCamera(),r=this._orthoSize,n=r/this.viewGL.viewport.height*this.viewGL.viewport.width;t.left=-n/2,t.right=n/2,t.top=r/2,t.bottom=-r/2},_updatePan:function(e){var t=this._panVelocity,r=this._distance,n=this.getCamera(),i=n.worldTransform.y,a=n.worldTransform.x;this._center.scaleAndAdd(a,-t.x*r/200).scaleAndAdd(i,-t.y*r/200),this._vectorDamping(t,0)},_updateTransform:function(){var e=this.getCamera(),t=new o.a,r=this._theta+Math.PI/2,n=this._phi+Math.PI/2,i=Math.sin(r);t.x=i*Math.cos(n),t.y=-Math.cos(r),t.z=i*Math.sin(n),e.position.copy(this._center).scaleAndAdd(t,this._distance),e.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var e=this.autoRotateAfterStill,t=this;!isNaN(e)&&e>0&&(this._stillTimeout=setTimeout(function(){t._rotating=!0},1e3*e))},_vectorDamping:function(e,t){var r=e.len();r*=t,r<1e-4&&(r=0),e.normalize().scale(r)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var e=this.getCamera().worldTransform.z,t=Math.asin(e.y),r=Math.atan2(e.x,e.z);this._theta=t,this._phi=-r,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(e){if(!e.target&&!this._isAnimating()){var t=e.offsetX,r=e.offsetY;this.viewGL&&!this.viewGL.containPoint(t,r)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),e.event.targetTouches?1===e.event.targetTouches.length&&(this._mode="rotate"):e.event.button===l[this.rotateMouseButton]?this._mode="rotate":e.event.button===l[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=e.offsetX,this._mouseY=e.offsetY)}},_mouseMoveHandler:function(e){if(!(e.target&&e.target.__isGLToZRProxy||this._isAnimating())){var t=n(this.panSensitivity),r=n(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(e.offsetX-this._mouseX)/this.zr.getHeight()*2*r[0],this._rotateVelocity.x=(e.offsetY-this._mouseY)/this.zr.getWidth()*2*r[1]):"pan"===this._mode&&(this._panVelocity.x=(e.offsetX-this._mouseX)/this.zr.getWidth()*t[0]*400,this._panVelocity.y=(-e.offsetY+this._mouseY)/this.zr.getHeight()*t[1]*400),this._mouseX=e.offsetX,this._mouseY=e.offsetY,e.event.preventDefault()}},_mouseWheelHandler:function(e){if(!this._isAnimating()){var t=e.event.wheelDelta||-e.event.detail;this._zoomHandler(e,t)}},_pinchHandler:function(e){this._isAnimating()||(this._zoomHandler(e,e.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(e,t){if(0!==t){var r=e.offsetX,n=e.offsetY;if(!this.viewGL||this.viewGL.containPoint(r,n)){var i;i="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(t>0?-1:1)*i*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),e.event.preventDefault()}}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(e){this._isRightMouseButtonUsed()&&e.preventDefault()},_addAnimator:function(e){var t=this._animators;return t.push(e),e.done(function(){var r=t.indexOf(e);r>=0&&t.splice(r,1)}),e}});Object.defineProperty(h.prototype,"autoRotate",{get:function(e){return this._autoRotate},set:function(e){this._autoRotate=e,this._rotating=e}}),t.a=h},function(e,t,r){"use strict";t.a="@export ecgl.lines3D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, 1.0);\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n}\n@end\n\n\n\n@export ecgl.lines3D.clipNear\n\nvec4 clipNear(vec4 p1, vec4 p2) {\n float n = (p1.w - near) / (p1.w - p2.w);\n return vec4(mix(p1.xy, p2.xy, n), -near, near);\n}\n\n@end\n\n@export ecgl.lines3D.expandLine\n#ifdef VERTEX_ANIMATION\n vec4 prevProj = worldViewProjection * vec4(mix(prevPositionPrev, positionPrev, percent), 1.0);\n vec4 currProj = worldViewProjection * vec4(mix(prevPosition, position, percent), 1.0);\n vec4 nextProj = worldViewProjection * vec4(mix(prevPositionNext, positionNext, percent), 1.0);\n#else\n vec4 prevProj = worldViewProjection * vec4(positionPrev, 1.0);\n vec4 currProj = worldViewProjection * vec4(position, 1.0);\n vec4 nextProj = worldViewProjection * vec4(positionNext, 1.0);\n#endif\n\n if (currProj.w < 0.0) {\n if (nextProj.w > 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"},function(e,t,r){function n(e,t,r,n,i){var a=0,o=0;null==n&&(n=1/0),null==i&&(i=1/0);var s=0;t.eachChild(function(u,l){var h,c,d=u.position,f=u.getBoundingRect(),p=t.childAt(l+1),m=p&&p.getBoundingRect();if("horizontal"===e){var g=f.width+(m?-m.x+f.x:0);h=a+g,h>n||u.newline?(a=0,h=g,o+=s+r,s=f.height):s=Math.max(s,f.height)}else{var _=f.height+(m?-m.y+f.y:0);c=o+_,c>i||u.newline?(a+=s+r,o=0,c=_,s=f.width):s=Math.max(s,f.width)}u.newline||(d[0]=a,d[1]=o,"horizontal"===e?a=h+r:o=c+r)})}function i(e,t,r){var n=t.width,i=t.height,a=p(e.x,n),o=p(e.y,i),s=p(e.x2,n),u=p(e.y2,i);return(isNaN(a)||isNaN(parseFloat(e.x)))&&(a=0),(isNaN(s)||isNaN(parseFloat(e.x2)))&&(s=n),(isNaN(o)||isNaN(parseFloat(e.y)))&&(o=0),(isNaN(u)||isNaN(parseFloat(e.y2)))&&(u=i),r=m.normalizeCssArray(r||0),{width:Math.max(s-a-r[1]-r[3],0),height:Math.max(u-o-r[0]-r[2],0)}}function a(e,t,r){r=m.normalizeCssArray(r||0);var n=t.width,i=t.height,a=p(e.left,n),o=p(e.top,i),s=p(e.right,n),u=p(e.bottom,i),l=p(e.width,n),h=p(e.height,i),c=r[2]+r[0],f=r[1]+r[3],g=e.aspect;switch(isNaN(l)&&(l=n-s-f-a),isNaN(h)&&(h=i-u-c-o),null!=g&&(isNaN(l)&&isNaN(h)&&(g>n/i?l=.8*n:h=.8*i),isNaN(l)&&(l=g*h),isNaN(h)&&(h=l/g)),isNaN(a)&&(a=n-s-l-f),isNaN(o)&&(o=i-u-h-c),e.left||e.right){case"center":a=n/2-l/2-r[3];break;case"right":a=n-l-f}switch(e.top||e.bottom){case"middle":case"center":o=i/2-h/2-r[0];break;case"bottom":o=i-h-c}a=a||0,o=o||0,isNaN(l)&&(l=n-f-a-(s||0)),isNaN(h)&&(h=i-c-o-(u||0));var _=new d(a+r[3],o+r[0],l,h);return _.margin=r,_}function o(e,t,r,n,i){var o=!i||!i.hv||i.hv[0],s=!i||!i.hv||i.hv[1],u=i&&i.boundingMode||"all";if(o||s){var l;if("raw"===u)l="group"===e.type?new d(0,0,+t.width||0,+t.height||0):e.getBoundingRect();else if(l=e.getBoundingRect(),e.needLocalTransform()){var h=e.getLocalTransform();l=l.clone(),l.applyTransform(h)}t=a(c.defaults({width:l.width,height:l.height},t),r,n);var f=e.position,p=o?t.x-l.x:0,m=s?t.y-l.y:0;e.attr("position","raw"===u?[p,m]:[f[0]+p,f[1]+m])}}function s(e,t){return null!=e[v[t][0]]||null!=e[v[t][1]]&&null!=e[v[t][2]]}function u(e,t,r){function n(r,n){var o={},u=0,l={},h=0;if(g(r,function(t){l[t]=e[t]}),g(r,function(e){i(t,e)&&(o[e]=l[e]=t[e]),a(o,e)&&u++,a(l,e)&&h++}),s[n])return a(t,r[1])?l[r[2]]=null:a(t,r[2])&&(l[r[1]]=null),l;if(2!==h&&u){if(u>=2)return o;for(var c=0;c0){var t=this.outputs[e];t.keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e])}}});t.a=i},function(e,t,r){"use strict";function n(e,t){for(var r=0,n=1/t,i=e;i>0;)r+=n*(i%t),i=Math.floor(i/t),n/=t;return r}t.a=n},function(e,t,r){"use strict";var n=r(0),i=r.n(n);t.a=function(e,t,r){r=r||e.getSource();var n=t||i.a.getCoordinateSystemDimensions(e.get("coordinateSystem"))||["x","y","z"],a=i.a.helper.createDimensions(r,{dimensionsDefine:r.dimensionsDefine||e.get("dimensions"),encodeDefine:r.encodeDefine||e.get("encode"),coordDimensions:n.map(function(t){var r=e.getReferringComponents(t+"Axis3D")[0];return{type:r&&"category"===r.get("type")?"ordinal":"float",name:t}})});"cartesian3D"===e.get("coordinateSystem")&&a.forEach(function(t){if(n.indexOf(t.coordDim)>=0){var r=e.getReferringComponents(t.coordDim+"Axis3D")[0];r&&"category"===r.get("type")&&(t.ordinalMeta=r.getOrdinalMeta())}});var o=i.a.helper.dataStack.enableDataStack(e,a,{byIndex:!0,stackedCoordDimension:"z"}),s=new i.a.List(a,e);return s.setCalculationInfo(o),s.initData(r),s}},function(e,t){function r(e,t,r){return{seriesType:e,performRawSeries:!0,reset:function(e,n,i){function a(t,r){if("function"==typeof u){var n=e.getRawValue(r),i=e.getDataParams(r);t.setItemVisual(r,"symbolSize",u(n,i))}if(t.hasItemOption){var a=t.getItemModel(r),o=a.getShallow("symbol",!0),s=a.getShallow("symbolSize",!0),l=a.getShallow("symbolKeepAspect",!0);null!=o&&t.setItemVisual(r,"symbol",o),null!=s&&t.setItemVisual(r,"symbolSize",s),null!=l&&t.setItemVisual(r,"symbolKeepAspect",l)}}var o=e.getData(),s=e.get("symbol")||t,u=e.get("symbolSize"),l=e.get("symbolKeepAspect");if(o.setVisual({legendSymbol:r||s,symbol:s,symbolSize:u,symbolKeepAspect:l}),!n.isSeriesFiltered(e)){var h="function"==typeof u;return{dataEach:o.hasItemOption||h?a:null}}}}}e.exports=r},function(e,t,r){"use strict";function n(e){return e.material}function i(e,t,r){return t.uniforms[r].value}function a(e,t,r,n){return r!==n}function o(e){return!0}function s(){}function u(e,t,r){this.availableAttributes=e,this.availableAttributeSymbols=t,this.indicesBuffer=r,this.vao=null}function l(e){var t,r;this.bind=function(e){t||(t=f.a.createCanvas(),t.width=t.height=1,t.getContext("2d"));var n=e.gl,i=!r;i&&(r=n.createTexture()),n.bindTexture(n.TEXTURE_2D,r),i&&n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t)},this.unbind=function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var h=r(7),c=r(111),d=r(11),f=r(14),p=r(19),m=r(26),g=r(115),_=r(8),v=r(71),y=r(21),x=r(12);_.a.import(v.a);var T=y.a.create,b={},w={float:d.a.FLOAT,byte:d.a.BYTE,ubyte:d.a.UNSIGNED_BYTE,short:d.a.SHORT,ushort:d.a.UNSIGNED_SHORT},E=h.a.extend(function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}},function(){this.canvas||(this.canvas=f.a.createCanvas());var e=this.canvas;try{var t={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!this.gl)throw new Error;this._glinfo=new c.a(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(e){throw"Error creating WebGL Context "+e}this._programMgr=new g.a(this),this._placeholderTexture=new l(this)},{resize:function(e,t){var r=this.canvas,n=this.devicePixelRatio;null!=e?(r.style.width=e+"px",r.style.height=t+"px",r.width=e*n,r.height=t*n,this._width=e,this._height=t):(this._width=r.width/n,this._height=r.height/n),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var e=this.viewport;return e.width/e.height},setDevicePixelRatio:function(e){this.devicePixelRatio=e,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(e){return this._glinfo.getExtension(e)},getGLParameter:function(e){return this._glinfo.getParameter(e)},setViewport:function(e,t,r,n,i){if("object"==typeof e){var a=e;e=a.x,t=a.y,r=a.width,n=a.height,i=a.devicePixelRatio}i=i||this.devicePixelRatio,this.gl.viewport(e*i,t*i,r*i,n*i),this.viewport={x:e,y:t,width:r,height:n,devicePixelRatio:i}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var e=this._clearStack.pop();this.clearColor=e.clearColor,this.clearBit=e.clearBit}},bindSceneRendering:function(e){this._sceneRendering=e},render:function(e,t,r,n){var i=this.gl,a=this.clearColor;if(this.clearBit){i.colorMask(!0,!0,!0,!0),i.depthMask(!0);var o=this.viewport,s=!1,u=o.devicePixelRatio;(o.width!==this._width||o.height!==this._height||u&&u!==this.devicePixelRatio||o.x||o.y)&&(s=!0,i.enable(i.SCISSOR_TEST),i.scissor(o.x*u,o.y*u,o.width*u,o.height*u)),i.clearColor(a[0],a[1],a[2],a[3]),i.clear(this.clearBit),s&&i.disable(i.SCISSOR_TEST)}if(r||e.update(!1),e.updateLights(),!(t=t||e.getMainCamera()))return void console.error("Can't find camera in the scene.");t.update();var l=e.updateRenderList(t,!0);this._sceneRendering=e;var h=l.opaque,c=l.transparent,d=e.material;e.trigger("beforerender",this,e,t,l),n?(this.renderPreZ(h,e,t),i.depthFunc(i.LEQUAL)):i.depthFunc(i.LESS);for(var f=T(),p=x.a.create(),m=0;m0){var u=e[a-1],l=u.joints?u.joints.length:0;if((o.joints?o.joints.length:0)===l&&o.material===u.material&&o.lightGroup===u.lightGroup){o.__program=u.__program;continue}}var h=this._programMgr.getProgram(o,s,t);this.validateProgram(h),o.__program=h}},renderPass:function(e,t,r){this.trigger("beforerenderpass",this,e,t,r),r=r||{},r.getMaterial=r.getMaterial||n,r.getUniform=r.getUniform||i,r.isMaterialChanged=r.isMaterialChanged||a,r.beforeRender=r.beforeRender||s,r.afterRender=r.afterRender||s;var u=r.ifRender||o;this.updatePrograms(e,this._sceneRendering,r),r.sortCompare&&e.sort(r.sortCompare);var l=this.viewport,h=l.devicePixelRatio,c=[l.x*h,l.y*h,l.width*h,l.height*h],d=this.devicePixelRatio,f=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*d,this._height*d],p=[c[2],c[3]],m=Date.now();t?(y.a.copy(S.VIEW,t.viewMatrix.array),y.a.copy(S.PROJECTION,t.projectionMatrix.array),y.a.copy(S.VIEWINVERSE,t.worldTransform.array)):(y.a.identity(S.VIEW),y.a.identity(S.PROJECTION),y.a.identity(S.VIEWINVERSE)),y.a.multiply(S.VIEWPROJECTION,S.PROJECTION,S.VIEW),y.a.invert(S.PROJECTIONINVERSE,S.PROJECTION),y.a.invert(S.VIEWPROJECTIONINVERSE,S.VIEWPROJECTION);for(var g,_,v,x,T,b,w,E,A,M,C,L,D=this.gl,N=this._sceneRendering,R=this.getGLExtension("OES_vertex_array_object"),P=0;Pthis._glinfo.getMaxJointNumber()){var a=i.getSubSkinMatricesTexture(e.__uid__,e.joints);t.useTextureSlot(this,a,r),t.setUniform(n,"1i","skinMatricesTexture",r),t.setUniform(n,"1f","skinMatricesTextureSize",a.width)}else{var o=i.getSubSkinMatrices(e.__uid__,e.joints);t.setUniformOfSemantic(n,"SKIN_MATRIX",o)}},_renderObject:function(e,t){var r=this.gl,n=e.geometry,i=e.mode;if(null==i&&(i=4),t.indicesBuffer){var a=this.getGLExtension("OES_element_index_uint"),o=a&&n.indices instanceof Uint32Array,s=o?r.UNSIGNED_INT:r.UNSIGNED_SHORT;r.drawElements(i,t.indicesBuffer.count,s,0)}else r.drawArrays(i,0,n.vertexCount)},_bindMaterial:function(e,t,r,n,i,a,o){for(var s=this.gl,u=a===r,l=r.currentTextureSlot(),h=t.getEnabledUniforms(),c=t.getTextureUniforms(),d=this._placeholderTexture,f=0;fc)){var d=Math.sqrt(c-h),f=u-d,p=u+d;return a||(a=new n.a),f<0?p<0?null:(i.a.scaleAndAdd(a.array,o,s,p),a):(i.a.scaleAndAdd(a.array,o,s,f),a)}}}(),intersectBoundingBox:function(e,t){var r,a,o,s,u,l,h=this.direction.array,c=this.origin.array,d=e.min.array,f=e.max.array,p=1/h[0],m=1/h[1],g=1/h[2];if(p>=0?(r=(d[0]-c[0])*p,a=(f[0]-c[0])*p):(a=(d[0]-c[0])*p,r=(f[0]-c[0])*p),m>=0?(o=(d[1]-c[1])*m,s=(f[1]-c[1])*m):(s=(d[1]-c[1])*m,o=(f[1]-c[1])*m),r>s||o>a)return null;if((o>r||r!==r)&&(r=o),(s=0?(u=(d[2]-c[2])*g,l=(f[2]-c[2])*g):(l=(d[2]-c[2])*g,u=(f[2]-c[2])*g),r>l||u>a)return null;if((u>r||r!==r)&&(r=u),(l=0?r:a;return t||(t=new n.a),i.a.scaleAndAdd(t.array,c,h,_),t},intersectTriangle:function(){var e=i.a.create(),t=i.a.create(),r=i.a.create(),a=i.a.create();return function(o,s,u,l,h,c){var d=this.direction.array,f=this.origin.array;o=o.array,s=s.array,u=u.array,i.a.sub(e,s,o),i.a.sub(t,u,o),i.a.cross(a,t,d);var p=i.a.dot(e,a);if(l){if(p>-1e-5)return null}else if(p>-1e-5&&p<1e-5)return null;i.a.sub(r,f,o);var m=i.a.dot(a,r)/p;if(m<0||m>1)return null;i.a.cross(a,e,r);var g=i.a.dot(d,a)/p;if(g<0||g>1||m+g>1)return null;i.a.cross(a,e,t);var _=-i.a.dot(r,a)/p;return _<0?null:(h||(h=new n.a),c&&n.a.set(c,1-m-g,m,g),i.a.scaleAndAdd(h.array,f,d,_),h)}}(),applyTransform:function(e){n.a.add(this.direction,this.direction,this.origin),n.a.transformMat4(this.origin,this.origin,e),n.a.transformMat4(this.direction,this.direction,e),n.a.sub(this.direction,this.direction,this.origin),n.a.normalize(this.direction,this.direction)},copy:function(e){n.a.copy(this.origin,e.origin),n.a.copy(this.direction,e.direction)},clone:function(){var e=new a;return e.copy(this),e}},t.a=a},function(e,t,r){"use strict";var n=r(20),i=r(12),a=r(33),o=r(34),s={};s.create=function(){var e=new n.a(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},s.rotationTo=function(){var e=i.a.create(),t=i.a.fromValues(1,0,0),r=i.a.fromValues(0,1,0);return function(n,a,o){var u=i.a.dot(a,o);return u<-.999999?(i.a.cross(e,t,a),i.a.length(e)<1e-6&&i.a.cross(e,r,a),i.a.normalize(e,e),s.setAxisAngle(n,e,Math.PI),n):u>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(i.a.cross(e,a,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+u,s.normalize(n,n))}}(),s.setAxes=function(){var e=o.a.create();return function(t,r,n,i){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],s.normalize(t,s.fromMat3(t,e))}}(),s.clone=a.a.clone,s.fromValues=a.a.fromValues,s.copy=a.a.copy,s.set=a.a.set,s.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},s.setAxisAngle=function(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e},s.add=a.a.add,s.multiply=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],l=r[2],h=r[3];return e[0]=n*h+o*s+i*l-a*u,e[1]=i*h+o*u+a*s-n*l,e[2]=a*h+o*l+n*u-i*s,e[3]=o*h-n*s-i*u-a*l,e},s.mul=s.multiply,s.scale=a.a.scale,s.rotateX=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e},s.rotateY=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e},s.rotateZ=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e},s.calculateW=function(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e},s.dot=a.a.dot,s.lerp=a.a.lerp,s.slerp=function(e,t,r,n){var i,a,o,s,u,l=t[0],h=t[1],c=t[2],d=t[3],f=r[0],p=r[1],m=r[2],g=r[3];return a=l*f+h*p+c*m+d*g,a<0&&(a=-a,f=-f,p=-p,m=-m,g=-g),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,u=Math.sin(n*i)/o):(s=1-n,u=n),e[0]=s*l+u*f,e[1]=s*h+u*p,e[2]=s*c+u*m,e[3]=s*d+u*g,e},s.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e},s.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},s.length=a.a.length,s.len=s.length,s.squaredLength=a.a.squaredLength,s.sqrLen=s.squaredLength,s.normalize=a.a.normalize,s.fromMat3=function(e,t){var r,n=t[0]+t[4]+t[8];if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+i]+t[3*i+a])*r,e[o]=(t[3*o+i]+t[3*i+o])*r}return e},t.a=s},function(e,t,r){"use strict";var n=r(55),i=r(34),a=function(e,t,r,i){e=e||0,t=t||0,r=r||0,i=void 0===i?1:i,this.array=n.a.fromValues(e,t,r,i),this._dirty=!0};a.prototype={constructor:a,add:function(e){return n.a.add(this.array,this.array,e.array),this._dirty=!0,this},calculateW:function(){return n.a.calculateW(this.array,this.array),this._dirty=!0,this},set:function(e,t,r,n){return this.array[0]=e,this.array[1]=t,this.array[2]=r,this.array[3]=n,this._dirty=!0,this},setArray:function(e){return this.array[0]=e[0],this.array[1]=e[1],this.array[2]=e[2],this.array[3]=e[3],this._dirty=!0,this},clone:function(){return new a(this.x,this.y,this.z,this.w)},conjugate:function(){return n.a.conjugate(this.array,this.array),this._dirty=!0,this},copy:function(e){return n.a.copy(this.array,e.array),this._dirty=!0,this},dot:function(e){return n.a.dot(this.array,e.array)},fromMat3:function(e){return n.a.fromMat3(this.array,e.array),this._dirty=!0,this},fromMat4:function(){var e=i.a.create();return function(t){return i.a.fromMat4(e,t.array),i.a.transpose(e,e),n.a.fromMat3(this.array,e),this._dirty=!0,this}}(),identity:function(){return n.a.identity(this.array),this._dirty=!0,this},invert:function(){return n.a.invert(this.array,this.array),this._dirty=!0,this},len:function(){return n.a.len(this.array)},length:function(){return n.a.length(this.array)},lerp:function(e,t,r){return n.a.lerp(this.array,e.array,t.array,r),this._dirty=!0,this},mul:function(e){return n.a.mul(this.array,this.array,e.array),this._dirty=!0,this},mulLeft:function(e){return n.a.multiply(this.array,e.array,this.array),this._dirty=!0,this},multiply:function(e){return n.a.multiply(this.array,this.array,e.array),this._dirty=!0,this},multiplyLeft:function(e){return n.a.multiply(this.array,e.array,this.array),this._dirty=!0,this},normalize:function(){return n.a.normalize(this.array,this.array),this._dirty=!0,this},rotateX:function(e){return n.a.rotateX(this.array,this.array,e),this._dirty=!0,this},rotateY:function(e){return n.a.rotateY(this.array,this.array,e),this._dirty=!0,this},rotateZ:function(e){return n.a.rotateZ(this.array,this.array,e),this._dirty=!0,this},rotationTo:function(e,t){return n.a.rotationTo(this.array,e.array,t.array),this._dirty=!0,this},setAxes:function(e,t,r){return n.a.setAxes(this.array,e.array,t.array,r.array),this._dirty=!0,this},setAxisAngle:function(e,t){return n.a.setAxisAngle(this.array,e.array,t),this._dirty=!0,this},slerp:function(e,t,r){return n.a.slerp(this.array,e.array,t.array,r),this._dirty=!0,this},sqrLen:function(){return n.a.sqrLen(this.array)},squaredLength:function(){return n.a.squaredLength(this.array)},fromEuler:function(e,t){return a.fromEuler(this,e,t)},toString:function(){return"["+Array.prototype.join.call(this.array,",")+"]"},toArray:function(){return Array.prototype.slice.call(this.array)}};var o=Object.defineProperty;if(o){var s=a.prototype;o(s,"x",{get:function(){return this.array[0]},set:function(e){this.array[0]=e,this._dirty=!0}}),o(s,"y",{get:function(){return this.array[1]},set:function(e){this.array[1]=e,this._dirty=!0}}),o(s,"z",{get:function(){return this.array[2]},set:function(e){this.array[2]=e,this._dirty=!0}}),o(s,"w",{get:function(){return this.array[3]},set:function(e){this.array[3]=e,this._dirty=!0}})}a.add=function(e,t,r){return n.a.add(e.array,t.array,r.array),e._dirty=!0,e},a.set=function(e,t,r,i,a){n.a.set(e.array,t,r,i,a),e._dirty=!0},a.copy=function(e,t){return n.a.copy(e.array,t.array),e._dirty=!0,e},a.calculateW=function(e,t){return n.a.calculateW(e.array,t.array),e._dirty=!0,e},a.conjugate=function(e,t){return n.a.conjugate(e.array,t.array),e._dirty=!0,e},a.identity=function(e){return n.a.identity(e.array),e._dirty=!0,e},a.invert=function(e,t){return n.a.invert(e.array,t.array),e._dirty=!0,e},a.dot=function(e,t){return n.a.dot(e.array,t.array)},a.len=function(e){return n.a.length(e.array)},a.lerp=function(e,t,r,i){return n.a.lerp(e.array,t.array,r.array,i),e._dirty=!0,e},a.slerp=function(e,t,r,i){return n.a.slerp(e.array,t.array,r.array,i),e._dirty=!0,e},a.mul=function(e,t,r){return n.a.multiply(e.array,t.array,r.array),e._dirty=!0,e},a.multiply=a.mul,a.rotateX=function(e,t,r){return n.a.rotateX(e.array,t.array,r),e._dirty=!0,e},a.rotateY=function(e,t,r){return n.a.rotateY(e.array,t.array,r),e._dirty=!0,e},a.rotateZ=function(e,t,r){return n.a.rotateZ(e.array,t.array,r),e._dirty=!0,e},a.setAxisAngle=function(e,t,r){return n.a.setAxisAngle(e.array,t.array,r),e._dirty=!0,e},a.normalize=function(e,t){return n.a.normalize(e.array,t.array),e._dirty=!0,e},a.sqrLen=function(e){return n.a.sqrLen(e.array)},a.squaredLength=a.sqrLen,a.fromMat3=function(e,t){return n.a.fromMat3(e.array,t.array),e._dirty=!0,e},a.setAxes=function(e,t,r,i){return n.a.setAxes(e.array,t.array,r.array,i.array),e._dirty=!0,e},a.rotationTo=function(e,t,r){return n.a.rotationTo(e.array,t.array,r.array),e._dirty=!0,e},a.fromEuler=function(e,t,r){e._dirty=!0,t=t.array;var n=e.array,i=Math.cos(t[0]/2),a=Math.cos(t[1]/2),o=Math.cos(t[2]/2),s=Math.sin(t[0]/2),u=Math.sin(t[1]/2),l=Math.sin(t[2]/2),r=(r||"XYZ").toUpperCase();switch(r){case"XYZ":n[0]=s*a*o+i*u*l,n[1]=i*u*o-s*a*l,n[2]=i*a*l+s*u*o,n[3]=i*a*o-s*u*l;break;case"YXZ":n[0]=s*a*o+i*u*l,n[1]=i*u*o-s*a*l,n[2]=i*a*l-s*u*o,n[3]=i*a*o+s*u*l;break;case"ZXY":n[0]=s*a*o-i*u*l,n[1]=i*u*o+s*a*l,n[2]=i*a*l+s*u*o,n[3]=i*a*o-s*u*l;break;case"ZYX":n[0]=s*a*o-i*u*l,n[1]=i*u*o+s*a*l,n[2]=i*a*l-s*u*o,n[3]=i*a*o+s*u*l;break;case"YZX":n[0]=s*a*o+i*u*l,n[1]=i*u*o+s*a*l,n[2]=i*a*l-s*u*o,n[3]=i*a*o-s*u*l;break;case"XZY":n[0]=s*a*o-i*u*l,n[1]=i*u*o-s*a*l,n[2]=i*a*l+s*u*o,n[3]=i*a*o+s*u*l}},t.a=a},function(e,t,r){"use strict";var n=function(){this._contextId=0,this._caches=[],this._context={}};n.prototype={use:function(e,t){var r=this._caches;r[e]||(r[e]={},t&&(r[e]=t())),this._contextId=e,this._context=r[e]},put:function(e,t){this._context[e]=t},get:function(e){return this._context[e]},dirty:function(e){e=e||"";var t="__dt__"+e;this.put(t,!0)},dirtyAll:function(e){e=e||"";for(var t="__dt__"+e,r=this._caches,n=0;n=this._maxSize&&o>0){var u=r.head;r.remove(u),delete n[u.key],a=u.value,this._lastRemovedEntry=u}s?s.value=t:s=new i(t),s.key=e,r.insertEntry(s),n[e]=s}return a},o.get=function(e){var t=this._map[e],r=this._list;if(null!=t)return t!==r.tail&&(r.remove(t),r.insertEntry(t)),t.value},o.clear=function(){this._list.clear(),this._map={}};var s=a;e.exports=s},function(e,t,r){"use strict";var n=r(5),i=r(27),a=r(14),o=r(62),s=r(75),u=r(36),l=r(122),h=r(123),c={loadTexture:function(e,t,r,a){var o;if("function"==typeof t?(r=t,a=r,t={}):t=t||{},"string"==typeof e){if(e.match(/.hdr$/)||"hdr"===t.fileType)return o=new n.a({width:0,height:0,sRGB:!1}),c._fetchTexture(e,function(e){h.a.parseRGBE(e,o,t.exposure),o.dirty(),r&&r(o)},a),o;e.match(/.dds$/)||"dds"===t.fileType?(o=new n.a({width:0,height:0}),c._fetchTexture(e,function(e){l.a.parse(e,o),o.dirty(),r&&r(o)},a)):(o=new n.a,o.load(e),o.success(r),o.error(a))}else"object"==typeof e&&void 0!==e.px&&(o=new i.a,o.load(e),o.success(r),o.error(a));return o},loadPanorama:function(e,t,r,n,i,a){var o=this;"function"==typeof n?(i=n,a=i,n={}):n=n||{},c.loadTexture(t,n,function(t){t.flipY=n.flipY||!1,o.panoramaToCubeMap(e,t,r,n),t.dispose(e),i&&i(r)},a)},panoramaToCubeMap:function(e,t,r,n){var i=new o.a,a=new s.a({scene:new u.a});return a.setEnvironmentMap(t),n=n||{},n.encodeRGBM&&a.material.define("fragment","RGBM_ENCODE"),r.sRGB=t.sRGB,i.texture=r,i.render(e,a.scene),i.texture=null,i.dispose(e),r},heightToNormal:function(e,t){var r=document.createElement("canvas"),n=r.width=e.width,i=r.height=e.height,a=r.getContext("2d");a.drawImage(e,0,0,n,i),t=t||!1;for(var o=a.getImageData(0,0,n,i),s=a.createImageData(n,i),u=0;u20)return console.warn("Given image is not a height map"),e}var d,f,p,m;u%(4*n)==0?(d=o.data[u],p=o.data[u+4]):u%(4*n)==4*(n-1)?(d=o.data[u-4],p=o.data[u]):(d=o.data[u-4],p=o.data[u+4]),u<4*n?(f=o.data[u],m=o.data[u+4*n]):u>n*(i-1)*4?(f=o.data[u-4*n],m=o.data[u]):(f=o.data[u-4*n],m=o.data[u+4*n]),s.data[u]=d-p+127,s.data[u+1]=f-m+127,s.data[u+2]=255,s.data[u+3]=255}return a.putImageData(s,0,0),r},isHeightImage:function(e,t,r){if(!e||!e.width||!e.height)return!1;var n=document.createElement("canvas"),i=n.getContext("2d"),a=t||32;r=r||20,n.width=n.height=a,i.drawImage(e,0,0,a,a);for(var o=i.getImageData(0,0,a,a),s=0;sr)return!1}return!0},_fetchTexture:function(e,t,r){a.a.request.get({url:e,responseType:"arraybuffer",onload:t,onerror:r})},createChessboard:function(e,t,r,i){e=e||512,t=t||64,r=r||"black",i=i||"white";var a=Math.ceil(e/t),o=document.createElement("canvas");o.width=e,o.height=e;var s=o.getContext("2d");s.fillStyle=i,s.fillRect(0,0,e,e),s.fillStyle=r;for(var u=0;u65535?new Uint32Array(3*s):new Uint16Array(3*s),f.material.shader!==t&&f.material.attachShader(t,!0),o.a.setMaterialFromModel(t.__shading,f.material,e,r),u>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(u),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(a),this._vertexRangeOfDataIndex=new Uint32Array(2*(i-n))},_updateRegionMesh:function(e,t,r,n){for(var i=e.getData(),a=0,s=0,u=!1,h=this._polygonMesh,c=this._linesMesh,d=r;d0;E&&(w*=t.getDevicePixelRatio(),this._updateLinesGeometry(c.geometry,e,d,x,w,e.coordinateSystem.transform)),c.invisible=!E,c.material.set({color:v})}var h=this._polygonMesh;h.material.transparent=u,h.material.depthMask=!u,h.geometry.updateBoundingBox(),h.frontFace=this.extrudeY?o.a.Mesh.CCW:o.a.Mesh.CW,h.material.get("normalMap")&&h.geometry.generateTangents(),h.seriesIndex=e.seriesIndex,h.on("mousemove",this._onmousemove,this),h.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(e){var t=e.getModel("debug.wireframe");if(t.get("show")){var r=o.a.parseColor(t.get("lineStyle.color")||"rgba(0,0,0,0.5)"),n=l.a.firstNotNull(t.get("lineStyle.width"),1),i=this._polygonMesh;i.geometry.generateBarycentric(),i.material.define("both","WIREFRAME_TRIANGLE"),i.material.set("wireframeLineColor",r),i.material.set("wireframeLineWidth",n)}},_onmousemove:function(e){var t=this._dataIndexOfVertex[e.triangle[0]];null==t&&(t=-1),t!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(t),this._labelsBuilder.updateLabels([t])),this._lastHoverDataIndex=t,this._polygonMesh.dataIndex=t},_onmouseout:function(e){e.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(e,t,r){var n=e.getModel("groundPlane",e);if(this._groundMesh.invisible=!n.get("show",!0),!this._groundMesh.invisible){var i=e.get("shading"),a=this._groundMaterials[i];a||(a=this._groundMaterials.lambert),o.a.setMaterialFromModel(i,a,n,r),a.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=a,this._groundMesh.material.set("color",o.a.parseColor(n.get("color"))),this._groundMesh.scale.set(t.size[0],t.size[2],1)}},_triangulation:function(e,t,r){this._triangulationResults=[];for(var n=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0],a=e.coordinateSystem,o=t;o1?n:0,R[V][y]=C.points[W+2],h.set(i+V,R[V]),l?(F[0]=(C.points[W]*x[0]-T[0])/w,F[1]=(C.points[W+2]*x[y]-T[y])/w):(F[0]=(k?B:B+H)/w,F[1]=(R[V][v]*x[v]-T[v])/w),d.set(i+V,F)}p.sub(P,R[1],R[0]),p.sub(I,R[3],R[0]),p.cross(O,P,I),p.normalize(O,O);for(var V=0;V<4;V++)c.set(i+V,O),g&&f.set(i+V,o);for(var V=0;V<6;V++)_[3*a+V]=N[V]+i;i+=4,a+=2,B+=H}}return t.dirty(),{vertexOffset:i,triangleOffset:a}},_getRegionLinesInfo:function(e,t,r){var n=0,i=0;t.getRegionModel(e).getModel("itemStyle").get("borderWidth")>0&&t.getRegionPolygonCoords(e).forEach(function(e){var t=e.exterior,a=e.interiors;n+=r.getPolylineVertexCount(t),i+=r.getPolylineTriangleCount(t);for(var o=0;othis._endIndex)){t-=this._startIndex;for(var n=this._vertexRangeOfDataIndex[2*t];n=2e4},doSortTriangles:function(e,t){var r=this.indices;if(0===t){var n=this.attributes.position,e=e.array;this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new r.constructor(r.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var i,l=0,h=0;h0,r={},n=0;n2?(g=this._updateSymbolSprite(e,p,d,f),u.enableTexture("sprite")):u.disableTexture("sprite"),c.position.init(i-n);var _=[];if(m){u.undefine("VERTEX_SIZE"),u.undefine("VERTEX_COLOR");var v=o.getVisual("color"),y=o.getVisual("opacity");s.a.parseColor(v,_),_[3]*=y,u.set({color:_,u_Size:d.maxSize*this._sizeScale})}else u.set({color:[1,1,1,1]}),u.define("VERTEX_SIZE"),u.define("VERTEX_COLOR"),c.size.init(i-n),c.color.init(i-n),this._originalOpacity=new Float32Array(i-n);for(var x=o.getLayout("points"),T=c.position.value,b=0;b1?(a[0]=r.maxSize,a[1]=r.maxSize/r.aspect):(a[1]=r.maxSize,a[0]=r.maxSize*r.aspect),a[0]=a[0]||1,a[1]=a[1]||1,this._symbolType===r.type&&n(this._symbolSize,a)&&this._lineWidth===t.lineWidth||(u.a.createSymbolSprite(r.type,a,{fill:"#fff",lineWidth:t.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(a[0]/2,10)},this._spriteImageCanvas),u.a.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=r.type,this._symbolSize=a,this._lineWidth=t.lineWidth),this._spriteImageCanvas.width/r.maxSize*i},_updateMaterial:function(e,t){var r="lighter"===e.get("blendMode")?s.a.additiveBlend:null,n=this._mesh.material;n.blend=r,n.set("lineWidth",t.lineWidth/20);var i=s.a.parseColor(t.stroke);n.set("strokeColor",i),n.transparent=!0,n.depthMask=!1,n.depthTest=!this.is2D,n.sortVertices=!this.is2D},_updateLabelBuilder:function(e,t,r){var n=e.getData(),i=this._mesh.geometry,a=i.attributes.position.value,t=this._startDataIndex,o=this._mesh.sizeScale;this._labelsBuilder.updateData(n,t,r),this._labelsBuilder.getLabelPosition=function(e,r,n){var i=3*(e-t);return[a[i],a[i+1],a[i+2]]},this._labelsBuilder.getLabelDistance=function(e,r,n){return i.attributes.size.get(e-t)/o/2+n},this._labelsBuilder.updateLabels()},_updateAnimation:function(e){s.a.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,e)},_updateHandler:function(e,t,r){var n,i=e.getData(),a=this._mesh,o=this,s=-1,u=e.coordinateSystem&&"cartesian3D"===e.coordinateSystem.type;u&&(n=e.coordinateSystem.model),a.seriesIndex=e.seriesIndex,a.off("mousemove"),a.off("mouseout"),a.on("mousemove",function(t){var l=t.vertexIndex+o._startDataIndex;l!==s&&(this.highlightOnMouseover&&(this.downplay(i,s),this.highlight(i,l),this._labelsBuilder.updateLabels([l])),u&&r.dispatchAction({type:"grid3DShowAxisPointer",value:[i.get(e.coordDimToDataDim("x")[0],l),i.get(e.coordDimToDataDim("y")[0],l),i.get(e.coordDimToDataDim("z")[0],l)],grid3DIndex:n.componentIndex})),a.dataIndex=l,s=l},this),a.on("mouseout",function(e){var t=e.vertexIndex+o._startDataIndex;this.highlightOnMouseover&&(this.downplay(i,t),this._labelsBuilder.updateLabels()),s=-1,a.dataIndex=-1,u&&r.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:n.componentIndex})},this)},updateLayout:function(e,t,r){var n=e.getData();if(this._mesh){var i=this._mesh.geometry.attributes.position.value,a=n.getLayout("points");if(this.is2D)for(var o=0;othis._endDataIndex||tthis._endDataIndex||t=this._maxSize&&r>0){var n=this._list.head;this._list.remove(n),delete this._map[n.key]}var i=this._list.insert(t);i.key=e,this._map[e]=i}},i.prototype.get=function(e){var t=this._map[e];if(this._map.hasOwnProperty(e))return t!==this._list.tail&&(this._list.remove(t),this._list.insertEntry(t)),t.value},i.prototype.remove=function(e){var t=this._map[e];void 0!==t&&(delete this._map[e],this._list.remove(t))},i.prototype.clear=function(){this._list.clear(),this._map={}},t.a=i},function(e,t,r){"use strict";var n=r(20),i={};i.create=function(){var e=new n.a(2);return e[0]=0,e[1]=0,e},i.clone=function(e){var t=new n.a(2);return t[0]=e[0],t[1]=e[1],t},i.fromValues=function(e,t){var r=new n.a(2);return r[0]=e,r[1]=t,r},i.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},i.set=function(e,t,r){return e[0]=t,e[1]=r,e},i.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},i.subtract=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e},i.sub=i.subtract,i.multiply=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e},i.mul=i.multiply,i.divide=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e},i.div=i.divide,i.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e},i.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e},i.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},i.scaleAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e},i.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},i.len=i.length,i.squaredLength=function(e){var t=e[0],r=e[1];return t*t+r*r},i.sqrLen=i.squaredLength,i.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},i.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},i.normalize=function(e,t){var r=t[0],n=t[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),e[0]=t[0]*i,e[1]=t[1]*i),e},i.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},i.cross=function(e,t,r){var n=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=n,e},i.lerp=function(e,t,r,n){var i=t[0],a=t[1];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e},i.random=function(e,t){t=t||1;var r=2*GLMAT_RANDOM()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e},i.transformMat2=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e},i.transformMat2d=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e},i.transformMat3=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e},i.transformMat4=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e},i.forEach=function(){var e=i.create();return function(t,r,n,i,a,o){var s,u;for(r||(r=2),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s0},beforeRender:function(e){},afterRender:function(e,t){},getBoundingBox:function(e,t){return t=n.a.prototype.getBoundingBox.call(this,e,t),this.geometry&&this.geometry.boundingBox&&t.union(this.geometry.boundingBox),t},clone:function(){var e=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"];return function(){var t=n.a.prototype.clone.call(this);t.geometry=this.geometry,t.material=this.material;for(var r=0;r>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},n.nearestPowerOfTwo=function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},t.a=n},function(e,t,r){"use strict";var n=r(3),i=r(21),a=r(12),o=r(33),s=function(e,t){this.normal=e||new n.a(0,1,0),this.distance=t||0};s.prototype={constructor:s,distanceToPoint:function(e){return a.a.dot(e.array,this.normal.array)-this.distance},projectPoint:function(e,t){t||(t=new n.a);var r=this.distanceToPoint(e);return a.a.scaleAndAdd(t.array,e.array,this.normal.array,-r),t._dirty=!0,t},normalize:function(){var e=1/a.a.len(this.normal.array);a.a.scale(this.normal.array,e),this.distance*=e},intersectFrustum:function(e){for(var t=e.vertices,r=this.normal.array,n=a.a.dot(t[0].array,r)>this.distance,i=1;i<8;i++)if(a.a.dot(t[i].array,r)>this.distance!=n)return!0},intersectLine:function(){var e=a.a.create();return function(t,r,i){var o=this.distanceToPoint(t),s=this.distanceToPoint(r);if(o>0&&s>0||o<0&&s<0)return null;var u=this.normal.array,l=this.distance,h=t.array;a.a.sub(e,r.array,t.array),a.a.normalize(e,e);var c=a.a.dot(u,e);if(0===c)return null;i||(i=new n.a);var d=(a.a.dot(u,h)-l)/c;return a.a.scaleAndAdd(i.array,h,e,-d),i._dirty=!0,i}}(),applyTransform:function(){var e=i.a.create(),t=o.a.create(),r=o.a.create();return r[3]=1,function(n){n=n.array,a.a.scale(r,this.normal.array,this.distance),o.a.transformMat4(r,r,n),this.distance=a.a.dot(r,this.normal.array),i.a.invert(e,n),i.a.transpose(e,e),t[3]=0,a.a.copy(t,this.normal.array),o.a.transformMat4(t,t,e),a.a.copy(this.normal.array,t)}}(),copy:function(e){a.a.copy(this.normal.array,e.normal.array),this.normal._dirty=!0,this.distance=e.distance},clone:function(){var e=new s;return e.copy(this),e}},t.a=s},function(e,t,r){"use strict";var n=r(42);t.a=n.a},function(e,t,r){"use strict";function n(e,t,r){h.identity();var n=new a.a({widthSegments:t,heightSegments:r});switch(e){case"px":o.a.translate(h,h,s.a.POSITIVE_X),o.a.rotateY(h,h,Math.PI/2);break;case"nx":o.a.translate(h,h,s.a.NEGATIVE_X),o.a.rotateY(h,h,-Math.PI/2);break;case"py":o.a.translate(h,h,s.a.POSITIVE_Y),o.a.rotateX(h,h,-Math.PI/2);break;case"ny":o.a.translate(h,h,s.a.NEGATIVE_Y),o.a.rotateX(h,h,Math.PI/2);break;case"pz":o.a.translate(h,h,s.a.POSITIVE_Z);break;case"nz":o.a.translate(h,h,s.a.NEGATIVE_Z),o.a.rotateY(h,h,Math.PI)}return n.applyTransform(h),n}var i=r(15),a=r(43),o=r(9),s=r(3),u=r(18),l=r(14),h=new o.a,c=i.a.extend({dynamic:!1,widthSegments:1,heightSegments:1,depthSegments:1,inside:!1},function(){this.build()},{build:function(){var e={px:n("px",this.depthSegments,this.heightSegments),nx:n("nx",this.depthSegments,this.heightSegments),py:n("py",this.widthSegments,this.depthSegments),ny:n("ny",this.widthSegments,this.depthSegments),pz:n("pz",this.widthSegments,this.heightSegments),nz:n("nz",this.widthSegments,this.heightSegments)},t=["position","texcoord0","normal"],r=0,i=0;for(var a in e)r+=e[a].vertexCount,i+=e[a].indices.length;for(var o=0;o>>16)>>>0;c=((1431655765&c)<<1|(2863311530&c)>>>1)>>>0,c=((858993459&c)<<2|(3435973836&c)>>>2)>>>0,c=((252645135&c)<<4|(4042322160&c)>>>4)>>>0,c=(((16711935&c)<<8|(4278255360&c)>>>8)>>>0)/4294967296;var d=Math.sqrt((1-c)/(1+(l*l-1)*c));o[h]=d}for(var h=0;ho&&(i=this._x=0,a+=this._rowHeight+u,this._y=a,this._rowHeight=0),this._x+=t+u,this._rowHeight=Math.max(this._rowHeight,r),a+r+u>s)return null;e.position[0]+=this.offsetX*this.dpr+i,e.position[1]+=this.offsetY*this.dpr+a,this._zr.add(e);var l=[this.offsetX/this.width,this.offsetY/this.height];return[[i/o+l[0],a/s+l[1]],[(i+t)/o+l[0],(a+r)/s+l[1]]]},_fitElement:function(e,t,r){var n=e.getBoundingRect(),i=t/n.width,a=r/n.height;e.position=[-n.x*i,-n.y*a],e.scale=[i,a],e.update()}},i.prototype={clear:function(){for(var e=0;e=e)){var o=(i+this._nodeWidth)*this._dpr,s=(a+this._nodeHeight)*this._dpr;try{this._zr.resize({width:o,height:s})}catch(e){this._canvas.width=o,this._canvas.height=s}var u=new n(this._zr,i,a,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(u),u}},add:function(e,t,r){if(this._coords[e.id])return this._coords[e.id];var n=this._getCurrentNode().add(e,t,r);if(!n){var i=this._expand();if(!i)return;n=i.add(e,t,r)}return this._coords[e.id]=n,n},getCoordsScale:function(){var e=this._dpr;return[this._nodeWidth/this._canvas.width*e,this._nodeHeight/this._canvas.height*e]},getCoords:function(e){return this._coords[e]}},t.a=i},function(e,t,r){function n(e,t,r,n){r<0&&(e+=r,r=-r),n<0&&(t+=n,n=-n),this.x=e,this.y=t,this.width=r,this.height=n}var i=r(83),a=r(84),o=i.applyTransform,s=Math.min,u=Math.max;n.prototype={constructor:n,union:function(e){var t=s(e.x,this.x),r=s(e.y,this.y);this.width=u(e.x+e.width,this.x+this.width)-t,this.height=u(e.y+e.height,this.y+this.height)-r,this.x=t,this.y=r},applyTransform:function(){var e=[],t=[],r=[],n=[];return function(i){if(i){e[0]=r[0]=this.x,e[1]=n[1]=this.y,t[0]=n[0]=this.x+this.width,t[1]=r[1]=this.y+this.height,o(e,e,i),o(t,t,i),o(r,r,i),o(n,n,i),this.x=s(e[0],t[0],r[0],n[0]),this.y=s(e[1],t[1],r[1],n[1]);var a=u(e[0],t[0],r[0],n[0]),l=u(e[1],t[1],r[1],n[1]);this.width=a-this.x,this.height=l-this.y}}}(),calculateTransform:function(e){var t=this,r=e.width/t.width,n=e.height/t.height,i=a.create();return a.translate(i,i,[-t.x,-t.y]),a.scale(i,i,[r,n]),a.translate(i,i,[e.x,e.y]),i},intersect:function(e){if(!e)return!1;e instanceof n||(e=n.create(e));var t=this,r=t.x,i=t.x+t.width,a=t.y,o=t.y+t.height,s=e.x,u=e.x+e.width,l=e.y,h=e.y+e.height;return!(i=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},clone:function(){return new n(this.x,this.y,this.width,this.height)},copy:function(e){this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},n.create=function(e){return new n(e.x,e.y,e.width,e.height)};var l=n;e.exports=l},function(e,t){function r(e,t){var r=new w(2);return null==e&&(e=0),null==t&&(t=0),r[0]=e,r[1]=t,r}function n(e,t){return e[0]=t[0],e[1]=t[1],e}function i(e){var t=new w(2);return t[0]=e[0],t[1]=e[1],t}function a(e,t,r){return e[0]=t,e[1]=r,e}function o(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function s(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e}function u(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function l(e){return Math.sqrt(h(e))}function h(e){return e[0]*e[0]+e[1]*e[1]}function c(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function d(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function f(e,t){return e[0]*t[0]+e[1]*t[1]}function p(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function m(e,t){var r=l(t);return 0===r?(e[0]=0,e[1]=0):(e[0]=t[0]/r,e[1]=t[1]/r),e}function g(e,t){return Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1]))}function _(e,t){return(e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])}function v(e,t){return e[0]=-t[0],e[1]=-t[1],e}function y(e,t,r,n){return e[0]=t[0]+n*(r[0]-t[0]),e[1]=t[1]+n*(r[1]-t[1]),e}function x(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function T(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function b(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}var w="undefined"==typeof Float32Array?Array:Float32Array,E=l,S=h,A=g,M=_;t.create=r,t.copy=n,t.clone=i,t.set=a,t.add=o,t.scaleAndAdd=s,t.sub=u,t.len=l,t.length=E,t.lenSquare=h,t.lengthSquare=S,t.mul=c,t.div=d,t.dot=f,t.scale=p,t.normalize=m,t.distance=g,t.dist=A,t.distanceSquare=_,t.distSquare=M,t.negate=v,t.lerp=y,t.applyTransform=x,t.min=T,t.max=b},function(e,t){function r(){var e=new c(6);return n(e),e}function n(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function i(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function a(e,t,r){var n=t[0]*r[0]+t[2]*r[1],i=t[1]*r[0]+t[3]*r[1],a=t[0]*r[2]+t[2]*r[3],o=t[1]*r[2]+t[3]*r[3],s=t[0]*r[4]+t[2]*r[5]+t[4],u=t[1]*r[4]+t[3]*r[5]+t[5];return e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e}function o(e,t,r){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+r[0],e[5]=t[5]+r[1],e}function s(e,t,r){var n=t[0],i=t[2],a=t[4],o=t[1],s=t[3],u=t[5],l=Math.sin(r),h=Math.cos(r);return e[0]=n*h+o*l,e[1]=-n*l+o*h,e[2]=i*h+s*l,e[3]=-i*l+h*s,e[4]=h*a+l*u,e[5]=h*u-l*a,e}function u(e,t,r){var n=r[0],i=r[1];return e[0]=t[0]*n,e[1]=t[1]*i,e[2]=t[2]*n,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*i,e}function l(e,t){var r=t[0],n=t[2],i=t[4],a=t[1],o=t[3],s=t[5],u=r*o-a*n;return u?(u=1/u,e[0]=o*u,e[1]=-a*u,e[2]=-n*u,e[3]=r*u,e[4]=(n*s-o*i)*u,e[5]=(a*i-r*s)*u,e):null}function h(e){var t=r();return i(t,e),t}var c="undefined"==typeof Float32Array?Array:Float32Array;t.create=r,t.identity=n,t.copy=i,t.mul=a,t.translate=o,t.rotate=s,t.scale=u,t.invert=l,t.clone=h},function(e,t,r){function n(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function i(e,t,r,n){var i=t[1]-t[0],a=r[1]-r[0];if(0===i)return 0===a?r[0]:(r[0]+r[1])/2;if(n)if(i>0){if(e<=t[0])return r[0];if(e>=t[1])return r[1]}else{if(e>=t[0])return r[0];if(e<=t[1])return r[1]}else{if(e===t[0])return r[0];if(e===t[1])return r[1]}return(e-t[0])/i*a+r[0]}function a(e,t){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%"}return"string"==typeof e?n(e).match(/%$/)?parseFloat(e)/100*t:parseFloat(e):null==e?NaN:+e}function o(e,t,r){return null==t&&(t=10),t=Math.min(Math.max(0,t),20),e=(+e).toFixed(t),r?e:+e}function s(e){return e.sort(function(e,t){return e-t}),e}function u(e){if(e=+e,isNaN(e))return 0;for(var t=1,r=0;Math.round(e*t)/t!==e;)t*=10,r++;return r}function l(e){var t=e.toString(),r=t.indexOf("e");if(r>0){var n=+t.slice(r+1);return n<0?-n:0}var i=t.indexOf(".");return i<0?0:t.length-1-i}function h(e,t){var r=Math.log,n=Math.LN10,i=Math.floor(r(e[1]-e[0])/n),a=Math.round(r(Math.abs(t[1]-t[0]))/n),o=Math.min(Math.max(-i+a,0),20);return isFinite(o)?o:20}function c(e,t,r){if(!e[t])return 0;var n=x.reduce(e,function(e,t){return e+(isNaN(t)?0:t)},0);if(0===n)return 0;for(var i=Math.pow(10,r),a=x.map(e,function(e){return(isNaN(e)?0:e)/n*i*100}),o=100*i,s=x.map(a,function(e){return Math.floor(e)}),u=x.reduce(s,function(e,t){return e+t},0),l=x.map(a,function(e,t){return e-s[t]});uh&&(h=l[d],c=d);++s[c],l[c]=0,++u}return s[t]/i}function d(e){var t=2*Math.PI;return(e%t+t)%t}function f(e){return e>-T&&e=-20?+e.toFixed(n<0?-n:0):e}function v(e){function t(e,r,n){return e.interval[n]=0}var x=r(13),T=1e-4,b=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;t.linearMap=i,t.parsePercent=a,t.round=o,t.asc=s,t.getPrecision=u,t.getPrecisionSafe=l,t.getPixelPrecision=h,t.getPercentWithPrecision=c,t.MAX_SAFE_INTEGER=9007199254740991,t.remRadian=d,t.isRadianAroundZero=f,t.parseDate=p,t.quantity=m,t.nice=_,t.reformIntervals=v,t.isNumeric=y},function(e,t,r){"use strict";function n(e){u.a.defaultsWithPropList(e,h,c),i(e);for(var t="",r=0;rh&&l.push({pivot:Math.floor((c+h)/2),left:h,right:c});var h=s[u].pivot+1,c=s[u].right;c>h&&l.push({pivot:Math.floor((c+h)/2),left:h,right:c})}s=this._parts=l}else for(var u=0;u50&&(s=1e3);var u=[];a.perspective(u,o,this.width/this.height,1,s),this.viewGL.camera.projectionMatrix.setArray(u),this.viewGL.camera.decomposeProjectionMatrix();var u=a.identity([]),l=this.dataToPoint(this.center);a.scale(u,u,[1,-1,1]),a.translate(u,u,[0,0,-e]),a.rotateX(u,u,t),a.rotateZ(u,u,-this.bearing/180*Math.PI),a.translate(u,u,[-l[0]*this.getScale()*.1,-l[1]*this.getScale()*.1,0]),this.viewGL.camera.viewMatrix.array=u;var h=[];a.invert(h,u),this.viewGL.camera.worldTransform.array=h,this.viewGL.camera.decomposeWorldTransform();var c,d=512*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var f=this.altitudeExtent[1]-this.altitudeExtent[0];c=this.boxHeight/f*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else c=d/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*.1;this.viewGL.rootNode.scale.set(.1*this.getScale(),.1*this.getScale(),c)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(e,t){return this.projectOnTileWithScale(e,512*this.getScale(),t)},projectOnTileWithScale:function(e,t,r){var n=e[0],i=e[1],a=n*s/180,o=i*s/180,u=t*(a+s)/(2*s),l=t*(s-Math.log(Math.tan(s/4+.5*o)))/(2*s);return r=r||[],r[0]=u,r[1]=l,r},unprojectFromTile:function(e,t){return this.unprojectOnTileWithScale(e,512*this.getScale(),t)},unprojectOnTileWithScale:function(e,t,r){var n=e[0],i=e[1],a=n/t*(2*s)-s,o=2*(Math.atan(Math.exp(s-i/t*(2*s)))-s/4);return r=r||[],r[0]=180*a/s,r[1]=180*o/s,r},dataToPoint:function(e,t){return t=this.projectOnTileWithScale(e,512,t),t[0]-=this._origin[0],t[1]-=this._origin[1],t[2]=isNaN(e[2])?0:e[2],isNaN(e[2])||(t[2]=e[2],this.altitudeExtent&&(t[2]-=this.altitudeExtent[0])),t}},t.a=n},function(e,t,r){"use strict";var n=r(2),i=r(1),a=r(22);t.a=function(e,t,r){function o(e,t){var r=t.getWidth(),n=t.getHeight(),i=t.getDevicePixelRatio();this.viewGL.setViewport(0,0,r,n,i),this.width=r,this.height=n,this.altitudeScale=e.get("altitudeScale"),this.boxHeight=e.get("boxHeight")}function s(e,t){if("auto"!==this.model.get("boxHeight")){var r=[1/0,-1/0];e.eachSeries(function(e){if(e.coordinateSystem===this){var t=e.getData(),n=e.coordDimToDataDim("alt")[0];if(n){var i=t.getDataExtent(n,!0);r[0]=Math.min(r[0],i[0]),r[1]=Math.max(r[1],i[1])}}},this),r&&isFinite(r[1]-r[0])&&(this.altitudeExtent=r)}}return{dimensions:t.prototype.dimensions,create:function(u,l){var h=[];return u.eachComponent(e,function(e){var r=e.__viewGL;r||(r=e.__viewGL=new a.a,r.setRootNode(new i.a.Node));var n=new t;n.viewGL=e.__viewGL,n.resize=o,n.resize(e,l),h.push(n),e.coordinateSystem=n,n.model=e,n.update=s}),u.eachSeries(function(t){if(t.get("coordinateSystem")===e){var r=t.getReferringComponents(e)[0];if(r||(r=u.getComponent(e)),!r)throw new Error(e+' "'+n.a.firstNotNull(t.get(e+"Index"),t.get(e+"Id"),0)+'" not found');t.coordinateSystem=r.coordinateSystem}}),r&&r(h,u,l),h}}}},function(e,t,r){"use strict";t.a="\n@export ecgl.displayShadow.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_WorldPosition;\n\nvarying vec3 v_Normal;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n\n@end\n\n\n@export ecgl.displayShadow.fragment\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform float roughness: 0.2;\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.ssaoMap.header\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n float shadow = 1.0;\n\n @import ecgl.common.ssaoMap.main\n\n#if defined(DIRECTIONAL_LIGHT_COUNT) && defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++) {\n shadow = min(shadow, shadowContribsDir[i] * 0.5 + 0.5);\n }\n#endif\n\n shadow *= 0.5 + ao * 0.5;\n shadow = clamp(shadow, 0.0, 1.0);\n\n gl_FragColor = vec4(vec3(0.0), 1.0 - shadow);\n}\n\n@end"},function(e,t,r){"use strict";function n(e){this.viewGL=e}var i=r(84),a=r.n(i),o=r(83),s=r.n(o);n.prototype.reset=function(e,t){this._updateCamera(t.getWidth(),t.getHeight(),t.getDevicePixelRatio()),this._viewTransform=a.a.create(),this.updateTransform(e,t)},n.prototype.updateTransform=function(e,t){var r=e.coordinateSystem;r.getRoamTransform&&(a.a.invert(this._viewTransform,r.getRoamTransform()),this._setCameraTransform(this._viewTransform),t.getZr().refresh())},n.prototype.dataToPoint=function(e,t,r){r=e.dataToPoint(t,null,r);var n=this._viewTransform;n&&s.a.applyTransform(r,r,n)},n.prototype.removeTransformInPoint=function(e){return this._viewTransform&&s.a.applyTransform(e,e,this._viewTransform),e},n.prototype.getZoom=function(){if(this._viewTransform){var e=this._viewTransform;return 1/Math.max(Math.sqrt(e[0]*e[0]+e[1]*e[1]),Math.sqrt(e[2]*e[2]+e[3]*e[3]))}return 1},n.prototype._setCameraTransform=function(e){var t=this.viewGL.camera;t.position.set(e[4],e[5],0),t.scale.set(Math.sqrt(e[0]*e[0]+e[1]*e[1]),Math.sqrt(e[2]*e[2]+e[3]*e[3]),1)},n.prototype._updateCamera=function(e,t,r){this.viewGL.setViewport(0,0,e,t,r);var n=this.viewGL.camera;n.left=n.top=0,n.bottom=t,n.right=e,n.near=0,n.far=100},t.a=n},function(e,t,r){(function(e){var r;"undefined"!=typeof window?r=window.__DEV__:void 0!==e&&(r=e.__DEV__),void 0===r&&(r=!0);var n=r;t.__DEV__=n}).call(t,r(68))},function(e,t,r){"use strict";var n=r(15),i=r(0),a=r.n(i),o=r(38),s=r(6),u=s.a.vec2,l=[[0,0],[1,1]],h=n.a.extend(function(){return{segmentScale:4,dynamic:!0,useNativeLine:!0,attributes:{position:new n.a.Attribute("position","float",2,"POSITION"),normal:new n.a.Attribute("normal","float",2),offset:new n.a.Attribute("offset","float",1),color:new n.a.Attribute("color","float",4,"COLOR")}}},{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(e){var t=this.attributes;this.vertexCount!==e&&(t.position.init(e),t.color.init(e),this.useNativeLine||(t.offset.init(e),t.normal.init(e)),e>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,n){return 1/(u.dist(e,t)+u.dist(r,t)+u.dist(n,r)+1)*this.segmentScale},getCubicCurveVertexCount:function(e,t,r,n){var i=this._getCubicCurveApproxStep(e,t,r,n),a=Math.ceil(1/i);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,n){var i=this._getCubicCurveApproxStep(e,t,r,n),a=Math.ceil(1/i);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(l)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(l)},getPolylineVertexCount:function(e){var t;if("number"==typeof e)t=e;else{t="number"!=typeof e[0]?e.length:e.length/2}return this.useNativeLine?2*(t-1):2*(t-1)+2},getPolylineTriangleCount:function(e){var t;if("number"==typeof e)t=e;else{t="number"!=typeof e[0]?e.length:e.length/2}return this.useNativeLine?0:2*(t-1)},addCubicCurve:function(e,t,r,n,i,a){null==a&&(a=1);for(var o=e[0],s=e[1],u=t[0],l=t[1],h=r[0],c=r[1],d=n[0],f=n[1],p=this._getCubicCurveApproxStep(e,t,r,n),m=p*p,g=m*p,_=3*p,v=3*m,y=6*m,x=6*g,T=o-2*u+h,b=s-2*l+c,w=3*(u-h)-o+d,E=3*(l-c)-s+f,S=o,A=s,M=(u-o)*_+T*v+w*g,C=(l-s)*_+b*v+E*g,L=T*y+w*x,D=b*y+E*x,N=w*x,R=E*x,P=0,I=0,O=Math.ceil(1/p),F=new Float32Array(3*(O+1)),F=[],B=0,I=0;I1&&(S=M>0?Math.min(S,d):Math.max(S,d),A=C>0?Math.min(A,f):Math.max(A,f));this.addPolyline(F,i,a)},addLine:function(e,t,r,n){this.addPolyline([e,t],r,n)},addPolyline:function(){var e=u.create(),t=u.create(),r=u.create(),n=u.create(),i=[],a=[],o=[];return function(s,l,h,c,d){if(s.length){var f="number"!=typeof s[0];if(null==d&&(d=f?s.length:s.length/2),!(d<2)){null==c&&(c=0),null==h&&(h=1),this._itemVertexOffsets.push(this._vertexOffset);for(var p,m=f?"number"!=typeof l[0]:l.length/4===d,g=this.attributes.position,_=this.attributes.color,v=this.attributes.offset,y=this.attributes.normal,x=this.indices,T=this._vertexOffset,b=0;b1&&(g.copy(T,T-1),_.copy(T,T-1),T++);else{var S;if(b0){u.sub(e,i,o),u.sub(t,a,i),u.normalize(e,e),u.normalize(t,t),u.add(n,e,t),u.normalize(n,n);var A=h/2*Math.min(1/u.dot(e,n),2);r[0]=-n[1],r[1]=n[0],S=A}else u.sub(e,a,i),u.normalize(e,e),r[0]=-e[1],r[1]=e[0],S=h/2}else u.sub(e,i,o),u.normalize(e,e),r[0]=-e[1],r[1]=e[0],S=h/2;y.set(T,r),y.set(T+1,r),v.set(T,S),v.set(T+1,-S),u.copy(o,i),g.set(T,i),g.set(T+1,i),_.set(T,p),_.set(T+1,p),T+=2}if(this.useNativeLine)_.set(T,p),g.set(T,i),T++;else if(b>0){var M=3*this._faceOffset,x=this.indices;x[M]=T-4,x[M+1]=T-3,x[M+2]=T-2,x[M+3]=T-3,x[M+4]=T-1,x[M+5]=T-2,this._faceOffset+=2}}this._vertexOffset=T}}}}(),setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],n=ee&&o=0&&this._viewsToDispose.splice(t,1),this.views.push(e),e.layer=this;var r=this.zr;e.scene.traverse(function(e){e.__zr=r,e.addAnimatorsToZr&&e.addAnimatorsToZr(r)})}},_.prototype.removeView=function(e){if(e.layer===this){var t=this.views.indexOf(e);t>=0&&(this.views.splice(t,1),e.scene.traverse(n,this),e.layer=null,this._viewsToDispose.push(e))}},_.prototype.removeViewsAll=function(){this.views.forEach(function(e){e.scene.traverse(n,this),e.layer=null,this._viewsToDispose.push(e)},this),this.views.length=0},_.prototype.resize=function(e,t){this.renderer.resize(e,t)},_.prototype.clear=function(){var e=this.renderer.gl,t=this._backgroundColor||[0,0,0,0];e.clearColor(t[0],t[1],t[2],t[3]),e.depthMask(!0),e.colorMask(!0,!0,!0,!0),e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT)},_.prototype.clearDepth=function(){var e=this.renderer.gl;e.clear(e.DEPTH_BUFFER_BIT)},_.prototype.clearColor=function(){var e=this.renderer.gl;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},_.prototype.needsRefresh=function(){this.zr.refresh()},_.prototype.refresh=function(e){this._backgroundColor=e?f.a.parseColor(e):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var t=0;t20)){e=e.event;var n=this.pickObject(e.offsetX,e.offsetY);n&&(this._dispatchEvent(e.type,e,n),this._dispatchDataEvent(e.type,e,n));var i=this._clickToSetFocusPoint(e);if(i){i.view.setDOFFocusOnPoint(i.distance)&&this.zr.refresh()}}}},_.prototype._clickToSetFocusPoint=function(e){for(var t=this.renderer,r=t.viewport,n=this.views.length-1;n>=0;n--){var i=this.views[n];if(i.hasDOF()&&i.containPoint(e.offsetX,e.offsetY)){this._picking.scene=i.scene,this._picking.camera=i.camera,t.viewport=i.viewport;var a=this._picking.pick(e.offsetX,e.offsetY,!0);if(a)return a.view=i,a}}t.viewport=r},_.prototype.onglobalout=function(e){var t=this._hovered;t&&this._dispatchEvent("mouseout",e,{target:t.target})},_.prototype.pickObject=function(e,t){for(var r=[],n=this.renderer,i=n.viewport,a=0;a=0&&(u.dataIndex=this._lastDataIndex,u.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(l,"mouseout",t)),s=!0):null!=o&&o!==this._lastEventData&&(null!=this._lastEventData&&(u.eventData=this._lastEventData,this.zr.handler.dispatchToElement(l,"mouseout",t)),s=!0),this._lastEventData=o,this._lastDataIndex=i,this._lastSeriesIndex=a),u.eventData=o,u.dataIndex=i,u.seriesIndex=a,(null!=o||parseInt(i,10)>=0&&parseInt(a,10)>=0)&&(this.zr.handler.dispatchToElement(l,e,t),s&&this.zr.handler.dispatchToElement(l,"mouseover",t))},_.prototype._dispatchToView=function(e,t){for(var r=0;r=400?e.onerror&&e.onerror():e.onload&&e.onload(t.response)},e.onerror&&(t.onerror=e.onerror),t.send(null)}t.a={get:n}},function(e,t,r){"use strict";function n(e){return e=Math.round(e),e<0?0:e>255?255:e}function i(e){return e=Math.round(e),e<0?0:e>360?360:e}function a(e){return e<0?0:e>1?1:e}function o(e){return n(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100*255:parseInt(e,10))}function s(e){return a(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100:parseFloat(e))}function u(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function l(e,t,r){return e+(t-e)*r}function h(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function d(e,t){y&&c(y,t),y=v.put(e,y||t.slice())}function f(e,t){var r=(parseFloat(e[0])%360+360)%360/360,i=s(e[1]),a=s(e[2]),o=a<=.5?a*(i+1):a+i-a*i,l=2*a-o;return t=t||[],h(t,n(255*u(l,o,r+1/3)),n(255*u(l,o,r)),n(255*u(l,o,r-1/3)),1),4===e.length&&(t[3]=e[3]),t}function p(e){if(e){var t,r,n=e[0]/255,i=e[1]/255,a=e[2]/255,o=Math.min(n,i,a),s=Math.max(n,i,a),u=s-o,l=(s+o)/2;if(0===u)t=0,r=0;else{r=l<.5?u/(s+o):u/(2-s-o);var h=((s-n)/6+u/2)/u,c=((s-i)/6+u/2)/u,d=((s-a)/6+u/2)/u;n===s?t=d-c:i===s?t=1/3+h-d:a===s&&(t=2/3+c-h),t<0&&(t+=1),t>1&&(t-=1)}var f=[360*t,r,l];return null!=e[3]&&f.push(e[3]),f}}var m=r(69),g={},_={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},v=new m.a(20),y=null;g.parse=function(e,t){if(e){t=t||[];var r=v.get(e);if(r)return c(t,r);e+="";var n=e.replace(/ /g,"").toLowerCase();if(n in _)return c(t,_[n]),d(e,t),t;if("#"!==n.charAt(0)){var i=n.indexOf("("),a=n.indexOf(")");if(-1!==i&&a+1===n.length){var u=n.substr(0,i),l=n.substr(i+1,a-(i+1)).split(","),p=1;switch(u){case"rgba":if(4!==l.length)return void h(t,0,0,0,1);p=s(l.pop());case"rgb":return 3!==l.length?void h(t,0,0,0,1):(h(t,o(l[0]),o(l[1]),o(l[2]),p),d(e,t),t);case"hsla":return 4!==l.length?void h(t,0,0,0,1):(l[3]=s(l[3]),f(l,t),d(e,t),t);case"hsl":return 3!==l.length?void h(t,0,0,0,1):(f(l,t),d(e,t),t);default:return}}h(t,0,0,0,1)}else{if(4===n.length){var m=parseInt(n.substr(1),16);return m>=0&&m<=4095?(h(t,(3840&m)>>4|(3840&m)>>8,240&m|(240&m)>>4,15&m|(15&m)<<4,1),d(e,t),t):void h(t,0,0,0,1)}if(7===n.length){var m=parseInt(n.substr(1),16);return m>=0&&m<=16777215?(h(t,(16711680&m)>>16,(65280&m)>>8,255&m,1),d(e,t),t):void h(t,0,0,0,1)}}}},g.parseToFloat=function(e,t){if(t=g.parse(e,t))return t[0]/=255,t[1]/=255,t[2]/=255,t},g.lift=function(e,t){var r=g.parse(e);if(r){for(var n=0;n<3;n++)r[n]=t<0?r[n]*(1-t)|0:(255-r[n])*t+r[n]|0;return g.stringify(r,4===r.length?"rgba":"rgb")}},g.toHex=function(e){var t=g.parse(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)},g.fastLerp=function(e,t,r){if(t&&t.length&&e>=0&&e<=1){r=r||[];var i=e*(t.length-1),o=Math.floor(i),s=Math.ceil(i),u=t[o],h=t[s],c=i-o;return r[0]=n(l(u[0],h[0],c)),r[1]=n(l(u[1],h[1],c)),r[2]=n(l(u[2],h[2],c)),r[3]=a(l(u[3],h[3],c)),r}},g.fastMapToColor=g.fastLerp,g.lerp=function(e,t,r){if(t&&t.length&&e>=0&&e<=1){var i=e*(t.length-1),o=Math.floor(i),s=Math.ceil(i),u=g.parse(t[o]),h=g.parse(t[s]),c=i-o,d=g.stringify([n(l(u[0],h[0],c)),n(l(u[1],h[1],c)),n(l(u[2],h[2],c)),a(l(u[3],h[3],c))],"rgba");return r?{color:d,leftIndex:o,rightIndex:s,value:i}:d}},g.mapToColor=g.lerp,g.modifyHSL=function(e,t,r,n){if(e=g.parse(e))return e=p(e),null!=t&&(e[0]=i(t)),null!=r&&(e[1]=s(r)),null!=n&&(e[2]=s(n)),g.stringify(f(e),"rgba")},g.modifyAlpha=function(e,t){if((e=g.parse(e))&&null!=t)return e[3]=a(t),g.stringify(e,"rgba")},g.stringify=function(e,t){if(e&&e.length){var r=e[0]+","+e[1]+","+e[2];return"rgba"!==t&&"hsva"!==t&&"hsla"!==t||(r+=","+e[3]),t+"("+r+")"}},t.a=g},function(e,t,r){"use strict";var n=function(){this.head=null,this.tail=null,this._length=0};n.prototype.insert=function(e){var t=new n.Entry(e);return this.insertEntry(t),t},n.prototype.insertAt=function(e,t){if(!(e<0)){for(var r=this.head,i=0;r&&i!=e;)r=r.next,i++;if(r){var a=new n.Entry(t),o=r.prev;o?(o.next=a,a.prev=o):this.head=a,a.next=r,r.prev=a}else this.insert(t)}},n.prototype.insertBeforeEntry=function(e,t){var r=new n.Entry(e),i=t.prev;i?(i.next=r,r.prev=i):this.head=r,r.next=t,t.prev=r,this._length++},n.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e,this._length++},n.prototype.remove=function(e){var t=e.prev,r=e.next;t?t.next=r:this.head=r,r?r.prev=t:this.tail=t,e.next=e.prev=null,this._length--},n.prototype.removeAt=function(e){if(!(e<0)){for(var t=this.head,r=0;t&&r!=e;)t=t.next,r++;return t?(this.remove(t),t.value):void 0}},n.prototype.getHead=function(){if(this.head)return this.head.value},n.prototype.getTail=function(){if(this.tail)return this.tail.value},n.prototype.getAt=function(e){if(!(e<0)){for(var t=this.head,r=0;t&&r!=e;)t=t.next,r++;return t.value}},n.prototype.indexOf=function(e){for(var t=this.head,r=0;t;){if(t.value===e)return r;t=t.next,r++}},n.prototype.length=function(){return this._length},n.prototype.isEmpty=function(){return 0===this._length},n.prototype.forEach=function(e,t){for(var r=this.head,n=0,i=void 0!==t;r;)i?e.call(t,r.value,n):e(r.value,n),r=r.next,n++},n.prototype.clear=function(){this.tail=this.head=null,this._length=0},n.Entry=function(e){this.value=e,this.next=null,this.prev=null},t.a=n},function(e,t,r){"use strict";function n(e,t,r){function n(e,r,n,a){var o="";isNaN(r)&&(r=r in t?t[r]:i[r]),isNaN(n)&&(n=n in t?t[n]:i[n]);for(var s=parseInt(r);s0&&n.push("#define "+i.toUpperCase()+"_COUNT "+a)}if(r)for(var o=0;of.getMaxJointNumber()&&(_.USE_SKIN_MATRICES_TEXTURE=null),g="\n"+i(_)+"\n"}var v=g+i(t.vertexDefines,d,m),y=g+i(t.fragmentDefines,d,m),x=v+"\n"+t.shader.vertex,T=["OES_standard_derivatives","EXT_shader_texture_lod"].filter(function(e){return null!=f.getGLExtension(e)});T.indexOf("EXT_shader_texture_lod")>=0&&(y+="\n#define SUPPORT_TEXTURE_LOD"),T.indexOf("OES_standard_derivatives")>=0&&(y+="\n#define SUPPORT_STANDARD_DERIVATIVES");var b=a(T)+"\n"+o(t.precision)+"\n"+y+"\n"+t.shader.fragment,w=n(x,t.vertexDefines,d),E=n(b,t.fragmentDefines,d),c=new u.a;c.uniformSemantics=t.shader.uniformSemantics,c.attributes=t.shader.attributes;var S=c.buildProgram(p,t.shader,w,E);return c.__error=S,s[h]=c,c},t.a=s},function(e,t,r){"use strict";function n(e){for(var t=e.split("\n"),r=0,n=t.length;r=0&&A[E]>1e-4&&(h.a.transformMat4(L,S,b[M[E]]),h.a.scaleAndAdd(C,C,L,A[E]));D.set(w,C)}}for(var w=0;w=0){t||(t=[]);var r=this.indices;return t[0]=r[3*e],t[1]=r[3*e+1],t[2]=r[3*e+2],t}},setTriangleIndices:function(e,t){var r=this.indices;r[3*e]=t[0],r[3*e+1]=t[1],r[3*e+2]=t[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(e){var t,r=this.vertexCount>65535?c.a.Uint32Array:c.a.Uint16Array;if(e[0]&&e[0].length){var n=0;t=new r(3*e.length);for(var i=0;i=0&&(t.splice(r,1),delete this.attributes[e],!0)},getAttribute:function(e){return this.attributes[e]},getEnabledAttributes:function(){var e=this._enabledAttributes,t=this._attributeList;if(e)return e;for(var r=[],n=this.vertexCount,i=0;i0){var i=Math.pow(2,e[3]-128-8+n);t[r+0]=e[0]*i,t[r+1]=e[1]*i,t[r+2]=e[2]*i}else t[r+0]=0,t[r+1]=0,t[r+2]=0;return t[r+3]=1,t}function i(e,t,r){for(var n="",i=t;i0;)if(e[o][0]=t[r++],e[o][1]=t[r++],e[o][2]=t[r++],e[o][3]=t[r++],1===e[o][0]&&1===e[o][1]&&1===e[o][2]){for(var u=e[o][3]<>>0;u>0;u--)a(e[o-1],e[o]),o++,s--;i+=8}else o++,s--,i=0;return r}function s(e,t,r,n){if(nd)return o(e,t,r,n);var i=t[r++];if(2!=i)return o(e,t,r-1,n);if(e[0][1]=t[r++],e[0][2]=t[r++],i=t[r++],(e[0][2]<<8>>>0|i)>>>0!==n)return null;for(var i=0;i<4;i++)for(var a=0;a128){s=(127&s)>>>0;for(var u=t[r++];s--;)e[a++][i]=u}else for(;s--;)e[a++][i]=t[r++]}return r}var u=r(4),l=r(5),h=String.fromCharCode,c=8,d=32767,f={parseRGBE:function(e,t,r){null==r&&(r=0);var a=new Uint8Array(e),o=a.length;if("#?"===i(a,0,2)){for(var c=2;c=o)){c+=2;for(var d="";c=0||(s.forEach(function(t){e.on(t,this[n(t)],this)},this),this._meshes.push(e))},detachFromMesh:function(e){var t=this._meshes.indexOf(e);t>=0&&this._meshes.splice(t,1),s.forEach(function(t){e.off(t,this[n(t)])},this)},dispose:function(){this._meshes.forEach(function(e){this.detachFromMesh(e)},this)}},t.a=u},function(e,t,r){"use strict";var n=r(24),i=r(77),a=n.a.extend({cubemap:null,castShadow:!1,_normalDistribution:null,_brdfLookup:null},{type:"AMBIENT_CUBEMAP_LIGHT",prefilter:function(e,t){if(!e.getGLExtension("EXT_shader_texture_lod"))return void console.warn("Device not support textureCubeLodEXT");this._brdfLookup||(this._normalDistribution=i.a.generateNormalDistribution(),this._brdfLookup=i.a.integrateBRDF(e,this._normalDistribution));var r=this.cubemap;if(!r.__prefiltered){var n=i.a.prefilterEnvironmentMap(e,r,{encodeRGBM:!0,width:t,height:t},this._normalDistribution,this._brdfLookup);this.cubemap=n.environmentMap,this.cubemap.__prefiltered=!0,r.dispose(e)}},getBRDFLookup:function(){return this._brdfLookup},uniformTemplates:{ambientCubemapLightColor:{type:"3f",value:function(e){var t=e.color,r=e.intensity;return[t[0]*r,t[1]*r,t[2]*r]}},ambientCubemapLightCubemap:{type:"t",value:function(e){return e.cubemap}},ambientCubemapLightBRDFLookup:{type:"t",value:function(e){return e._brdfLookup}}}});t.a=a},function(e,t,r){"use strict";t.a="\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end"},function(e,t,r){"use strict";t.a="#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform sampler2D normalDistribution;\nuniform vec2 viewportSize : [512, 256];\nconst vec3 N = vec3(0.0, 0.0, 1.0);\nconst float fSampleNumber = float(SAMPLE_NUMBER);\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"},function(e,t,r){"use strict";t.a="#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"},function(e,t,r){"use strict";var n=r(24),i=r(14),a=n.a.extend({castShadow:!1,coefficients:[]},function(){this._coefficientsTmpArr=new i.a.Float32Array(27)},{type:"AMBIENT_SH_LIGHT",uniformTemplates:{ambientSHLightColor:{type:"3f",value:function(e){var t=e.color,r=e.intensity;return[t[0]*r,t[1]*r,t[2]*r]}},ambientSHLightCoefficients:{type:"3f",value:function(e){for(var t=e._coefficientsTmpArr,r=0;r65535?Uint32Array:Uint16Array,m=this.indices=new p(t*e*6),g=this.radius,_=this.phiStart,v=this.phiLength,y=this.thetaStart,x=this.thetaLength,g=this.radius,T=[],b=[],w=0,E=1/g;for(f=0;f<=e;f++)for(d=0;d<=t;d++)h=d/t,c=f/e,s=-g*Math.cos(_+h*v)*Math.sin(y+c*x),u=g*Math.cos(y+c*x),l=g*Math.sin(_+h*v)*Math.sin(y+c*x),T[0]=s,T[1]=u,T[2]=l,b[0]=h,b[1]=c,r.set(w,T),n.set(w,b),T[0]*=E,T[1]*=E,T[2]*=E,a.set(w,T),w++;var S,A,M,C,L=t+1,D=0;for(f=0;f=0&&l.splice(e,1)}),l.push(h),this.__zr&&this.__zr.animation.addAnimator(h),h},stopAnimation:function(e){this._animators=this._animators||[];for(var t=this._animators,r=t.length,n=0;n.5?t:e}function s(e,t,r,n,i){var o=e.length;if(1==i)for(var s=0;si)e.length=i;else for(var a=n;a=0&&!(C[r]<=t);r--);r=Math.min(r,T-2)}else{for(r=V;rt);r++);r=Math.min(r-1,T-2)}V=r,k=t;var n=C[r+1]-C[r];if(0!==n)if(B=(t-C[r])/n,x)if(z=L[r],U=L[0===r?r:r-1],G=L[r>T-2?T-1:r+1],H=L[r>T-3?T-1:r+2],E)h(U,z,G,H,B,B*B,B*B*B,m(e,i),M);else{var u;if(S)u=h(U,z,G,H,B,B*B,B*B*B,W,1),u=f(W);else{if(A)return o(z,G,B);u=c(U,z,G,H,B,B*B,B*B*B)}v(e,i,u)}else if(E)s(L[r],L[r+1],B,m(e,i),M);else{var u;if(S)s(L[r],L[r+1],B,W,1),u=f(W);else{if(A)return o(L[r],L[r+1],B);u=a(L[r],L[r+1],B)}v(e,i,u)}},X=new g({target:e._target,life:b,loop:e._loop,delay:e._delay,onframe:j,ondestroy:r});return t&&"spline"!==t&&(X.easing=t),X}}}var g=r(143),_=r(145),v=r(13),y=v.isArrayLike,x=Array.prototype.slice,T=function(e,t,r,a){this._tracks={},this._target=e,this._loop=t||!1,this._getter=r||n,this._setter=a||i,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};T.prototype={when:function(e,t){var r=this._tracks;for(var n in t)if(t.hasOwnProperty(n)){if(!r[n]){r[n]=[];var i=this._getter(this._target,n);if(null==i)continue;0!==e&&r[n].push({time:0,value:d(i)})}r[n].push({time:e,value:t[n]})}return this},during:function(e){return this._onframeList.push(e),this},pause:function(){for(var e=0;e255?255:e}function i(e){return e=Math.round(e),e<0?0:e>360?360:e}function a(e){return e<0?0:e>1?1:e}function o(e){return n(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100*255:parseInt(e,10))}function s(e){return a(e.length&&"%"===e.charAt(e.length-1)?parseFloat(e)/100:parseFloat(e))}function u(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function l(e,t,r){return e+(t-e)*r}function h(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function c(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function d(e,t){A&&c(A,t),A=S.put(e,A||t.slice())}function f(e,t){if(e){t=t||[];var r=S.get(e);if(r)return c(t,r);e+="";var n=e.replace(/ /g,"").toLowerCase();if(n in E)return c(t,E[n]),d(e,t),t;if("#"!==n.charAt(0)){var i=n.indexOf("("),a=n.indexOf(")");if(-1!==i&&a+1===n.length){var u=n.substr(0,i),l=n.substr(i+1,a-(i+1)).split(","),f=1;switch(u){case"rgba":if(4!==l.length)return void h(t,0,0,0,1);f=s(l.pop());case"rgb":return 3!==l.length?void h(t,0,0,0,1):(h(t,o(l[0]),o(l[1]),o(l[2]),f),d(e,t),t);case"hsla":return 4!==l.length?void h(t,0,0,0,1):(l[3]=s(l[3]),p(l,t),d(e,t),t);case"hsl":return 3!==l.length?void h(t,0,0,0,1):(p(l,t),d(e,t),t);default:return}}h(t,0,0,0,1)}else{if(4===n.length){var m=parseInt(n.substr(1),16);return m>=0&&m<=4095?(h(t,(3840&m)>>4|(3840&m)>>8,240&m|(240&m)>>4,15&m|(15&m)<<4,1),d(e,t),t):void h(t,0,0,0,1)}if(7===n.length){var m=parseInt(n.substr(1),16);return m>=0&&m<=16777215?(h(t,(16711680&m)>>16,(65280&m)>>8,255&m,1),d(e,t),t):void h(t,0,0,0,1)}}}}function p(e,t){var r=(parseFloat(e[0])%360+360)%360/360,i=s(e[1]),a=s(e[2]),o=a<=.5?a*(i+1):a+i-a*i,l=2*a-o;return t=t||[],h(t,n(255*u(l,o,r+1/3)),n(255*u(l,o,r)),n(255*u(l,o,r-1/3)),1),4===e.length&&(t[3]=e[3]),t}function m(e){if(e){var t,r,n=e[0]/255,i=e[1]/255,a=e[2]/255,o=Math.min(n,i,a),s=Math.max(n,i,a),u=s-o,l=(s+o)/2;if(0===u)t=0,r=0;else{r=l<.5?u/(s+o):u/(2-s-o);var h=((s-n)/6+u/2)/u,c=((s-i)/6+u/2)/u,d=((s-a)/6+u/2)/u;n===s?t=d-c:i===s?t=1/3+h-d:a===s&&(t=2/3+c-h),t<0&&(t+=1),t>1&&(t-=1)}var f=[360*t,r,l];return null!=e[3]&&f.push(e[3]),f}}function g(e,t){var r=f(e);if(r){for(var n=0;n<3;n++)r[n]=t<0?r[n]*(1-t)|0:(255-r[n])*t+r[n]|0,r[n]>255?r[n]=255:e[n]<0&&(r[n]=0);return b(r,4===r.length?"rgba":"rgb")}}function _(e){var t=f(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)}function v(e,t,r){if(t&&t.length&&e>=0&&e<=1){r=r||[];var i=e*(t.length-1),o=Math.floor(i),s=Math.ceil(i),u=t[o],h=t[s],c=i-o;return r[0]=n(l(u[0],h[0],c)),r[1]=n(l(u[1],h[1],c)),r[2]=n(l(u[2],h[2],c)),r[3]=a(l(u[3],h[3],c)),r}}function y(e,t,r){if(t&&t.length&&e>=0&&e<=1){var i=e*(t.length-1),o=Math.floor(i),s=Math.ceil(i),u=f(t[o]),h=f(t[s]),c=i-o,d=b([n(l(u[0],h[0],c)),n(l(u[1],h[1],c)),n(l(u[2],h[2],c)),a(l(u[3],h[3],c))],"rgba");return r?{color:d,leftIndex:o,rightIndex:s,value:i}:d}}function x(e,t,r,n){if(e=f(e))return e=m(e),null!=t&&(e[0]=i(t)),null!=r&&(e[1]=s(r)),null!=n&&(e[2]=s(n)),b(p(e),"rgba")}function T(e,t){if((e=f(e))&&null!=t)return e[3]=a(t),b(e,"rgba")}function b(e,t){if(e&&e.length){var r=e[0]+","+e[1]+","+e[2];return"rgba"!==t&&"hsva"!==t&&"hsla"!==t||(r+=","+e[3]),t+"("+r+")"}}var w=r(60),E={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},S=new w(20),A=null,M=v,C=y;t.parse=f,t.lift=g,t.toHex=_,t.fastLerp=v,t.fastMapToColor=M,t.lerp=y,t.mapToColor=C,t.modifyHSL=x,t.modifyAlpha=T,t.stringify=b},function(e,t,r){"use strict";t.a="\n@export clay.util.rand\nhighp float rand(vec2 uv) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, 3.141592653589793);\n return fract(sin(sn) * c);\n}\n@end\n@export clay.util.calculate_attenuation\nuniform float attenuationFactor : 5.0;\nfloat lightAttenuation(float dist, float range)\n{\n float attenuation = 1.0;\n attenuation = dist*dist/(range*range+1.0);\n float att_s = attenuationFactor;\n attenuation = 1.0/(attenuation*att_s+1.0);\n att_s = 1.0/(att_s+1.0);\n attenuation = attenuation - att_s;\n attenuation /= 1.0 - att_s;\n return clamp(attenuation, 0.0, 1.0);\n}\n@end\n@export clay.util.edge_factor\n#ifdef SUPPORT_STANDARD_DERIVATIVES\nfloat edgeFactor(float width)\n{\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * width, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#else\nfloat edgeFactor(float width)\n{\n return 1.0;\n}\n#endif\n@end\n@export clay.util.encode_float\nvec4 encodeFloat(const in float depth)\n{\n const vec4 bitShifts = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\n const vec4 bit_mask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\n vec4 res = fract(depth * bitShifts);\n res -= res.xxyz * bit_mask;\n return res;\n}\n@end\n@export clay.util.decode_float\nfloat decodeFloat(const in vec4 color)\n{\n const vec4 bitShifts = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);\n return dot(color, bitShifts);\n}\n@end\n@export clay.util.float\n@import clay.util.encode_float\n@import clay.util.decode_float\n@end\n@export clay.util.rgbm_decode\nvec3 RGBMDecode(vec4 rgbm, float range) {\n return range * rgbm.rgb * rgbm.a;\n}\n@end\n@export clay.util.rgbm_encode\nvec4 RGBMEncode(vec3 color, float range) {\n if (dot(color, color) == 0.0) {\n return vec4(0.0);\n }\n vec4 rgbm;\n color /= range;\n rgbm.a = clamp(max(max(color.r, color.g), max(color.b, 1e-6)), 0.0, 1.0);\n rgbm.a = ceil(rgbm.a * 255.0) / 255.0;\n rgbm.rgb = color / rgbm.a;\n return rgbm;\n}\n@end\n@export clay.util.rgbm\n@import clay.util.rgbm_decode\n@import clay.util.rgbm_encode\nvec4 decodeHDR(vec4 color)\n{\n#if defined(RGBM_DECODE) || defined(RGBM)\n return vec4(RGBMDecode(color, 8.12), 1.0);\n#else\n return color;\n#endif\n}\nvec4 encodeHDR(vec4 color)\n{\n#if defined(RGBM_ENCODE) || defined(RGBM)\n return RGBMEncode(color.xyz, 8.12);\n#else\n return color;\n#endif\n}\n@end\n@export clay.util.srgb\nvec4 sRGBToLinear(in vec4 value) {\n return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.w);\n}\nvec4 linearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\n}\n@end\n@export clay.chunk.skinning_header\n#ifdef SKINNING\nattribute vec3 weight : WEIGHT;\nattribute vec4 joint : JOINT;\n#ifdef USE_SKIN_MATRICES_TEXTURE\nuniform sampler2D skinMatricesTexture : ignore;\nuniform float skinMatricesTextureSize: ignore;\nmat4 getSkinMatrix(sampler2D tex, float idx) {\n float j = idx * 4.0;\n float x = mod(j, skinMatricesTextureSize);\n float y = floor(j / skinMatricesTextureSize) + 0.5;\n vec2 scale = vec2(skinMatricesTextureSize);\n return mat4(\n texture2D(tex, vec2(x + 0.5, y) / scale),\n texture2D(tex, vec2(x + 1.5, y) / scale),\n texture2D(tex, vec2(x + 2.5, y) / scale),\n texture2D(tex, vec2(x + 3.5, y) / scale)\n );\n}\nmat4 getSkinMatrix(float idx) {\n return getSkinMatrix(skinMatricesTexture, idx);\n}\n#else\nuniform mat4 skinMatrix[JOINT_COUNT] : SKIN_MATRIX;\nmat4 getSkinMatrix(float idx) {\n return skinMatrix[int(idx)];\n}\n#endif\n#endif\n@end\n@export clay.chunk.skin_matrix\nmat4 skinMatrixWS = getSkinMatrix(joint.x) * weight.x;\nif (weight.y > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end"},function(e,t,r){"use strict";t.a="\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"},function(e,t,r){"use strict";t.a="@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"},function(e,t,r){"use strict";t.a="/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"},function(e,t,r){"use strict";t.a="@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"},function(e,t,r){"use strict";t.a="@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"},function(e,t,r){"use strict";t.a="@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end"},function(e,t,r){"use strict";function n(e,t){if(e&&e[t]&&(e[t].normal||e[t].emphasis)){var r=e[t].normal,n=e[t].emphasis;r&&(e[t]=r),n&&(e.emphasis=e.emphasis||{},e.emphasis[t]=n)}}function i(e){n(e,"itemStyle"),n(e,"lineStyle"),n(e,"areaStyle"),n(e,"label")}function a(e){e&&(e instanceof Array||(e=[e]),s.a.util.each(e,function(e){if(e.axisLabel){var t=e.axisLabel;s.a.util.extend(t,t.textStyle),t.textStyle=null}}))}var o=r(0),s=r.n(o),u=["bar3D","line3D","map3D","scatter3D","surface","lines3D","scatterGL","scatter3D"];t.a=function(e){s.a.util.each(e.series,function(t){s.a.util.indexOf(u,t.type)>=0&&(i(t),"mapbox"===t.coordinateSystem&&(t.coordinateSystem="mapbox3D",e.mapbox3D=e.mapbox))}),a(e.xAxis3D),a(e.yAxis3D),a(e.zAxis3D),a(e.grid3D),n(e.geo3D)}},function(e,t,r){"use strict";var n=(r(155),r(159),r(160),r(167),r(0)),i=r.n(n);i.a.registerAction({type:"grid3DChangeCamera",event:"grid3dcamerachanged",update:"series:updateCamera"},function(e,t){t.eachComponent({mainType:"grid3D",query:e},function(t){t.setView(e)})}),i.a.registerAction({type:"grid3DShowAxisPointer",event:"grid3dshowaxispointer",update:"grid3D:showAxisPointer"},function(e,t){}),i.a.registerAction({type:"grid3DHideAxisPointer",event:"grid3dhideaxispointer",update:"grid3D:hideAxisPointer"},function(e,t){})},function(e,t,r){"use strict";function n(e,t){return t.type||(t.data?"category":"value")}var i=r(0),a=r.n(i),o=r(156),s=a.a.extendComponentModel({type:"cartesian3DAxis",axis:null,getCoordSysModel:function(){return this.ecModel.queryComponents({mainType:"grid3D",index:this.option.gridIndex,id:this.option.gridId})[0]}});a.a.helper.mixinAxisModelCommonMethods(s),Object(o.a)("x",s,n,{name:"X"}),Object(o.a)("y",s,n,{name:"Y"}),Object(o.a)("z",s,n,{name:"Z"})},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(157),o=r(158),s=r.n(o),u=["value","category","time","log"];t.a=function(e,t,r,n){i.a.util.each(u,function(o){t.extend({type:e+"Axis3D."+o,__ordinalMeta:null,mergeDefaultAndTheme:function(t,n){var a=n.getTheme();i.a.util.merge(t,a.get(o+"Axis3D")),i.a.util.merge(t,this.getDefaultOption()),t.type=r(e,t)},optionUpdated:function(){"category"===this.option.type&&(this.__ordinalMeta=s.a.createByAxisModel(this))},getCategories:function(){if("category"===this.option.type)return this.__ordinalMeta.categories},getOrdinalMeta:function(){return this.__ordinalMeta},defaultOption:i.a.util.merge(i.a.util.clone(a.a[o+"Axis3D"]),n||{},!0)})}),t.superClass.registerSubTypeDefaulter(e+"Axis3D",i.a.util.curry(r,e))}},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a={show:!0,grid3DIndex:0,inverse:!1,name:"",nameLocation:"middle",nameTextStyle:{fontSize:16},nameGap:20,axisPointer:{},axisLine:{},axisTick:{},axisLabel:{},splitArea:{}},o=i.a.util.merge({boundaryGap:!0,axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"},axisPointer:{label:{show:!1}}},a),s=i.a.util.merge({boundaryGap:[0,0],splitNumber:5,axisPointer:{label:{}}},a),u=i.a.util.defaults({scale:!0,min:"dataMin",max:"dataMax"},s),l=i.a.util.defaults({logBase:10},s);l.scale=!0,t.a={categoryAxis3D:o,valueAxis3D:s,timeAxis3D:u,logAxis3D:l}},function(e,t,r){function n(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this._map}function i(e){return e._map||(e._map=s(e.categories))}function a(e){return u(e)&&null!=e.value?e.value:e+""}var o=r(13),s=o.createHashMap,u=o.isObject,l=o.map;n.createByAxisModel=function(e){var t=e.option,r=t.data,i=r&&l(r,a);return new n({categories:i,needCollect:!i,deduplication:!1!==t.dedplication})};var h=n.prototype;h.getOrdinal=function(e){return i(this).get(e)},h.parseAndCollect=function(e){var t,r=this._needCollect;if("string"!=typeof e&&!r)return e;if(r&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,t;var n=i(this);return t=n.get(e),null==t&&(r?(t=this.categories.length,this.categories[t]=e,n.set(e,t)):t=NaN),t};var c=n;e.exports=c},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(44),o=r(28),s=r(29),u=i.a.extendComponentModel({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"#333",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});i.a.util.merge(u.prototype,a.a),i.a.util.merge(u.prototype,o.a),i.a.util.merge(u.prototype,s.a)},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(1),o=r(45),s=r(25),u=r(2),l=r(81),h=r(30),c=r(162),d=r(164),f=r(63),p=r(46),m=u.a.firstNotNull;a.a.Shader.import(p.a),["x","y","z"].forEach(function(e){i.a.extendComponentView({type:e+"Axis3D"})});var g={x:0,y:2,z:1};i.a.extendComponentView({type:"grid3D",__ecgl__:!0,init:function(e,t){var r=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]],n=["x","y","z"],i=new a.a.Material({shader:a.a.createShader("ecgl.color"),depthMask:!1,transparent:!0}),u=new a.a.Material({shader:a.a.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});i.define("fragment","DOUBLE_SIDED"),i.define("both","VERTEX_COLOR"),this.groupGL=new a.a.Node,this._control=new o.a({zr:t.getZr()}),this._control.init(),this._faces=r.map(function(e){var t=new c.a(e,u,i);return this.groupGL.add(t.rootNode),t},this),this._axes=n.map(function(e){var t=new d.a(e,u);return this.groupGL.add(t.rootNode),t},this);var p=t.getDevicePixelRatio();this._axisLabelSurface=new l.a({width:256,height:256,devicePixelRatio:p}),this._axisLabelSurface.onupdate=function(){t.getZr().refresh()},this._axisPointerLineMesh=new a.a.Mesh({geometry:new s.a({useNativeLine:!1}),material:u,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new l.a({width:128,height:128,devicePixelRatio:p}),this._axisPointerLabelsMesh=new f.a({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new a.a.Node,this._sceneHelper=new h.a,this._sceneHelper.initLight(this._lightRoot)},render:function(e,t,r){this._model=e,this._api=r;var n=e.coordinateSystem;n.viewGL.add(this._lightRoot),e.get("show")?n.viewGL.add(this.groupGL):n.viewGL.remove(this.groupGL);var i=this._control;i.setViewGL(n.viewGL);var a=e.getModel("viewControl");i.setFromViewControlModel(a,0),this._axisLabelSurface.clear(),i.off("update"),e.get("show")&&(this._faces.forEach(function(n){n.update(e,t,r)},this),this._axes.forEach(function(t){t.update(e,this._axisLabelSurface,r)},this)),i.on("update",this._onCameraChange.bind(this,e,r),this),this._sceneHelper.setScene(n.viewGL.scene),this._sceneHelper.updateLight(e),n.viewGL.setPostEffect(e.getModel("postEffect"),r),n.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._initMouseHandler(e)},afterRender:function(e,t,r,n){var i=n.renderer;this._sceneHelper.updateAmbientCubemap(i,e,r),this._sceneHelper.updateSkybox(i,e,r)},showAxisPointer:function(e,t,r,n){this._doShowAxisPointer(),this._updateAxisPointer(n.value)},hideAxisPointer:function(e,t,r,n){this._doHideAxisPointer()},_initMouseHandler:function(e){var t=e.coordinateSystem,r=t.viewGL;e.get("show")&&e.get("axisPointer.show")?r.on("mousemove",this._updateAxisPointerOnMousePosition,this):r.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(e){if(!e.target){for(var t,r=this._model,n=r.coordinateSystem,i=n.viewGL,o=i.castRay(e.offsetX,e.offsetY,new a.a.Ray),s=0;sn[1]?0:1,s=this._faces[2*r+o],u=this._faces[2*r+1-o];s.rootNode.invisible=!0,u.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var e=this._model.coordinateSystem,t=e.getAxis("x"),r=e.getAxis("y"),n=e.getAxis("z"),i=n.getExtentMax(),a=n.getExtentMin(),o=t.getExtentMin(),s=t.getExtentMax(),u=r.getExtentMax(),l=r.getExtentMin(),h=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?l:u,m=f[2].rootNode.invisible?i:a,g=f[0].rootNode.invisible?o:s,_=f[2].rootNode.invisible?i:a,v=f[0].rootNode.invisible?s:o,y=f[4].rootNode.invisible?l:u;h.rotation.identity(),c.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,h.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),h.position.set(0,m,p),c.position.set(g,_,0),d.position.set(v,0,y),h.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var e=this._control.getCamera(),t=[new a.a.Vector4,new a.a.Vector4],r=new a.a.Vector4;this.groupGL.getWorldPosition(r),r.w=1,r.transformMat4(e.viewMatrix).transformMat4(e.projectionMatrix),r.x/=r.w,r.y/=r.w,this._axes.forEach(function(n){for(var i=n.axisLineCoords,a=(n.labelsMesh.geometry,0);ar.y?"bottom":"top"):(s="middle",o=h>r.x?"left":"right"),n.setSpriteAlign(o,s,this._api)},this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(e){function t(e){return u.a.firstNotNull(e.model.get("axisPointer.show"),l.get("show"))}function r(e){var t=e.model.getModel("axisPointer",l),r=t.getModel("lineStyle"),n=a.a.parseColor(r.get("color")),i=m(r.get("width"),1),o=m(r.get("opacity"),1);return n[3]*=o,{color:n,lineWidth:i}}var n=this._model.coordinateSystem,i=n.dataToPoint(e),o=this._axisPointerLineMesh,s=o.geometry,l=this._model.getModel("axisPointer"),h=this._api.getDevicePixelRatio();s.convertToDynamicArray(!0);for(var c=0;c0&&e.rotation.rotateY(Math.PI),t.normal.z=-n)}function i(e,t,r){this.rootNode=new s.a.Node;var n=new s.a.Mesh({geometry:new l.a({useNativeLine:!1}),material:t,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),i=new s.a.Mesh({geometry:new h.a,material:r,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(i),this.rootNode.add(n),this.faceInfo=e,this.plane=new s.a.Plane,this.linesMesh=n,this.quadsMesh=i}var a=r(0),o=r.n(a),s=r(1),u=r(2),l=r(25),h=r(163),c=u.a.firstNotNull,d={x:0,y:2,z:1};i.prototype.update=function(e,t,r){var i=e.coordinateSystem,a=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],o=this.linesMesh.geometry,s=this.quadsMesh.geometry;o.convertToDynamicArray(!0),s.convertToDynamicArray(!0),this._updateSplitLines(o,a,e,r),this._udpateSplitAreas(s,a,e,r),o.convertToTypedArray(),s.convertToTypedArray();var u=i.getAxis(this.faceInfo[2]);n(this.rootNode,this.plane,u,this.faceInfo[3])},i.prototype._updateSplitLines=function(e,t,r,n){var i=n.getDevicePixelRatio();t.forEach(function(n,a){var u=n.model,l=t[1-a].getExtent();if(!n.scale.isBlank()){var h=u.getModel("splitLine",r.getModel("splitLine"));if(h.get("show")){var d=h.getModel("lineStyle"),f=d.get("color"),p=c(d.get("opacity"),1),m=c(d.get("width"),1);f=o.a.util.isArray(f)?f:[f];for(var g=n.getTicksCoords({tickModel:h}),_=0,v=0;v65535?new Uint32Array(3*n):new Uint16Array(3*n))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var e=u.create(),t=u.create(),r=u.create(),n=[0,3,1,3,2,1];return function(i,a){var o=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;u.sub(e,i[1],i[0]),u.sub(t,i[2],i[1]),u.cross(r,e,t),u.normalize(r,r);for(var h=0;h<4;h++)o.set(this._vertexOffset+h,i[h]),l.set(this._vertexOffset+h,a),s.set(this._vertexOffset+h,r);for(var c=3*this._faceOffset,h=0;h<6;h++)this.indices[c+h]=n[h]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});a.a.util.defaults(l.prototype,o.a),t.a=l},function(e,t,r){"use strict";function n(e,t){var r=new o.a.Mesh({geometry:new s.a({useNativeLine:!1}),material:t,castShadow:!1,ignorePicking:!0,renderOrder:2}),n=new l.a;n.material.depthMask=!1;var i=new o.a.Node;i.add(r),i.add(n),this.rootNode=i,this.dim=e,this.linesMesh=r,this.labelsMesh=n,this.axisLineCoords=null,this.labelElements=[]}var i=r(0),a=r.n(i),o=r(1),s=r(25),u=r(2),l=r(63),h=u.a.firstNotNull,c={x:0,y:2,z:1},d={x:"y",y:"x",z:"y"};n.prototype.update=function(e,t,r){var n=e.coordinateSystem,i=n.getAxis(this.dim),s=this.linesMesh.geometry,u=this.labelsMesh.geometry;s.convertToDynamicArray(!0),u.convertToDynamicArray(!0);var l=i.model,f=i.getExtent(),p=r.getDevicePixelRatio(),m=l.getModel("axisLine",e.getModel("axisLine")),g=l.getModel("axisTick",e.getModel("axisTick")),_=l.getModel("axisLabel",e.getModel("axisLabel")),v=m.get("lineStyle.color");if(m.get("show")){var y=m.getModel("lineStyle"),x=[0,0,0],T=[0,0,0],b=c[i.dim];x[b]=f[0],T[b]=f[1],this.axisLineCoords=[x,T];var w=o.a.parseColor(v),E=h(y.get("width"),1),S=h(y.get("opacity"),1);w[3]*=S,s.addLine(x,T,w,E*p)}if(g.get("show")){var A=g.getModel("lineStyle"),M=o.a.parseColor(h(A.get("color"),v)),E=h(A.get("width"),1);M[3]*=h(A.get("opacity"),1);for(var C=i.getTicksCoords(),L=g.get("length"),D=0;D65535?new Uint32Array(3*r):new Uint16Array(3*r))},setSpriteAlign:function(e,t,r,n,i){null==r&&(r="left"),null==n&&(n="top");var a,o,s,u;switch(i=i||0,r){case"left":a=i,s=t[0]+i;break;case"center":case"middle":a=-t[0]/2,s=t[0]/2;break;case"right":a=-t[0]-i,s=-i}switch(n){case"bottom":o=i,u=t[1]+i;break;case"middle":o=-t[1]/2,u=t[1]/2;break;case"top":o=-t[1]-i,u=-i}var l=4*e,h=this.attributes.offset;h.set(l,[a,u]),h.set(l+1,[s,u]),h.set(l+2,[s,o]),h.set(l+3,[a,o])},addSprite:function(e,t,r,n,i,a){var o=this._vertexOffset;this.setSprite(this._vertexOffset/4,e,t,r,n,i,a);for(var u=0;u1?"."+e[1]:""))}function i(e,t){return e=(e||"").toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}function a(e){return null==e?"":(e+"").replace(g,function(e,t){return _[t]})}function o(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return"";for(var i=t[0].$vars||[],o=0;o':'':""}function l(e,t){return e+="","0000".substr(0,t-e.length)+e}function h(e,t,r){"week"!==e&&"month"!==e&&"quarter"!==e&&"half-year"!==e&&"year"!==e||(e="MM-dd\nyyyy");var n=p.parseDate(t),i=r?"UTC":"",a=n["get"+i+"FullYear"](),o=n["get"+i+"Month"]()+1,s=n["get"+i+"Date"](),u=n["get"+i+"Hours"](),h=n["get"+i+"Minutes"](),c=n["get"+i+"Seconds"](),d=n["get"+i+"Milliseconds"]();return e=e.replace("MM",l(o,2)).replace("M",o).replace("yyyy",a).replace("yy",a%100).replace("dd",l(s,2)).replace("d",s).replace("hh",l(u,2)).replace("h",u).replace("mm",l(h,2)).replace("m",h).replace("ss",l(c,2)).replace("s",c).replace("SSS",l(d,3))}function c(e){return e?e.charAt(0).toUpperCase()+e.substr(1):e}var d=r(13),f=r(172),p=r(85),m=d.normalizeCssArray,g=/([&<>"'])/g,_={"&":"&","<":"<",">":">",'"':""","'":"'"},v=["a","b","c","d","e","f","g"],y=function(e,t){return"{"+e+(null==t?"":t)+"}"},x=f.truncateText,T=f.getBoundingRect;t.addCommas=n,t.toCamelCase=i,t.normalizeCssArray=m,t.encodeHTML=a,t.formatTpl=o,t.formatTplSimple=s,t.getTooltipMarker=u,t.formatTime=h,t.capitalFirst=c,t.truncateText=x,t.getTextRect=T},function(e,t,r){function n(e,t){I[e]=t}function i(e,t){t=t||P;var r=e+":"+t;if(L[r])return L[r];for(var n=(e+"").split("\n"),i=0,a=0,o=n.length;aN&&(D=0,L={}),D++,L[r]=i,i}function a(e,t,r,n,i,a,u){return a?s(e,t,r,n,i,a,u):o(e,t,r,n,i,u)}function o(e,t,r,n,a,o){var s=_(e,t,a,o),h=i(e,t);a&&(h+=a[1]+a[3]);var c=s.outerHeight,d=u(0,h,r),f=l(0,c,n),p=new T(d,f,h,c);return p.lineHeight=s.lineHeight,p}function s(e,t,r,n,i,a,o){var s=v(e,{rich:a,truncate:o,font:t,textAlign:r,textPadding:i}),h=s.outerWidth,c=s.outerHeight,d=u(0,h,r),f=l(0,c,n);return new T(d,f,h,c)}function u(e,t,r){return"right"===r?e-=t:"center"===r&&(e-=t/2),e}function l(e,t,r){return"middle"===r?e-=t/2:"bottom"===r&&(e-=t),e}function h(e,t,r){var n=t.x,i=t.y,a=t.height,o=t.width,s=a/2,u="left",l="top";switch(e){case"left":n-=r,i+=s,u="right",l="middle";break;case"right":n+=r+o,i+=s,l="middle";break;case"top":n+=o/2,i-=r,u="center",l="bottom";break;case"bottom":n+=o/2,i+=a+r,u="center";break;case"inside":n+=o/2,i+=s,u="center",l="middle";break;case"insideLeft":n+=r,i+=s,l="middle";break;case"insideRight":n+=o-r,i+=s,u="right",l="middle";break;case"insideTop":n+=o/2,i+=r,u="center";break;case"insideBottom":n+=o/2,i+=a-r,u="center",l="bottom";break;case"insideTopLeft":n+=r,i+=r;break;case"insideTopRight":n+=o-r,i+=r,u="right";break;case"insideBottomLeft":n+=r,i+=a-r,l="bottom";break;case"insideBottomRight":n+=o-r,i+=a-r,u="right",l="bottom"}return{x:n,y:i,textAlign:u,textVerticalAlign:l}}function c(e,t,r,n,i){if(!t)return"";var a=(e+"").split("\n");i=d(t,r,n,i);for(var o=0,s=a.length;o=o;u++)s-=o;var l=i(r);return l>s&&(r="",l=0),s=e-l,n.ellipsis=r,n.ellipsisWidth=l,n.contentWidth=s,n.containerWidth=e,n}function f(e,t){var r=t.containerWidth,n=t.font,a=t.contentWidth;if(!r)return"";var o=i(e,n);if(o<=r)return e;for(var s=0;;s++){if(o<=a||s>=t.maxIterations){e+=t.ellipsis;break}var u=0===s?p(e,a,t.ascCharWidth,t.cnCharWidth):o>0?Math.floor(e.length*a/o):0;e=e.substr(0,u),o=i(e,n)}return""===e&&(e=t.placeholder),e}function p(e,t,r,n){for(var i=0,a=0,o=e.length;au)e="",a=[];else if(null!=l)for(var h=d(l-(r?r[1]+r[3]:0),t,n.ellipsis,{minChar:n.minChar,placeholder:n.placeholder}),c=0,p=a.length;ca&&y(r,e.substring(a,o)),y(r,n[2],n[1]),a=R.lastIndex}ag)return{lines:[],width:0,height:0};E.textWidth=i(E.text,L);var N=S.textWidth,P=null==N||"auto"===N;if("string"==typeof N&&"%"===N.charAt(N.length-1))E.percentWidth=N,h.push(E),N=0;else{if(P){N=E.textWidth;var I=S.textBackgroundColor,O=I&&I.image;O&&(O=b.findExistImage(O),b.isImageReady(O)&&(N=Math.max(N,O.width*D/O.height)))}var F=C?C[1]+C[3]:0;N+=F;var B=null!=p?p-T:null;null!=B&&B4){console.warn("Support at most 4 cascade");continue}m.shadowCascade>1&&(s=m),this.renderDirectionalLightShadow(e,t,r,m,d,c,h)}else"SPOT_LIGHT"===m.type?this.renderSpotLightShadow(e,t,m,l,u):"POINT_LIGHT"===m.type&&this.renderPointLightShadow(e,t,m,f);this._shadowMapNumber[m.type]++}for(var g in this._shadowMapNumber)for(var _=this._shadowMapNumber[g],v=g+"_SHADOWMAP_COUNT",p=0;p0?x.define("fragment",v,_):x.isDefined("fragment",v)&&x.undefine("fragment",v))}for(var p=0;p0){var b=h.map(i);if(T.directionalLightShadowMaps={value:h,type:"tv"},T.directionalLightMatrices={value:c,type:"m4v"},T.directionalLightShadowMapSizes={value:b,type:"1fv"},s){var w=d.slice(),E=d.slice();w.pop(),E.shift(),w.reverse(),E.reverse(),c.reverse(),T.shadowCascadeClipsNear={value:w,type:"1fv"},T.shadowCascadeClipsFar={value:E,type:"1fv"}}}if(u.length>0){var S=u.map(i),T=t.shadowUniforms;T.spotLightShadowMaps={value:u,type:"tv"},T.spotLightMatrices={value:l,type:"m4v"},T.spotLightShadowMapSizes={value:S,type:"1fv"}}f.length>0&&(T.pointLightShadowMaps={value:f,type:"tv"})}},renderDirectionalLightShadow:function(){var e=new l.a,t=new h.a,r=new u.a,a=new h.a,o=new h.a,s=new h.a,d=new h.a;return function(u,l,f,p,m,g,_){var y=this._getDepthMaterial(p),x={getMaterial:function(e){return e.shadowDepthMaterial||y},isMaterialChanged:i,getUniform:n,ifRender:function(e){return e.castShadow},sortCompare:c.a.opaqueSortCompare};if(!l.viewBoundingBoxLastFrame.isFinite()){var T=l.getBoundingBox();l.viewBoundingBoxLastFrame.copy(T).applyTransform(f.viewMatrix)}var w=Math.min(-l.viewBoundingBoxLastFrame.min.z,f.far),E=Math.max(-l.viewBoundingBoxLastFrame.max.z,f.near),A=this._getDirectionalLightCamera(p,l,f),M=s.array;d.copy(A.projectionMatrix),b.a.invert(o.array,A.worldTransform.array),b.a.multiply(o.array,o.array,f.worldTransform.array),b.a.multiply(M,d.array,o.array);for(var C=[],L=f instanceof v.a,D=(f.near+f.far)/(f.near-f.far),N=2*f.near*f.far/(f.near-f.far),R=0;R<=p.shadowCascade;R++){var P=E*Math.pow(w/E,R/p.shadowCascade),I=E+(w-E)*R/p.shadowCascade,O=P*p.cascadeSplitLogFactor+I*(1-p.cascadeSplitLogFactor);C.push(O),m.push(-(-O*D+N)/-O)}var F=this._getTexture(p,p.shadowCascade);_.push(F);var B=u.viewport,U=u.gl;this._frameBuffer.attach(F),this._frameBuffer.bind(u),U.clear(U.COLOR_BUFFER_BIT|U.DEPTH_BUFFER_BIT);for(var R=0;Ru?s>l?v[i>0?"px":"nx"]=!0:v[o>0?"pz":"nz"]=!0:u>l?v[a>0?"py":"ny"]=!0:v[o>0?"pz":"nz"]=!0}for(var r=0;r=0||(this.nodes.push(e),this._dirty=!0)},removeNode:function(e){"string"==typeof e&&(e=this.getNodeByName(e));var t=this.nodes.indexOf(e);t>=0&&(this.nodes.splice(t,1),this._dirty=!0)},getNodeByName:function(e){for(var t=0;t=t.COLOR_ATTACHMENT0&&l<=t.COLOR_ATTACHMENT0+8&&c.push(l);h.drawBuffersEXT(c)}e.saveClear(),e.clearBit=i.a.DEPTH_BUFFER_BIT|i.a.COLOR_BUFFER_BIT,r=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),e.restoreClear(),n.unbind(e)}else r=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",r),this._rendering=!1,this._rendered=!0}});t.a=o},function(e,t,r){"use strict";var n=r(48),i=n.a.extend(function(){return{texture:null,outputs:{color:{}}}},function(){},{getOutput:function(e,t){return this.texture},beforeFrame:function(){},afterFrame:function(){}});t.a=i},function(e,t,r){"use strict";var n=r(16),i=r(48),a=i.a.extend(function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}},function(){var e=new n.a({fragment:this.shader});this.pass=e},{render:function(e,t){this.trigger("beforerender",e),this._rendering=!0;var r=e.gl;for(var n in this.inputLinks){var i=this.inputLinks[n],a=i.node.getOutput(e,i.pin);this.pass.setUniform(n,a)}if(this.outputs){this.pass.outputs={};var o={};for(var s in this.outputs){var u=this.updateParameter(s,e);isNaN(u.width)&&this.updateParameter(s,e);var l=this.outputs[s],h=this._compositor.allocateTexture(u);this._outputTextures[s]=h;var c=l.attachment||r.COLOR_ATTACHMENT0;"string"==typeof c&&(c=r[c]),o[c]=h}this._compositor.getFrameBuffer().bind(e);for(var c in o)this._compositor.getFrameBuffer().attach(o[c],c);this.pass.render(e),this._compositor.getFrameBuffer().updateMipmap(e)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(e),this.pass.render(e,t);for(var n in this.inputLinks){var i=this.inputLinks[n];i.node.removeReference(i.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",e)},updateParameter:function(e,t){var r=this.outputs[e],n=r.parameters,i=r._parametersCopy;if(i||(i=r._parametersCopy={}),n)for(var a in n)"width"!==a&&"height"!==a&&(i[a]=n[a]);var o,s;return o=n.width instanceof Function?n.width.call(this,t):n.width,s=n.height instanceof Function?n.height.call(this,t):n.height,o=Math.ceil(o),s=Math.ceil(s),i.width===o&&i.height===s||this._outputTextures[e]&&this._outputTextures[e].dispose(t),i.width=o,i.height=s,i},setParameter:function(e,t){this.pass.setUniform(e,t)},getParameter:function(e){return this.pass.getUniform(e)},setParameters:function(e){for(var t in e)this.setParameter(t,e[t])},define:function(e,t){this.pass.material.define("fragment",e,t)},undefine:function(e){this.pass.material.undefine("fragment",e)},removeReference:function(e){if(0===--this._outputReferences[e]){this.outputs[e].keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e])}},clear:function(){i.a.prototype.clear.call(this),this.pass.material.disableTexturesAll()}});t.a=a},function(e,t,r){"use strict";function n(e){e.import(i.a),e.import(a.a),e.import(o.a),e.import(s.a),e.import(u.a),e.import(l.a),e.import(h.a),e.import(c.a),e.import(d.a),e.import(f.a),e.import(p.a),e.import(m.a),e.import(g.a)}t.a=n;var i=r(185),a=r(87),o=r(186),s=r(88),u=r(187),l=r(89),h=r(90),c=r(91),d=r(92),f=r(93),p=r(188),m=r(94),g=r(95)},function(e,t,r){"use strict";t.a="@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"},function(e,t,r){"use strict";t.a="@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"},function(e,t,r){"use strict";t.a="@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"},function(e,t,r){"use strict";t.a="@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"},function(e,t,r){"use strict";function n(e){for(var t=new Uint8Array(e*e*4),r=0,n=new u.a,i=0;i=1?.95:0,weight2:n>=1?.05:1}),p.render(e)),h.attach(u),d.setUniform("texture",this._physicallyCorrect?this._currentTexture:s),d.render(e),h.attach(l),f.setUniform("texture",u),f.render(e),h.unbind(e),this._physicallyCorrect){var v=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=v}},n.prototype.getTargetTexture=function(){return this._texture3},n.prototype.setParameter=function(e,t){"maxIteration"===e?this._ssrPass.material.define("fragment","MAX_ITERATION",t):this._ssrPass.setUniform(e,t)},n.prototype.setPhysicallyCorrect=function(e){e?(this._normalDistribution||(this._normalDistribution=h.a.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=e},n.prototype.setSSAOTexture=function(e){var t=this._blurPass2;e?(t.material.enableTexture("ssaoTex"),t.material.set("ssaoTex",e)):t.material.disableTexture("ssaoTex")},n.prototype.isFinished=function(e){return!this._physicallyCorrect||e>this._totalSamples/this._samplePerFrame},n.prototype.dispose=function(e){this._ssrTexture.dispose(e),this._texture2.dispose(e),this._texture3.dispose(e),this._prevTexture.dispose(e),this._currentTexture.dispose(e),this._frameBuffer.dispose(e)},t.a=n},function(e,t,r){"use strict";t.a="@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"},function(e,t,r){"use strict";t.a=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925]},function(e,t,r){"use strict";function n(e,t,r,n,i){var a=e.gl;t.setUniform(a,"1i",r,i),a.activeTexture(a.TEXTURE0+i),n.isRenderable()?n.bind(e):n.unbind(e)}function i(e,t,r,i,a){var o,s,u,l,h=e.gl;return function(a,c,d){if(!l||l.material!==a.material){var f=a.material,p=a.__program,m=f.get("roughness");null==m&&(m=1);var g=f.get("normalMap")||t,_=f.get("roughnessMap"),v=f.get("bumpMap"),y=f.get("uvRepeat"),x=f.get("uvOffset"),T=f.get("detailUvRepeat"),b=f.get("detailUvOffset"),w=!!v&&f.isTextureEnabled("bumpMap"),E=!!_&&f.isTextureEnabled("roughnessMap"),S=f.isDefined("fragment","DOUBLE_SIDED");v=v||r,_=_||i,d!==c?(c.set("normalMap",g),c.set("bumpMap",v),c.set("roughnessMap",_),c.set("useBumpMap",w),c.set("useRoughnessMap",E),c.set("doubleSide",S),null!=y&&c.set("uvRepeat",y),null!=x&&c.set("uvOffset",x),null!=T&&c.set("detailUvRepeat",T),null!=b&&c.set("detailUvOffset",b),c.set("roughness",m)):(p.setUniform(h,"1f","roughness",m),o!==g&&n(e,p,"normalMap",g,0),s!==v&&v&&n(e,p,"bumpMap",v,1),u!==_&&_&&n(e,p,"roughnessMap",_,2),null!=y&&p.setUniform(h,"2f","uvRepeat",y),null!=x&&p.setUniform(h,"2f","uvOffset",x),null!=T&&p.setUniform(h,"2f","detailUvRepeat",T),null!=b&&p.setUniform(h,"2f","detailUvOffset",b),p.setUniform(h,"1i","useBumpMap",+w),p.setUniform(h,"1i","useRoughnessMap",+E),p.setUniform(h,"1i","doubleSide",+S)),o=g,s=v,u=_,l=a}}}function a(e){e=e||{},this._depthTex=new o.a({format:s.a.DEPTH_COMPONENT,type:s.a.UNSIGNED_INT}),this._normalTex=new o.a({type:s.a.HALF_FLOAT}),this._framebuffer=new l.a,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,l.a.DEPTH_ATTACHMENT),this._normalMaterial=new h.a({shader:new u.a(u.a.source("ecgl.normal.vertex"),u.a.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=d.a.createBlank("#000"),this._defaultBumpMap=d.a.createBlank("#000"),this._defaultRoughessMap=d.a.createBlank("#000"),this._debugPass=new c.a({fragment:u.a.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}var o=r(5),s=r(4),u=r(8),l=r(10),h=r(19),c=r(16),d=r(61),f=r(195);u.a.import(f.a),a.prototype.getDepthTexture=function(){return this._depthTex},a.prototype.getNormalTexture=function(){return this._normalTex},a.prototype.update=function(e,t,r){var n=e.getWidth(),a=e.getHeight(),o=this._depthTex,s=this._normalTex,u=this._normalMaterial;o.width=n,o.height=a,s.width=n,s.height=a;var l=t.getRenderList(r).opaque;this._framebuffer.bind(e),e.gl.clearColor(0,0,0,0),e.gl.clear(e.gl.COLOR_BUFFER_BIT|e.gl.DEPTH_BUFFER_BIT),e.gl.disable(e.gl.BLEND),e.renderPass(l,r,{getMaterial:function(){return u},ifRender:function(e){return e.renderNormal},beforeRender:i(e,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:e.opaqueSortCompare}),this._framebuffer.unbind(e)},a.prototype.renderDebug=function(e){this._debugPass.render(e)},a.prototype.dispose=function(e){this._depthTex.dispose(e),this._normalTex.dispose(e)},t.a=a},function(e,t,r){"use strict";t.a="@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"},function(e,t,r){"use strict";function n(e){e=e||{},this._edgePass=new o.a({fragment:s.a.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",e.normalTexture),this._edgePass.setUniform("depthTexture",e.depthTexture),this._targetTexture=new i.a({type:a.a.HALF_FLOAT}),this._frameBuffer=new u.a,this._frameBuffer.attach(this._targetTexture)}var i=(r(9),r(3),r(5)),a=r(4),o=r(16),s=r(8),u=r(10);n.prototype.update=function(e,t,r,n){var i=e.getWidth(),a=e.getHeight(),o=this._targetTexture;o.width=i,o.height=a;var s=this._frameBuffer;s.bind(e),this._edgePass.setUniform("projectionInv",t.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[i,a]),this._edgePass.setUniform("texture",r),this._edgePass.render(e),s.unbind(e)},n.prototype.getTargetTexture=function(){return this._targetTexture},n.prototype.setParameter=function(e,t){this._edgePass.setUniform(e,t)},n.prototype.dispose=function(e){this._targetTexture.dispose(e),this._frameBuffer.dispose(e)},t.a=n},function(e,t,r){"use strict";t.a={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]}},function(e,t,r){"use strict";t.a="@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"},function(e,t,r){"use strict";t.a="@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end"},function(e,t,r){"use strict";function n(e){for(var t=[],r=0;r<30;r++)t.push([Object(i.a)(r,2),Object(i.a)(r,3)]);this._haltonSequence=t,this._frame=0,this._sourceTex=new s.a,this._sourceFb=new o.a,this._sourceFb.attach(this._sourceTex),this._prevFrameTex=new s.a,this._outputTex=new s.a;var n=this._blendPass=new a.a({fragment:u.a.source("clay.compositor.blend")});n.material.disableTexturesAll(),n.material.enableTexture(["texture1","texture2"]),this._blendFb=new o.a({depthBuffer:!1}),this._outputPass=new a.a({fragment:u.a.source("clay.compositor.output"),blendWithPrevious:!0}),this._outputPass.material.define("fragment","OUTPUT_ALPHA"),this._outputPass.material.blend=function(e){e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}}var i=r(49),a=r(16),o=r(10),s=r(5),u=r(8),l=r(9);n.prototype={constructor:n,jitterProjection:function(e,t){var r=e.viewport,n=r.devicePixelRatio||e.getDevicePixelRatio(),i=r.width*n,a=r.height*n,o=this._haltonSequence[this._frame%this._haltonSequence.length],s=new l.a;s.array[12]=(2*o[0]-1)/i,s.array[13]=(2*o[1]-1)/a,l.a.mul(t.projectionMatrix,s,t.projectionMatrix),l.a.invert(t.invProjectionMatrix,t.projectionMatrix)},resetFrame:function(){this._frame=0},getFrame:function(){return this._frame},getSourceFrameBuffer:function(){return this._sourceFb},getOutputTexture:function(){return this._outputTex},resize:function(e,t){this._prevFrameTex.width=e,this._prevFrameTex.height=t,this._outputTex.width=e,this._outputTex.height=t,this._sourceTex.width=e,this._sourceTex.height=t,this._prevFrameTex.dirty(),this._outputTex.dirty(),this._sourceTex.dirty()},isFinished:function(){return this._frame>=this._haltonSequence.length},render:function(e,t,r){var n=this._blendPass;0===this._frame?(n.setUniform("weight1",0),n.setUniform("weight2",1)):(n.setUniform("weight1",.9),n.setUniform("weight2",.1)),n.setUniform("texture1",this._prevFrameTex),n.setUniform("texture2",t||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(e),n.render(e),this._blendFb.unbind(e),r||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(e));var i=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=i,this._frame++},dispose:function(e){this._sourceFb.dispose(e),this._blendFb.dispose(e),this._prevFrameTex.dispose(e),this._outputTex.dispose(e),this._sourceTex.dispose(e),this._outputPass.dispose(e),this._blendPass.dispose(e)}},t.a=n},function(e,t,r){"use strict";var n=r(0),i=r.n(n);r(202),r(203),r(98);i.a.registerAction({type:"geo3DChangeCamera",event:"geo3dcamerachanged",update:"series:updateCamera"},function(e,t){t.eachComponent({mainType:"geo3D",query:e},function(t){t.setView(e)})})},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(44),o=r(28),s=r(29),u=r(31),l=r(96),h=i.a.extendComponentModel({type:"geo3D",layoutMode:"box",coordinateSystem:null,optionUpdated:function(){var e=this.option;e.regions=this.getFilledRegions(e.regions,e.map);var t=i.a.helper.completeDimensions(["value"],e.data,{encodeDef:this.get("encode"),dimsDef:this.get("dimensions")}),r=new i.a.List(t,this);r.initData(e.regions);var n={};r.each(function(e){var t=r.getName(e),i=r.getItemModel(e);n[t]=i}),this._regionModelMap=n,this._data=r},getData:function(){return this._data},getRegionModel:function(e){var t=this.getData().getName(e);return this._regionModelMap[t]||new i.a.Model(null,this)},getRegionPolygonCoords:function(e){var t=this.getData().getName(e),r=this.coordinateSystem.getRegion(t);return r?r.geometries:[]},getFormattedLabel:function(e,t){var r=this._data.getName(e),n=this.getRegionModel(r),i=n.get("normal"===t?["label","formatter"]:["emphasis","label","formatter"]);null==i&&(i=n.get(["label","formatter"]));var a={name:r};if("function"==typeof i)return a.status=t,i(a);if("string"==typeof i){var o=a.seriesName;return i.replace("{a}",null!=o?o:"")}return r},defaultOption:{regions:[]}});i.a.util.merge(h.prototype,l.a),i.a.util.merge(h.prototype,a.a),i.a.util.merge(h.prototype,o.a),i.a.util.merge(h.prototype,s.a),i.a.util.merge(h.prototype,u.a)},function(e,t,r){"use strict";var n=r(64),i=r(0),a=r.n(i),o=r(1),s=r(45),u=r(30);a.a.extendComponentView({type:"geo3D",__ecgl__:!0,init:function(e,t){this._geo3DBuilder=new n.a(t),this.groupGL=new o.a.Node,this._lightRoot=new o.a.Node,this._sceneHelper=new u.a(this._lightRoot),this._sceneHelper.initLight(this._lightRoot),this._control=new s.a({zr:t.getZr()}),this._control.init()},render:function(e,t,r){this.groupGL.add(this._geo3DBuilder.rootNode);var n=e.coordinateSystem;if(n&&n.viewGL){n.viewGL.add(this._lightRoot),e.get("show")?n.viewGL.add(this.groupGL):n.viewGL.remove(this.groupGL);var i=this._control;i.setViewGL(n.viewGL);var a=e.getModel("viewControl");i.setFromViewControlModel(a,0),this._sceneHelper.setScene(n.viewGL.scene),this._sceneHelper.updateLight(e),n.viewGL.setPostEffect(e.getModel("postEffect"),r),n.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._geo3DBuilder.update(e,t,r,0,e.getData().count());var o=n.viewGL.isLinearSpace()?"define":"undefine";this._geo3DBuilder.rootNode.traverse(function(e){e.material&&e.material[o]("fragment","SRGB_DECODE")}),i.off("update"),i.on("update",function(){r.dispatchAction({type:"geo3DChangeCamera",alpha:i.getAlpha(),beta:i.getBeta(),distance:i.getDistance(),center:i.getCenter(),from:this.uid,geo3DId:e.id})}),i.update()}},afterRender:function(e,t,r,n){var i=n.renderer;this._sceneHelper.updateAmbientCubemap(i,e,r),this._sceneHelper.updateSkybox(i,e,r)},dispose:function(){this._control.dispose()}})},function(e,t,r){"use strict";function n(e,t,r){r=r||2;var n=t&&t.length,a=n?t[0]*r:e.length,s=i(e,0,a,r,!0),u=[];if(!s)return u;var l,h,d,f,p,m,g;if(n&&(s=c(e,t,s,r)),e.length>80*r){l=d=e[0],h=f=e[1];for(var _=r;_d&&(d=p),m>f&&(f=m);g=Math.max(d-l,f-h)}return o(s,u,r,l,h,g),u}function i(e,t,r,n,i){var a,o;if(i===N(e,t,r,n)>0)for(a=t;a=t;a-=n)o=C(a,e[a],e[a+1],o);return o&&b(o,o.next)&&(L(o),o=o.next),o}function a(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!b(n,n.next)&&0!==T(n.prev,n,n.next))n=n.next;else{if(L(n),(n=t=n.prev)===n.next)return null;r=!0}}while(r||n!==t);return t}function o(e,t,r,n,i,c,d){if(e){!d&&c&&m(e,n,i,c);for(var f,p,g=e;e.prev!==e.next;)if(f=e.prev,p=e.next,c?u(e,n,i,c):s(e))t.push(f.i/r),t.push(e.i/r),t.push(p.i/r),L(e),e=p.next,g=p.next;else if((e=p)===g){d?1===d?(e=l(e,t,r),o(e,t,r,n,i,c,2)):2===d&&h(e,t,r,n,i,c):o(a(e),t,r,n,i,c,1);break}}}function s(e){var t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(y(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&T(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function u(e,t,r,n){var i=e.prev,a=e,o=e.next;if(T(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,h=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,c=_(s,u,t,r,n),d=_(l,h,t,r,n),f=e.nextZ;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&y(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&T(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=e.prevZ;f&&f.z>=c;){if(f!==e.prev&&f!==e.next&&y(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&T(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function l(e,t,r){var n=e;do{var i=n.prev,a=n.next.next;!b(i,a)&&w(i,n,n.next,a)&&S(i,a)&&S(a,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(a.i/r),L(n),L(n.next),n=e=a),n=n.next}while(n!==e);return n}function h(e,t,r,n,i,s){var u=e;do{for(var l=u.next.next;l!==u.prev;){if(u.i!==l.i&&x(u,l)){var h=M(u,l);return u=a(u,u.next),h=a(h,h.next),o(u,t,r,n,i,s),void o(h,t,r,n,i,s)}l=l.next}u=u.next}while(u!==e)}function c(e,t,r,n){var o,s,u,l,h,c=[];for(o=0,s=t.length;o=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=h&&i!==n.x&&y(ar.x)&&S(n,e)&&(r=n,d=u),n=n.next;return r}function m(e,t,r,n){var i=e;do{null===i.z&&(i.z=_(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,g(i)}function g(e){var t,r,n,i,a,o,s,u,l=1;do{for(r=e,e=null,a=null,o=0;r;){for(o++,n=r,s=0,t=0;t0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=n}a.nextZ=null,l*=2}while(o>1);return e}function _(e,t,r,n,i){return e=32767*(e-r)/i,t=32767*(t-n)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function v(e){var t=e,r=e;do{t.x=0&&(e-o)*(n-s)-(r-o)*(t-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function x(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!E(e,t)&&S(e,t)&&S(t,e)&&A(e,t)}function T(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function b(e,t){return e.x===t.x&&e.y===t.y}function w(e,t,r,n){return!!(b(e,t)&&b(r,n)||b(e,n)&&b(r,t))||T(e,t,r)>0!=T(e,t,n)>0&&T(r,n,e)>0!=T(r,n,t)>0}function E(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&w(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function S(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function A(e,t){var r=e,n=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}function M(e,t){var r=new D(e.i,e.x,e.y),n=new D(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function C(e,t,r,n){var i=new D(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function L(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function D(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function N(e,t,r,n){for(var i=0,a=t,o=r-n;a0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var e=this.getDisplacementTexture(),t=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==e||this._displacementScale!==t,this._displacementTexture=e,this._displacementScale=t},isDisplacementChanged:function(){return this._displacementChanged}});a.a.util.merge(h.prototype,o.a),a.a.util.merge(h.prototype,s.a),a.a.util.merge(h.prototype,u.a),a.a.util.merge(h.prototype,l.a)},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(1),o=r(45),s=r(30),u=r(210),l=r(2);i.a.extendComponentView({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(e,t){this.groupGL=new a.a.Node,this._sphereGeometry=new a.a.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new a.a.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new a.a.PlaneGeometry,this._earthMesh=new a.a.Mesh({renderNormal:!0}),this._lightRoot=new a.a.Node,this._sceneHelper=new s.a,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._earthMesh),this._control=new o.a({zr:t.getZr()}),this._control.init(),this._layerMeshes={}},render:function(e,t,r){var n=e.coordinateSystem,i=e.get("shading");n.viewGL.add(this._lightRoot),e.get("show")?n.viewGL.add(this.groupGL):n.viewGL.remove(this.groupGL),this._sceneHelper.setScene(n.viewGL.scene),n.viewGL.setPostEffect(e.getModel("postEffect"),r),n.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling"));var o=this._earthMesh;o.geometry=this._sphereGeometry;var s="ecgl."+i;o.material&&o.material.shader.name===s||(o.material=a.a.createMaterial(s)),a.a.setMaterialFromModel(i,o.material,e,r),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach(function(e){var t=o.material.get(e);t&&(t.flipY=!1)}),o.material.set("color",a.a.parseColor(e.get("baseColor")));var u=.99*n.radius;o.scale.set(u,u,u);var l=o.material.setTextureImage("diffuseMap",e.get("baseTexture"),r,{flipY:!1,anisotropic:8});l&&l.surface&&l.surface.attachToMesh(o);var h=o.material.setTextureImage("bumpMap",e.get("heightTexture"),r,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(o),o.material[e.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(e,r),this._displaceVertices(e,r),this._updateViewControl(e,r),this._updateLayers(e,r)},afterRender:function(e,t,r,n){var i=n.renderer;this._sceneHelper.updateAmbientCubemap(i,e,r),this._sceneHelper.updateSkybox(i,e,r)},_updateLayers:function(e,t){var r=e.coordinateSystem,n=e.get("layers"),o=r.radius,s=[],u=[],h=[],c=[];i.a.util.each(n,function(e){var n=new i.a.Model(e),d=n.get("type"),f=a.a.loadTexture(n.get("texture"),t,{flipY:!1,anisotropic:8});if(f.surface&&f.surface.attachToMesh(this._earthMesh),"blend"===d){var p=n.get("blendTo"),m=l.a.firstNotNull(n.get("intensity"),1);"emission"===p?(h.push(f),c.push(m)):(s.push(f),u.push(m))}else{var g=n.get("id"),_=this._layerMeshes[g];_||(_=this._layerMeshes[g]=new a.a.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0}));"lambert"===n.get("shading")?(_.material=_.__lambertMaterial||new a.a.Material({autoUpdateTextureStatus:!1,shader:a.a.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),_.__lambertMaterial=_.material):(_.material=_.__colorMaterial||new a.a.Material({autoUpdateTextureStatus:!1,shader:a.a.createShader("ecgl.color"),transparent:!0,depthMask:!1}),_.__colorMaterial=_.material),_.material.enableTexture("diffuseMap");var v=n.get("distance"),y=o+(null==v?r.radius/100:v);_.scale.set(y,y,y),o=y;var x=this._blankTexture||(this._blankTexture=a.a.createBlankTexture("rgba(255, 255, 255, 0)"));_.material.set("diffuseMap",x),a.a.loadTexture(n.get("texture"),t,{flipY:!1,anisotropic:8},function(e){e.surface&&e.surface.attachToMesh(_),_.material.set("diffuseMap",e),t.getZr().refresh()}),n.get("show")?this.groupGL.add(_):this.groupGL.remove(_)}},this);var d=this._earthMesh.material;d.define("fragment","LAYER_DIFFUSEMAP_COUNT",s.length),d.define("fragment","LAYER_EMISSIVEMAP_COUNT",h.length),d.set("layerDiffuseMap",s),d.set("layerDiffuseIntensity",u),d.set("layerEmissiveMap",h),d.set("layerEmissionIntensity",c);var f=e.getModel("debug.wireframe");if(f.get("show")){d.define("both","WIREFRAME_TRIANGLE");var p=a.a.parseColor(f.get("lineStyle.color")||"rgba(0,0,0,0.5)"),m=l.a.firstNotNull(f.get("lineStyle.width"),1);d.set("wireframeLineWidth",m),d.set("wireframeLineColor",p)}else d.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(e,t){function r(){return{type:"globeChangeCamera",alpha:o.getAlpha(),beta:o.getBeta(),distance:o.getDistance()-n.radius,center:o.getCenter(),from:a.uid,globeId:e.id}}var n=e.coordinateSystem,i=e.getModel("viewControl"),a=(n.viewGL.camera,this),o=this._control;o.setViewGL(n.viewGL);var s,u,l=i.get("targetCoord");null!=l&&(u=l[0]+90,s=l[1]),o.setFromViewControlModel(i,{baseDistance:n.radius,alpha:s,beta:u}),o.off("update"),o.on("update",function(){t.dispatchAction(r())})},_displaceVertices:function(e,t){var r=e.get("displacementQuality"),n=e.get("debug.wireframe.show"),i=e.coordinateSystem;if(e.isDisplacementChanged()||r!==this._displacementQuality||n!==this._showDebugWireframe){this._displacementQuality=r,this._showDebugWireframe=n;var a=this._sphereGeometry,o={low:100,medium:200,high:400,ultra:800}[r]||200,s=o/2;(a.widthSegments!==o||n)&&(a.widthSegments=o,a.heightSegments=s,a.build()),this._doDisplaceVertices(a,i),n&&a.generateBarycentric()}},_doDisplaceVertices:function(e,t){var r=e.attributes.position.value,n=e.attributes.texcoord0.value,i=e.__originalPosition;i&&i.length===r.length||(i=new Float32Array(r.length),i.set(r),e.__originalPosition=i);for(var a=t.displacementWidth,o=t.displacementHeight,s=t.displacementData,u=0;uOpenStreetMap contributors, © CARTO',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var e=this;return s.reduce(function(t,r){return t[r]=e.get(r),t},{})},setMaptalksCameraOption:function(e){null!=e&&s.forEach(function(t){null!=e[t]&&(this.option[t]=e[t])},this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(e){this._maptalks=e}});i.a.util.merge(u.prototype,a.a),i.a.util.merge(u.prototype,o.a)},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(224),o=r(30),s=r(1),u=r(102);s.a.Shader.import(u.a);i.a.extendComponentView({type:"maptalks3D",__ecgl__:!0,init:function(e,t){this._groundMesh=new s.a.Mesh({geometry:new s.a.PlaneGeometry,material:new s.a.Material({shader:new s.a.Shader({vertex:s.a.Shader.source("ecgl.displayShadow.vertex"),fragment:s.a.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(e,t){var r=t.getZr();this._zrLayer=new a.a("maptalks3D",r,e.get("center"),e.get("zoom")),r.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new s.a.Node,this._sceneHelper=new o.a(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var n=this._zrLayer.getMaptalks(),i=this._dispatchInteractAction.bind(this,t,n);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend"].forEach(function(e){n.on(e,i)})},render:function(e,t,r){this._zrLayer||this._initMaptalksLayer(e,r);var n=this._zrLayer.getMaptalks(),i=e.get("urlTemplate"),a=n.getBaseLayer();i!==this._oldUrlTemplate&&(a?a.setOptions({urlTemplate:i,attribution:e.get("attribution")}):(a=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:i,subdomains:["a","b","c"],attribution:e.get("attribution")}),n.setBaseLayer(a))),this._oldUrlTemplate=i,n.setCenter(e.get("center")),n.setZoom(e.get("zoom"),{animation:!1}),n.setPitch(e.get("pitch")),n.setBearing(e.get("bearing")),e.setMaptalks(n);var o=e.coordinateSystem;o.viewGL.scene.add(this._lightRoot),o.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(o.viewGL.scene),this._sceneHelper.updateLight(e),o.viewGL.setPostEffect(e.getModel("postEffect"),r),o.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._maptalks3DModel=e},afterRender:function(e,t,r,n){var i=n.renderer;this._sceneHelper.updateAmbientCubemap(i,e,r),this._sceneHelper.updateSkybox(i,e,r),e.coordinateSystem.viewGL.scene.traverse(function(e){e.material&&(e.material.define("fragment","NORMAL_UP_AXIS",2),e.material.define("fragment","NORMAL_FRONT_AXIS",1))})},updateCamera:function(e,t,r,n){e.coordinateSystem.setCameraOption(n),this._updateGroundMesh(),r.getZr().refresh()},_dispatchInteractAction:function(e,t,r){e.dispatchAction({type:"maptalks3DChangeCamera",pitch:t.getPitch(),zoom:t.getZoom(),center:t.getCenter().toArray(),bearing:t.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var e=this._maptalks3DModel.coordinateSystem,t=e.dataToPoint(e.center);this._groundMesh.position.set(t[0],t[1],-.001);var r=new s.a.Plane(new s.a.Vector3(0,0,1),0),n=e.viewGL.camera.castRay(new s.a.Vector2(-1,-1)),i=e.viewGL.camera.castRay(new s.a.Vector2(1,1)),a=n.intersectPlane(r),o=i.intersectPlane(r),u=a.dist(o)/e.viewGL.rootNode.scale.x;this._groundMesh.scale.set(u,u,1)}},dispose:function(e,t){this._zrLayer&&this._zrLayer.dispose(),t.getZr().painter.delLayer(-1e3)}})},function(e,t,r){"use strict";function n(e,t,r,n){if(this.id=e,this.zr=t,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:r,zoom:n,fog:!1}),this._initEvents()}n.prototype.resize=function(){this._maptalks.checkSize()},n.prototype.getMaptalks=function(){return this._maptalks},n.prototype.clear=function(){},n.prototype.refresh=function(){this._maptalks.checkSize()};var i=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];n.prototype._initEvents=function(){var e=this.dom;this._handlers=this._handlers||{contextmenu:function(e){return e.preventDefault(),!1}},i.forEach(function(t){this._handlers[t]=function(r){var n={};for(var i in r)n[i]=r[i];n.bubbles=!1;var a=new r.constructor(r.type,n);"mousewheel"===t||"DOMMouseScroll"===t?e.dispatchEvent(a):e.firstElementChild.dispatchEvent(a)},this.zr.dom.addEventListener(t,this._handlers[t])},this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},n.prototype.dispose=function(){i.forEach(function(e){this.zr.dom.removeEventListener(e,this._handlers[e])},this),this._maptalks.remove()},t.a=n},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=(r(226),r(229),r(231),r(17));i.a.registerVisual(Object(a.a)("bar3D")),i.a.registerProcessor(function(e,t){e.eachSeriesByType("bar3d",function(e){var t=e.getData();t.filterSelf(function(e){return t.hasValue(e)})})})},function(e,t,r){"use strict";function n(e,t){var r=e.getData(),n=e.get("minHeight")||0,i=e.get("barSize"),a=["lng","lat","alt"].map(function(t){return e.coordDimToDataDim(t)[0]});if(null==i){var s=t.radius*Math.PI,h=Object(d.a)(r,a[0],a[1]);i=[s/Math.sqrt(r.count()/h),s/Math.sqrt(r.count()/h)]}else u.a.util.isArray(i)||(i=[i,i]);var c=o(r,a);r.each(a,function(e,a,o,s){var u=r.get(c.dimension,s),l=c.isStacked?u-o:t.altitudeAxis.scale.getExtent()[0],h=Math.max(t.altitudeAxis.dataToCoord(o),n),d=t.dataToPoint([e,a,l]),p=t.dataToPoint([e,a,u]),m=f.sub([],p,d);f.normalize(m,m);var g=[i[0],h,i[1]];r.setItemLayout(s,[d,m,g])}),r.setLayout("orient",l.a.UP.array)}function i(e,t){var r=e.getData(),n=e.get("barSize"),i=e.get("minHeight")||0,a=["lng","lat","alt"].map(function(t){return e.coordDimToDataDim(t)[0]});if(null==n){var s=Math.min(t.size[0],t.size[2]),l=Object(d.a)(r,a[0],a[1]);n=[s/Math.sqrt(r.count()/l),s/Math.sqrt(r.count()/l)]}else u.a.util.isArray(n)||(n=[n,n]);var h=[0,1,0],c=o(r,a);r.each(a,function(e,a,o,s){var u=r.get(c.dimension,s),l=c.isStacked?u-o:t.altitudeAxis.scale.getExtent()[0],d=Math.max(t.altitudeAxis.dataToCoord(o),i),f=t.dataToPoint([e,a,l]),p=[n[0],d,n[1]];r.setItemLayout(s,[f,h,p])}),r.setLayout("orient",[1,0,0])}function a(e,t){var r=e.getData(),n=e.coordDimToDataDim("lng")[0],i=e.coordDimToDataDim("lat")[0],a=e.coordDimToDataDim("alt")[0],s=e.get("barSize"),l=e.get("minHeight")||0;if(null==s){var h=r.getDataExtent(n),c=r.getDataExtent(i),f=t.dataToPoint([h[0],c[0]]),p=t.dataToPoint([h[1],c[1]]),m=Math.min(Math.abs(f[0]-p[0]),Math.abs(f[1]-p[1]))||1,g=Object(d.a)(r,n,i);s=[m/Math.sqrt(r.count()/g),m/Math.sqrt(r.count()/g)]}else u.a.util.isArray(s)||(s=[s,s]),s[0]/=t.getScale()/16,s[1]/=t.getScale()/16;var _=[0,0,1],v=[n,i,a],y=o(r,v);r.each(v,function(e,n,i,a){var o=r.get(y.dimension,a),u=y.isStacked?o-i:0,h=t.dataToPoint([e,n,u]),c=t.dataToPoint([e,n,o]),d=Math.max(c[2]-h[2],l),f=[s[0],d,s[1]];r.setItemLayout(a,[h,_,f])}),r.setLayout("orient",[1,0,0])}function o(e,t){var r=p(e,t[2]);return{dimension:r?e.getCalculationInfo("stackResultDimension"):t[2],isStacked:r}}var s=r(0),u=r.n(s),l=r(3),h=r(6),c=r(227),d=r(228),f=h.a.vec3,p=u.a.helper.dataStack.isDimensionStacked;u.a.registerLayout(function(e,t){e.eachSeriesByType("bar3D",function(e){var t=e.coordinateSystem,r=t&&t.type;"globe"===r?n(e,t):"cartesian3D"===r?Object(c.a)(e,t):"geo3D"===r?i(e,t):"mapbox3D"!==r&&"maptalks3D"!==r||a(e,t)})})},function(e,t,r){"use strict";function n(e){var t=e[0],r=e[1];return!(t>0&&r>0||t<0&&r<0)}function i(e,t){var r=e.getData(),i=e.get("barSize");if(null==i){var a,s,h=t.size,c=t.getAxis("x"),d=t.getAxis("y");a="category"===c.type?.7*c.getBandWidth():.6*Math.round(h[0]/Math.sqrt(r.count())),s="category"===d.type?.7*d.getBandWidth():.6*Math.round(h[1]/Math.sqrt(r.count())),i=[a,s]}else o.a.util.isArray(i)||(i=[i,i]);var f=t.getAxis("z").scale.getExtent(),p=n(f),m=["x","y","z"].map(function(t){return e.coordDimToDataDim(t)[0]}),g=l(r,m[2]),_=g?r.getCalculationInfo("stackResultDimension"):m[2];r.each(m,function(e,n,a,o){var s=r.get(_,o),l=g?s-a:p?0:f[0],h=t.dataToPoint([e,n,l]),c=t.dataToPoint([e,n,s]),d=u.dist(h,c),m=[0,c[1]0&&(p++,c[3]<.99&&(m=!0))}}),s.geometry.setBarCount(p);var g=r.getLayout("orient"),_=this._barIndexOfData=new Int32Array(r.count()),p=0;r.each(function(e){if(!r.hasValue(e))return void(_[e]=-1);var t=r.getItemLayout(e),n=t[0],i=t[1],a=t[2],s=4*e;c[0]=d[s++],c[1]=d[s++],c[2]=d[s++],c[3]=d[s++],c[3]>0&&(o._barMesh.geometry.addBar(n,i,g,a,c,e),_[e]=p++)}),s.geometry.dirty(),s.geometry.updateBoundingBox();var v=s.material;v.transparent=m,v.depthMask=!m,s.geometry.sortTriangles=m,this._initHandler(e,t)},_initHandler:function(e,t){var r=e.getData(),n=this._barMesh,i="cartesian3D"===e.coordinateSystem.type;n.seriesIndex=e.seriesIndex;var a=-1;n.off("mousemove"),n.off("mouseout"),n.on("mousemove",function(e){var o=n.geometry.getDataIndexOfVertex(e.triangle[0]);o!==a&&(this._downplay(a),this._highlight(o),this._labelsBuilder.updateLabels([o]),i&&t.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get("x",o),r.get("y",o),r.get("z",o,!0)]})),a=o,n.dataIndex=o},this),n.on("mouseout",function(e){this._downplay(a),this._labelsBuilder.updateLabels(),a=-1,n.dataIndex=-1,i&&t.dispatchAction({type:"grid3DHideAxisPointer"})},this)},_highlight:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var n=t.getItemModel(e),o=n.getModel("emphasis.itemStyle"),s=o.get("color"),u=o.get("opacity");if(null==s){var l=t.getItemVisual(e,"color");s=i.a.color.lift(l,-.4)}null==u&&(u=t.getItemVisual(e,"opacity"));var h=a.a.parseColor(s);h[3]*=u,this._barMesh.geometry.setColor(r,h),this._api.getZr().refresh()}}},_downplay:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var n=t.getItemVisual(e,"color"),i=t.getItemVisual(e,"opacity"),o=a.a.parseColor(n);o[3]*=i,this._barMesh.geometry.setColor(r,o),this._api.getZr().refresh()}}},highlight:function(e,t,r,n){this._toggleStatus("highlight",e,t,r,n)},downplay:function(e,t,r,n){this._toggleStatus("downplay",e,t,r,n)},_toggleStatus:function(e,t,r,n,a){var u=t.getData(),l=o.a.queryDataIndex(u,a),h=this;null!=l?i.a.util.each(s.a.normalizeToArray(l),function(t){"highlight"===e?this._highlight(t):this._downplay(t)},this):u.each(function(t){"highlight"===e?h._highlight(t):h._downplay(t)})},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}})},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(38),o=r(65),s=r(15),u=r(6),l=u.a.vec3,h=u.a.mat3,c=s.a.extend(function(){return{attributes:{position:new s.a.Attribute("position","float",3,"POSITION"),normal:new s.a.Attribute("normal","float",3,"NORMAL"),color:new s.a.Attribute("color","float",4,"COLOR"),prevPosition:new s.a.Attribute("prevPosition","float",3),prevNormal:new s.a.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}},{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(e){var t=this.enableNormal,r=this.getBarVertexCount()*e,n=this.getBarTriangleCount()*e;this.vertexCount!==r&&(this.attributes.position.init(r),t?this.attributes.normal.init(r):this.attributes.normal.value=null,this.attributes.color.init(r)),this.triangleCount!==n&&(this.indices=r>65535?new Uint32Array(3*n):new Uint16Array(3*n),this._dataIndices=new Uint32Array(r))},getBarVertexCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarVertexCount(e):this.enableNormal?24:8},getBarTriangleCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarTriangleCount(e):12},_getBevelBarVertexCount:function(e){return 4*(e+1)*(e+1)*2},_getBevelBarTriangleCount:function(e){return(4*e+3+1)*(2*e+1)*2+4},setColor:function(e,t){for(var r=this.getBarVertexCount(),n=r*e,i=r*(e+1),a=n;a0&&this.bevelSegments>0)this._addBevelBar(e,d,g,_,this.bevelSize,this.bevelSegments,v);else{l.copy(i,d),l.normalize(i,i),l.cross(a,g,i),l.normalize(a,a),l.cross(n,i,a),l.normalize(a,a),l.negate(o,n),l.negate(s,i),l.negate(u,a),t(h[0],e,n,_[0]/2),t(h[0],h[0],a,_[2]/2),t(h[1],e,n,_[0]/2),t(h[1],h[1],u,_[2]/2),t(h[2],e,o,_[0]/2),t(h[2],h[2],u,_[2]/2),t(h[3],e,o,_[0]/2),t(h[3],h[3],a,_[2]/2),t(r,e,i,_[1]),t(h[4],r,n,_[0]/2),t(h[4],h[4],a,_[2]/2),t(h[5],r,n,_[0]/2),t(h[5],h[5],u,_[2]/2),t(h[6],r,o,_[0]/2),t(h[6],h[6],u,_[2]/2),t(h[7],r,o,_[0]/2),t(h[7],h[7],a,_[2]/2);var T=this.attributes;if(this.enableNormal){c[0]=n,c[1]=o,c[2]=i,c[3]=s,c[4]=a,c[5]=u;for(var b=this._vertexOffset,w=0;w=0){var T=3*h,b=new l.a(this._points[T],this._points[T+1],this._points[T+2]);a.push({dataIndex:h,point:b,pointWorld:b.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(b)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}})},function(e,t){function r(e,t,r,n,i,a,o){if(0===i)return!1;var s=i,u=0,l=e;if(o>t+s&&o>n+s||oe+s&&a>r+s||ao?l.position[1]+=(h-o)/2:l.position[0]+=(h-a)/2;var c=l.getBoundingRect();return l.position[0]-=c.x,l.position[1]-=c.y,l.setStyle(r),l.update(),l.__size=h,l}function a(e,t,r){function n(e){return e<128?1:-1}for(var i=t.width,a=t.height,o=e.canvas.width,s=e.canvas.height,u=i/o,l=a/s,h=e.createImageData(o,s),c=0;c=0;c--){var d;d=this.geometry.indices?this.geometry.indices[c]:c;var f=s[2*d],p=s[2*d+1],m=this.geometry.attributes.size.get(d)/this.sizeScale,g=m/2;if(e>f-g*l&&ep-g*h&&t=2e4},doSortVertices:function(e,t){var r=this.indices,n=a.create();if(!r){r=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var i=0;i.05);else for(var i=0;i<3;i++)this._progressiveQuickSort(3*t+i);this.dirtyIndices()},_simpleSort:function(e){function t(e,t){return r[t]-r[e]}var r=this._zList,i=this.indices;e?Array.prototype.sort.call(i,t):n.a.sort(i,t,0,i.length-1)},_progressiveQuickSort:function(e){var t=this._zList,r=this.indices;this._quickSort=this._quickSort||new n.a,this._quickSort.step(r,function(e,r){return t[r]-t[e]},e)}}},function(e,t,r){"use strict";t.a="@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end"},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=(r(244),r(245),r(248),r(17));i.a.registerVisual(Object(a.a)("lines3D")),i.a.registerAction({type:"lines3DPauseEffect",event:"lines3deffectpaused",update:"series.lines3D:pauseEffect"},function(){}),i.a.registerAction({type:"lines3DResumeEffect",event:"lines3deffectresumed",update:"series.lines3D:resumeEffect"},function(){}),i.a.registerAction({type:"lines3DToggleEffect",event:"lines3deffectchanged",update:"series.lines3D:toggleEffect"},function(){})},function(e,t,r){"use strict";function n(e,t){f.copy(w,e[0]),f.copy(E,e[1]);var r=[],n=r[0]=v(),i=r[1]=v(),a=r[2]=v(),o=r[3]=v();t.dataToPoint(w,n),t.dataToPoint(E,o),p(y,n),g(x,o,n),p(x,x),m(T,x,y),p(T,T),m(x,y,T),_(i,y,x),p(i,i),p(y,o),g(x,n,o),p(x,x),m(T,x,y),p(T,T),m(x,y,T),_(a,y,x),p(a,a),_(b,n,o),p(b,b);var s=d.dot(n,b),u=d.dot(b,i),l=(Math.max(d.len(n),d.len(o))-s)/u*2;return d.scaleAndAdd(i,n,i,l),d.scaleAndAdd(a,o,a,l),r}function i(e,t,r){var n=[],i=n[0]=d.create(),a=n[1]=d.create(),o=n[2]=d.create(),s=n[3]=d.create();t.dataToPoint(e[0],i),t.dataToPoint(e[1],s);var u=d.dist(i,s);return d.lerp(a,i,s,.3),d.lerp(o,i,s,.3),d.scaleAndAdd(a,a,r,Math.min(.1*u,10)),d.scaleAndAdd(o,o,r,Math.min(.1*u,10)),n}function a(e,t){for(var r=new Float32Array(3*e.length),n=0,i=[],a=0;a0?1:-1}var i=r(0),a=(r.n(i),r(1)),o=r(6),s=r(25),u=r(247),l=o.a.vec3;a.a.Shader.import(u.a),t.a=a.a.Mesh.extend(function(){var e=new a.a.Material({shader:new a.a.Shader(a.a.Shader.source("ecgl.trail2.vertex"),a.a.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),t=new s.a({dynamic:!0});return t.createAttribute("dist","float",1),t.createAttribute("distAll","float",1),t.createAttribute("start","float",1),{geometry:t,material:e,culling:!1,$ignorePicking:!0}},{updateData:function(e,t,r){var i=e.hostModel,o=this.geometry,s=i.getModel("effect"),u=s.get("trailWidth")*t.getDevicePixelRatio(),h=s.get("trailLength"),c=i.get("effect.constantSpeed"),d=1e3*i.get("effect.period"),f=null!=c;f?this.material.set("speed",c/1e3):this.material.set("period",d),this.material[f?"define":"undefine"]("vertex","CONSTANT_SPEED");var p=i.get("polyline");o.trailLength=h,this.material.set("trailLength",h),o.resetOffset(),["position","positionPrev","positionNext"].forEach(function(e){o.attributes[e].value=r.attributes[e].value}),["dist","distAll","start","offset","color"].forEach(function(e){o.attributes[e].init(o.vertexCount)}),o.indices=r.indices;var m=[],g=s.get("trailColor"),_=s.get("trailOpacity"),v=null!=g,y=null!=_;this.updateWorldTransform();var x=this.worldTransform.x.len(),T=this.worldTransform.y.len(),b=this.worldTransform.z.len(),w=0,E=0;e.each(function(t){var i=e.getItemLayout(t),s=y?_:e.getItemVisual(t,"opacity"),h=e.getItemVisual(t,"color");null==s&&(s=1),m=a.a.parseColor(v?g:h,m),m[3]*=s;for(var c=p?r.getPolylineVertexCount(i):r.getCubicCurveVertexCount(i[0],i[1],i[2],i[3]),S=0,A=[],M=[],C=w;Cw&&(S+=l.dist(A,M)),o.attributes.dist.set(C,S),l.copy(M,A);E=Math.max(E,S);for(var L=Math.random()*(f?S:d),C=w;C0;this._updateSurfaceMesh(this._surfaceMesh,e,c,p);var m=this._surfaceMesh.material;p?(m.define("WIREFRAME_QUAD"),m.set("wireframeLineWidth",f),m.set("wireframeLineColor",o.a.parseColor(d.get("lineStyle.color")))):m.undefine("WIREFRAME_QUAD"),this._initHandler(e,r),this._updateAnimation(e)},_updateAnimation:function(e){o.a.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,e)},_createSurfaceMesh:function(){var e=new o.a.Mesh({geometry:new o.a.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new o.a.Material({shader:new o.a.Shader(o.a.Shader.source("ecgl.sm.depth.vertex"),o.a.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return e.geometry.createAttribute("barycentric","float",4),e.geometry.createAttribute("prevPosition","float",3),e.geometry.createAttribute("prevNormal","float",3),a.a.util.extend(e.geometry,u.a),e},_initHandler:function(e,t){function r(e,t){for(var r=1/0,n=-1,a=[],o=0;o=0){var u=[];i.geometry.attributes.position.get(s,u);for(var h=a.pointToData(u),c=1/0,d=-1,f=[],p=0;p65535?Uint32Array:Uint16Array)((_-1)*(v-1)*6),S=function(e,t,r){r[1]=e*v+t,r[0]=e*v+t+1,r[3]=(e+1)*v+t+1,r[2]=(e+1)*v+t},A=!1;if(c){var M=[],C=[],L=0;x?f.init(a.vertexCount):f.value=null;for(var D=[[],[],[]],N=[],R=[],P=l.create(),I=function(e,t,r){var n=3*t;return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r},O=new Float32Array(u.length),F=new Float32Array(u.length/3*4),B=0;B ")),a.value&&(h+=" : "+i.a.format.encodeHTML(a.value)),h}return s.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var e=(this.option.categories||[]).map(function(e){return null!=e.value?e:i.a.util.extend({value:0},e)}),t=new i.a.List(["value"],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray(function(e){return t.getItemModel(e,!0)})},setView:function(e){null!=e.zoom&&(this.option.zoom=e.zoom),null!=e.offset&&(this.option.offset=e.offset)},setNodePosition:function(e){for(var t=0;t "+g)),f++)}var _,v=i.a.helper.completeDimensions(["value"],e);_=new i.a.List(v,r),_.initData(e);var y=new i.a.List(["value"],r);return y.initData(d,c),a&&a(_,y),u()({mainData:_,struct:s,structAttr:"graph",datas:{node:_,edge:y},datasAttr:{node:"data",edge:"edgeData"}}),s.update(),s}},function(e,t,r){function n(e){return"_EC_"+e}function i(e,t){this.id=null==e?"":e,this.inEdges=[],this.outEdges=[],this.edges=[],this.hostGraph,this.dataIndex=null==t?-1:t}function a(e,t,r){this.node1=e,this.node2=t,this.dataIndex=null==r?-1:r}var o=r(104),s=(o.__DEV__,r(13)),u=r(266),l=u.enableClassCheck,h=function(e){this._directed=e||!1,this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this.data,this.edgeData},c=h.prototype;c.type="graph",c.isDirected=function(){return this._directed},c.addNode=function(e,t){e=e||""+t;var r=this._nodesMap;if(!r[n(e)]){var a=new i(e,t);return a.hostGraph=this,this.nodes.push(a),r[n(e)]=a,a}},c.getNodeByIndex=function(e){var t=this.data.getRawIndex(e);return this.nodes[t]},c.getNodeById=function(e){return this._nodesMap[n(e)]},c.addEdge=function(e,t,r){var o=this._nodesMap,s=this._edgesMap;if("number"==typeof e&&(e=this.nodes[e]),"number"==typeof t&&(t=this.nodes[t]),i.isInstance(e)||(e=o[n(e)]),i.isInstance(t)||(t=o[n(t)]),e&&t){var u=e.id+"-"+t.id;if(!s[u]){var l=new a(e,t,r);return l.hostGraph=this,this._directed&&(e.outEdges.push(l),t.inEdges.push(l)),e.edges.push(l),e!==t&&t.edges.push(l),this.edges.push(l),s[u]=l,l}}},c.getEdgeByIndex=function(e){var t=this.edgeData.getRawIndex(e);return this.edges[t]},c.getEdge=function(e,t){i.isInstance(e)&&(e=e.id),i.isInstance(t)&&(t=t.id);var r=this._edgesMap;return this._directed?r[e+"-"+t]:r[e+"-"+t]||r[t+"-"+e]},c.eachNode=function(e,t){for(var r=this.nodes,n=r.length,i=0;i=0&&e.call(t,r[i],i)},c.eachEdge=function(e,t){for(var r=this.edges,n=r.length,i=0;i=0&&r[i].node1.dataIndex>=0&&r[i].node2.dataIndex>=0&&e.call(t,r[i],i)},c.breadthFirstTraverse=function(e,t,r,a){if(i.isInstance(t)||(t=this._nodesMap[n(t)]),t){for(var o="out"===r?"outEdges":"in"===r?"inEdges":"edges",s=0;s=0&&r.node2.dataIndex>=0});for(var i=0,a=n.length;i=0&&this[e][t].setItemVisual(this.dataIndex,r,n)},getVisual:function(r,n){return this[e][t].getItemVisual(this.dataIndex,r,n)},setLayout:function(r,n){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,n)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}};s.mixin(i,d("hostGraph","data")),s.mixin(a,d("hostGraph","edgeData")),h.Node=i,h.Edge=a,l(i),l(a);var f=h;e.exports=f},function(e,t,r){function n(e){var t={main:"",sub:""};return e&&(e=e.split(f),t.main=e[0]||"",t.sub=e[1]||""),t}function i(e){d.assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),'componentType "'+e+'" illegal')}function a(e,t){e.$constructor=e,e.extend=function(e){var t=this,r=function(){e.$constructor?e.$constructor.apply(this,arguments):t.apply(this,arguments)};return d.extend(r.prototype,e),r.extend=this.extend,r.superCall=s,r.superApply=u,d.inherits(r,this),r.superClass=t,r}}function o(e){var t=["__\0is_clz",m++,Math.random().toFixed(3)].join("_");e.prototype[t]=!0,e.isInstance=function(e){return!(!e||!e[t])}}function s(e,t){var r=d.slice(arguments,2);return this.superClass.prototype[t].apply(e,r)}function u(e,t,r){return this.superClass.prototype[t].apply(e,r)}function l(e,t){function r(e){var t=a[e.main];return t&&t[p]||(t=a[e.main]={},t[p]=!0),t}t=t||{};var a={};if(e.registerClass=function(e,t){if(t)if(i(t),t=n(t),t.sub){if(t.sub!==p){var o=r(t);o[t.sub]=e}}else a[t.main]=e;return e},e.getClass=function(e,t,r){var n=a[e];if(n&&n[p]&&(n=t?n[t]:null),r&&!n)throw new Error(t?"Component "+e+"."+(t||"")+" not exists. Load it first.":e+".type should be specified.");return n},e.getClassesByMainType=function(e){e=n(e);var t=[],r=a[e.main];return r&&r[p]?d.each(r,function(e,r){r!==p&&t.push(e)}):t.push(r),t},e.hasClass=function(e){return e=n(e),!!a[e.main]},e.getAllClassMainTypes=function(){var e=[];return d.each(a,function(t,r){e.push(r)}),e},e.hasSubTypes=function(e){e=n(e);var t=a[e.main];return t&&t[p]},e.parseClassType=n,t.registerWhenExtend){var o=e.extend;o&&(e.extend=function(t){var r=o.call(this,t);return e.registerClass(r,t.type)})}return e}function h(e,t){}var c=r(104),d=(c.__DEV__,r(13)),f=".",p="___EC__COMPONENT__CONTAINER___",m=0;t.parseClassType=n,t.enableClassExtend=a,t.enableClassCheck=o,t.enableClassManagement=l,t.setReadOnly=h},function(e,t,r){function n(e){var t=e.mainData,r=e.datas;r||(r={main:t},e.datasAttr={main:"data"}),e.datas=e.mainData=null,l(t,r,e),d(r,function(r){d(t.TRANSFERABLE_METHODS,function(t){r.wrapMethod(t,c.curry(i,e))})}),t.wrapMethod("cloneShallow",c.curry(o,e)),d(t.CHANGABLE_METHODS,function(r){t.wrapMethod(r,c.curry(a,e))}),c.assert(r[t.dataType]===t)}function i(e,t){if(u(this)){var r=c.extend({},this[f]);r[this.dataType]=t,l(t,r,e)}else h(t,this.dataType,this[p],e);return t}function a(e,t){return e.struct&&e.struct.update(this),t}function o(e,t){return d(t[f],function(r,n){r!==t&&h(r.cloneShallow(),n,t,e)}),t}function s(e){var t=this[p];return null==e||null==t?t:t[f][e]}function u(e){return e[p]===e}function l(e,t,r){e[f]={},d(t,function(t,n){h(t,n,e,r)})}function h(e,t,r,n){r[f][t]=e,e[p]=r,e.dataType=t,n.struct&&(e[n.structAttr]=n.struct,n.struct[n.datasAttr[t]]=e),e.getLinkedData=s}var c=r(13),d=c.each,f="\0__link_datas",p="\0__link_mainData",m=n;e.exports=m},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(47),o=r.n(a),s=r(1),u=r(22),l=r(105),h=r(2),c=r(269),d=r(271),f=r(80),p=r.n(f),m=r(6),g=r(273),_=r(67),v=r(274),y=m.a.vec2;s.a.Shader.import(v.a);var x=1;i.a.extendChartView({type:"graphGL",__ecgl__:!0,init:function(e,t){this.groupGL=new s.a.Node,this.viewGL=new u.a("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new _.a(!0,t),this._forceEdgesMesh=new s.a.Mesh({material:new s.a.Material({shader:s.a.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new s.a.Geometry({attributes:{node:new s.a.Geometry.Attribute("node","float",2),color:new s.a.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:s.a.Mesh.LINES}),this._edgesMesh=new s.a.Mesh({material:new s.a.Material({shader:s.a.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new l.a({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new g.a({zr:t.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(e,t,r){this.groupGL.add(this._pointsBuilder.rootNode),this._model=e,this._api=r,this._initLayout(e,t,r),this._pointsBuilder.update(e,t,r),this._forceLayoutInstance instanceof c.a||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(e,r),this._control.off("update"),this._control.on("update",function(){r.dispatchAction({type:"graphGLRoam",seriesId:e.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)},this),this._control.setZoom(h.a.firstNotNull(e.get("zoom"),1)),this._control.setOffset(e.get("offset")||[0,0]);var n=this._pointsBuilder.getPointsMesh();if(n.off("mousemove",this._mousemoveHandler),n.off("mouseout",this._mouseOutHandler,this),r.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,e.get("focusNodeAdjacency")){var i=e.get("focusNodeAdjacencyOn");"click"===i?r.getZr().on("click",this._clickHandler):"mouseover"===i&&(n.on("mousemove",this._mousemoveHandler,this),n.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?t!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._mouseOutHandler(e),this._lastMouseOverDataIndex=t}},_mouseOutHandler:function(e){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(e,t){var r=this._forceEdgesMesh.geometry,n=t.getEdgeData(),i=0,a=this._forceLayoutInstance,o=2*n.count();r.attributes.node.init(o),r.attributes.color.init(o),n.each(function(t){var o=e[t];r.attributes.node.set(i,a.getNodeUV(o.node1)),r.attributes.node.set(i+1,a.getNodeUV(o.node2));var u=n.getItemVisual(o.dataIndex,"color"),l=s.a.parseColor(u);l[3]*=h.a.firstNotNull(n.getItemVisual(o.dataIndex,"opacity"),1),r.attributes.color.set(i,l),r.attributes.color.set(i+1,l),i+=2}),r.dirty()},_updateMeshLinesGeometry:function(){var e=this._model.getEdgeData(),t=this._edgesMesh.geometry,e=this._model.getEdgeData(),r=this._model.getData().getLayout("points");t.resetOffset(),t.setVertexCount(e.count()*t.getLineVertexCount()),t.setTriangleCount(e.count()*t.getLineTriangleCount());var n=[],i=[],a=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*e.count()),this._edgeIndicesMap=new Float32Array(e.count()),e.each(function(o){var u=e.graph.getEdgeByIndex(o),l=2*u.node1.dataIndex,c=2*u.node2.dataIndex;n[0]=r[l],n[1]=r[l+1],i[0]=r[c],i[1]=r[c+1];var d=e.getItemVisual(u.dataIndex,"color"),f=s.a.parseColor(d);f[3]*=h.a.firstNotNull(e.getItemVisual(u.dataIndex,"opacity"),1);var p=e.getItemModel(u.dataIndex),m=h.a.firstNotNull(p.get(a),1)*this._api.getDevicePixelRatio();t.addLine(n,i,f,m);for(var g=0;g<4;g++)this._originalEdgeColors[4*u.dataIndex+g]=f[g];this._edgeIndicesMap[u.dataIndex]=o},this),t.dirty()},_updateForceNodesGeometry:function(e){for(var t=this._pointsBuilder.getPointsMesh(),r=[],n=0;n=f&&(u._syncNodePosition(e),d=0),r.getZr().refresh(),p()(function(){m(t)})})};p()(function(){u._forceLayoutInstanceToDispose&&(u._forceLayoutInstanceToDispose.dispose(i.layer.renderer),u._forceLayoutInstanceToDispose=null),m(l)}),this._layouting=!0}}},stopLayout:function(e,t,r,n){n&&null!=n.from&&n.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(n&&n.beforeLayout||(this._syncNodePosition(e),this._updateAfterLayout(e,t,r)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(e){var t=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);e.getData().setLayout("points",t),e.setNodePosition(t)},_updateAfterLayout:function(e,t,r){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(e,t,r),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(e,t,r,n){var i=this._model.getData();this._downplayAll();var a=n.dataIndex,o=i.graph,s=[],u=o.getNodeByIndex(a);s.push(u),u.edges.forEach(function(e){e.dataIndex<0||(e.node1!==u&&s.push(e.node1),e.node2!==u&&s.push(e.node2))},this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach(function(e){this._pointsBuilder.highlight(i,e.dataIndex)},this),this._pointsBuilder.updateLabels(s.map(function(e){return e.dataIndex}));var l=[];u.edges.forEach(function(e){e.dataIndex>=0&&(this._highlightEdge(e.dataIndex),l.push(e))},this),this._focusNodes=s,this._focusEdges=l},unfocusNodeAdjacency:function(e,t,r,n){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(e){var t=this._model.getEdgeData().getItemModel(e),r=s.a.parseColor(t.get("emphasis.lineStyle.color")||t.get("lineStyle.color")),n=h.a.firstNotNull(t.get("emphasis.lineStyle.opacity"),t.get("lineStyle.opacity"),1);r[3]*=n,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],r)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach(function(e){this._pointsBuilder.downplay(this._model.getData(),e.dataIndex)},this),this._focusEdges&&this._focusEdges.forEach(function(e){this._downplayEdge(e.dataIndex)},this)},_downplayEdge:function(e){var t=this._getColor(e,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)},_setEdgeFade:function(){var e=[];return function(t,r){this._getColor(t,e),e[3]*=r,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],e)}}(),_getColor:function(e,t){for(var r=0;r<4;r++)t[r]=this._originalEdgeColors[4*e+r];return t},_fadeOutEdgesAll:function(e){this._model.getData().graph.eachEdge(function(t){this._setEdgeFade(t.dataIndex,e)},this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(e,t){this.viewGL.setViewport(0,0,t.getWidth(),t.getHeight(),t.getDevicePixelRatio());for(var r=this.viewGL.camera,n=e.getData(),i=n.getLayout("points"),a=y.create(1/0,1/0),o=y.create(-1/0,-1/0),s=[],u=0;ur.left&&hr.top)){var c=Math.max(o[0]-a[0],10),d=c/t.getWidth()*t.getHeight();c*=1.4,d*=1.4,a[0]-=.2*c,r.left=a[0],r.top=l-d/2,r.bottom=l+d/2,r.right=c+a[0],r.near=0,r.far=100}},dispose:function(){var e=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(e),this.groupGL.removeAll(),this._layoutId=-1},remove:function(){this.groupGL.removeAll(),this._control.dispose()}})},function(e,t,r){"use strict";function n(e){var t={type:o.a.Texture.FLOAT,minFilter:o.a.Texture.NEAREST,magFilter:o.a.Texture.NEAREST};this._positionSourceTex=new o.a.Texture2D(t),this._positionSourceTex.flipY=!1,this._positionTex=new o.a.Texture2D(t),this._positionPrevTex=new o.a.Texture2D(t),this._forceTex=new o.a.Texture2D(t),this._forcePrevTex=new o.a.Texture2D(t),this._weightedSumTex=new o.a.Texture2D(t),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new o.a.Texture2D(t),this._globalSpeedPrevTex=new o.a.Texture2D(t),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new s.a({fragment:o.a.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new s.a({fragment:o.a.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new s.a({fragment:o.a.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new s.a({fragment:o.a.Shader.source("clay.compositor.output")});var r=function(e){e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE)};this._edgeForceMesh=new o.a.Mesh({geometry:new o.a.Geometry({attributes:{node1:new o.a.Geometry.Attribute("node1","float",2),node2:new o.a.Geometry.Attribute("node2","float",2),weight:new o.a.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new o.a.Material({transparent:!0,shader:o.a.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:r,depthMask:!1,depthText:!1}),mode:o.a.Mesh.POINTS}),this._weightedSumMesh=new o.a.Mesh({geometry:new o.a.Geometry({attributes:{node:new o.a.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new o.a.Material({transparent:!0,shader:o.a.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:r,depthMask:!1,depthText:!1}),mode:o.a.Mesh.POINTS}),this._framebuffer=new u.a({depthBuffer:!1}),this._dummyCamera=new o.a.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}var i=r(0),a=r.n(i),o=r(1),s=r(16),u=r(10),l=r(270);o.a.Shader.import(l.a);var h={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};n.prototype.updateOption=function(e){for(var t in h)this[t]=h[t];var r=this._nodes.length;if(this.jitterTolerence=r>5e4?10:r>5e3?1:.1,this.scaling=r>100?2:10,e)for(var t in h)null!=e[t]&&(this[t]=e[t]);if(this.repulsionByDegree)for(var n=this._positionSourceTex.pixels,i=0;ie},n.prototype._swapTexture=function(){var e=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=e;var e=this._forcePrevTex;this._forcePrevTex=this._forceTex,this._forceTex=e;var e=this._globalSpeedPrevTex;this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=e},n.prototype._initFromSource=function(e){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(e),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(e),e.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(e)},n.prototype._resize=function(e,t){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach(function(r){this[r].width=e,this[r].height=t,this[r].dirty()},this)},n.prototype.dispose=function(e){this._framebuffer.dispose(e),this._copyPass.dispose(e),this._nodeRepulsionPass.dispose(e),this._positionPass.dispose(e),this._globalSpeedPass.dispose(e),this._edgeForceMesh.geometry.dispose(e),this._weightedSumMesh.geometry.dispose(e),this._positionSourceTex.dispose(e),this._positionTex.dispose(e),this._positionPrevTex.dispose(e),this._forceTex.dispose(e),this._forcePrevTex.dispose(e),this._weightedSumTex.dispose(e),this._globalSpeedTex.dispose(e),this._globalSpeedPrevTex.dispose(e)},a.a.ForceAtlas2GPU=n,t.a=n},function(e,t,r){"use strict";t.a="@export ecgl.forceAtlas2.updateNodeRepulsion\n\n#define NODE_COUNT 0\n\nuniform sampler2D positionTex;\n\nuniform vec2 textureSize;\nuniform float gravity;\nuniform float scaling;\nuniform vec2 gravityCenter;\n\nuniform bool strongGravityMode;\nuniform bool preventOverlap;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, v_Texcoord);\n\n vec2 force = vec2(0.0);\n for (int i = 0; i < NODE_COUNT; i++) {\n vec2 uv = vec2(\n mod(float(i), textureSize.x) / (textureSize.x - 1.0),\n floor(float(i) / textureSize.x) / (textureSize.y - 1.0)\n );\n vec4 n1 = texture2D(positionTex, uv);\n\n vec2 dir = n0.xy - n1.xy;\n float d2 = dot(dir, dir);\n\n if (d2 > 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end"},function(e,t,r){"use strict";var n=r(5),i=r(4),a=r(272),o=a.a.toString();o=o.slice(o.indexOf("{")+1,o.lastIndexOf("}"));var s={barnesHutOptimize:!0,barnesHutTheta:1.5,repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null},u=function(e){for(var t in s)this[t]=s[t];if(e)for(var t in e)this[t]=e[t];this._nodes=[],this._edges=[],this._disposed=!1,this._positionTex=new n.a({type:i.a.FLOAT,flipY:!1,minFilter:i.a.NEAREST,magFilter:i.a.NEAREST})};u.prototype.initData=function(e,t){var r=new Blob([o]),n=window.URL.createObjectURL(r);this._worker=new Worker(n),this._worker.onmessage=this._$onupdate.bind(this),this._nodes=e,this._edges=t,this._frame=0;for(var i=e.length,a=t.length,s=new Float32Array(2*i),u=new Float32Array(i),l=new Float32Array(i),h=new Float32Array(2*a),c=new Float32Array(a),d=0;d5e4?10:a>5e3?1:.1,t.scaling=a>100?2:10,t.barnesHutOptimize=a>1e3,e)for(var r in s)null!=e[r]&&(t[r]=e[r]);if(!t.gravityCenter){for(var o=[1/0,1/0],u=[-1/0,-1/0],l=0;le},u.prototype.getNodePosition=function(e,t){if(t||(t=new Float32Array(2*this._nodes.length)),this._positionArr)for(var r=0;r0&&(i=1/Math.sqrt(i),e[0]=t[0]*i,e[1]=t[1]*i),e},negate:function(e,t){return e[0]=-t[0],e[1]=-t[1],e},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e},set:function(e,t,r){return e[0]=t,e[1]=r,e}},a=e.prototype;a.beforeUpdate=function(){for(var e=0;e=e&&this.bbox[1]<=t&&this.bbox[3]>=t},a.setBBox=function(e,t,r,n){this.bbox[0]=e,this.bbox[1]=t,this.bbox[2]=r,this.bbox[3]=n,this.size=(r-e+n-t)/2},a._newSubRegion=function(){var t=this.subRegions[this.nSubRegions];return t||(t=new e,this.subRegions[this.nSubRegions]=t),this.nSubRegions++,t},a._addNodeToSubRegion=function(e){var t=this.findSubRegion(e.position[0],e.position[1]),r=this.bbox;if(!t){var n=(r[0]+r[2])/2,i=(r[1]+r[3])/2,a=(r[2]-r[0])/2,o=(r[3]-r[1])/2,s=e.position[0]>=n?1:0,u=e.position[1]>=i?1:0,t=this._newSubRegion();t.setBBox(s*a+r[0],u*o+r[1],(s+1)*a+r[0],(u+1)*o+r[1])}t.addNode(e)},a._updateCenterOfMass=function(e){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var t=this.centerOfMass[0]*this.mass,r=this.centerOfMass[1]*this.mass;t+=e.position[0]*e.mass,r+=e.position[1]*e.mass,this.mass+=e.mass,this.centerOfMass[0]=t/this.mass,this.centerOfMass[1]=r/this.mass};var o=n.prototype;o.initNodes=function(e,r,n){var i=r.length;this.nodes.length=0;for(var a=void 0!==n,o=0;o0&&(this.strongGravityMode?this.applyNodeStrongGravity(n):this.applyNodeGravity(n))}for(var t=0;t0&&(c=Math.min(c/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=c;for(var t=0;t0&&(d=Math.min(f*d,10)/f,i.scaleAndAdd(r.position,r.position,r.force,d))}},o.applyRegionToNodeRepulsion=function(){var e=i.create();return function(t,r){if(t.node)this.applyNodeToNodeRepulsion(t.node,r,!0);else{i.sub(e,r.position,t.centerOfMass);var n=e[0]*e[0]+e[1]*e[1];if(n>this.barnesHutTheta*t.size*t.size){var a=this.scaling*r.mass*t.mass/n;i.scaleAndAdd(r.force,r.force,e,a)}else for(var o=0;o0)o=this.scaling*t.mass*r.mass/(s*s);else{if(!(s<0))return;o=100*this.scaling*t.mass*r.mass}}else o=this.scaling*t.mass*r.mass/a;i.scaleAndAdd(t.force,t.force,e,o),i.scaleAndAdd(r.force,r.force,e,-o)}}}}(),o.applyEdgeAttraction=function(){var e=i.create();return function(t){var r=t.source,n=t.target;i.sub(e,r.position,n.position);var a,o=i.len(e);a=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?t.weight:Math.pow(t.weight,this.edgeWeightInfluence);var s;this.preventOverlap&&(o=o-r.size-n.size)<=0||(s=this.linLogMode?-a*Math.log(o+1)/(o+1):-a,i.scaleAndAdd(r.force,r.force,e,s),i.scaleAndAdd(n.force,n.force,e,-s))}}(),o.applyNodeGravity=function(){var e=i.create();return function(t){i.sub(e,this.gravityCenter,t.position);var r=i.len(e);i.scaleAndAdd(t.force,t.force,e,this.gravity*t.mass/(r+1))}}(),o.applyNodeStrongGravity=function(){var e=i.create();return function(t){i.sub(e,this.gravityCenter,t.position),i.scaleAndAdd(t.force,t.force,e,this.gravity*t.mass)}}(),o.updateBBox=function(){for(var e=1/0,t=1/0,r=-1/0,n=-1/0,i=0;i0?1.1:.9,a=Math.max(Math.min(this._zoom*i,this.maxZoom),this.minZoom);i=a/this._zoom;var o=this._convertPos(r,n),s=(o.x-this._dx)*(i-1),u=(o.y-this._dy)*(i-1);this._dx-=s,this._dy-=u,this._zoom=a,this._needsUpdate=!0}}},dispose:function(){var e=this.zr;e.off("mousedown",this._mouseDownHandler),e.off("mousemove",this._mouseMoveHandler),e.off("mouseup",this._mouseUpHandler),e.off("mousewheel",this._mouseWheelHandler),e.off("globalout",this._mouseUpHandler),e.animation.off("frame",this._update)}}));t.a=i},function(e,t,r){"use strict";t.a="@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end"},function(e,t,r){"use strict";var n=r(0);r.n(n),r(276),r(280)},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(1),o=r(2),s=r(22),u=r(277);i.a.extendChartView({type:"flowGL",__ecgl__:!0,init:function(e,t){this.viewGL=new s.a("orthographic"),this.groupGL=new a.a.Node,this.viewGL.add(this.groupGL),this._particleSurface=new u.a;var r=new a.a.Mesh({geometry:new a.a.PlaneGeometry,material:new a.a.Material({shader:new a.a.Shader({vertex:a.a.Shader.source("ecgl.color.vertex"),fragment:a.a.Shader.source("ecgl.color.fragment")}),transparent:!0})});r.material.enableTexture("diffuseMap"),this.groupGL.add(r),this._planeMesh=r},render:function(e,t,r){var n=this._particleSurface;n.setParticleType(e.get("particleType")),n.setSupersampling(e.get("supersampling")),this._updateData(e,r),this._updateCamera(r.getWidth(),r.getHeight(),r.getDevicePixelRatio());var i=o.a.firstNotNull(e.get("particleDensity"),128);n.setParticleDensity(i,i);var s=this._planeMesh,u=+new Date,l=this,h=!0;s.__percent=0,s.stopAnimation(),s.animate("",{loop:!0}).when(1e5,{__percent:1}).during(function(){var e=+new Date,t=Math.min(e-u,20);u+=t,l._renderer&&(n.update(l._renderer,r,t/1e3,h),s.material.set("diffuseMap",n.getSurfaceTexture())),h=!1}).start();var c=e.getModel("itemStyle"),d=a.a.parseColor(c.get("color"));d[3]*=o.a.firstNotNull(c.get("opacity"),1),s.material.set("color",d),n.setColorTextureImage(e.get("colorTexture"),r),n.setParticleSize(e.get("particleSize")),n.particleSpeedScaling=e.get("particleSpeed"),n.motionBlurFactor=1-Math.pow(.1,e.get("particleTrail"))},updateTransform:function(e,t,r){this._updateData(e,r)},afterRender:function(e,t,r,n){var i=n.renderer;this._renderer=i},_updateData:function(e,t){var r=e.coordinateSystem,n=r.dimensions.map(function(t){return e.coordDimToDataDim(t)[0]}),i=e.getData(),a=i.getDataExtent(n[0]),o=i.getDataExtent(n[1]),s=e.get("gridWidth"),u=e.get("gridHeight");if(null==s||"auto"===s){var l=(a[1]-a[0])/(o[1]-o[0]);s=Math.round(Math.sqrt(l*i.count()))}null!=u&&"auto"!==u||(u=Math.ceil(i.count()/s));var h=this._particleSurface.vectorFieldTexture,c=h.pixels;if(c&&c.length===u*s*4)for(var d=0;d=359&&(i[0]>0&&(i[0]=0),a[0]0?e[e.length-1]:this._lastFrameTexture},setRegion:function(e){this._particlePass.setUniform("region",e)},resize:function(e,t){this._lastFrameTexture.width=e*this._supersampling,this._lastFrameTexture.height=t*this._supersampling,this._thisFrameTexture.width=e*this._supersampling,this._thisFrameTexture.height=t*this._supersampling,this._width=e,this._height=t},setParticleSize:function(e){var t=this._getParticleMesh();if(e<=2)return t.material.disableTexture("spriteTexture"),void(t.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new l.a),this._spriteTexture.image&&this._spriteTexture.image.width===e||(this._spriteTexture.image=n(e),this._spriteTexture.dirty()),t.material.transparent=!0,t.material.enableTexture("spriteTexture"),t.material.set("spriteTexture",this._spriteTexture),this._particleSize=e},setGradientTexture:function(e){var t=this._getParticleMesh().material;t[e?"enableTexture":"disableTexture"]("gradientTexture"),t.setUniform("gradientTexture",e)},setColorTextureImage:function(e,t){this._getParticleMesh().material.setTextureImage("colorTexture",e,t,{flipY:!0})},setParticleType:function(e){this._particleType=e},clearFrame:function(e){var t=this._frameBuffer;t.attach(this._lastFrameTexture),t.bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),t.unbind(e)},setSupersampling:function(e){this._supersampling=e,this.resize(this._width,this._height)},_updateDownsampleTextures:function(e,t){for(var r=this._downsampleTextures,n=Math.max(Math.floor(Math.log(this._supersampling/t.getDevicePixelRatio())/Math.log(2)),0),i=2,a=this._width*this._supersampling,o=this._height*this._supersampling,s=0;s65535?new Uint32Array(3*n):new Uint16Array(3*n))},addLine:function(e){var t=this._vertexOffset;this.attributes.position.set(t,[e[0],e[1],1]),this.attributes.position.set(t+1,[e[0],e[1],-1]),this.attributes.position.set(t+2,[e[0],e[1],2]),this.attributes.position.set(t+3,[e[0],e[1],-2]),this.setTriangleIndices(this._faceOffset++,[t,t+1,t+2]),this.setTriangleIndices(this._faceOffset++,[t+1,t+2,t+3]),this._vertexOffset+=4}}));t.a=a},function(e,t,r){"use strict";t.a="@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n"},function(e,t,r){"use strict";var n=r(0),i=r.n(n);i.a.extendSeriesModel({type:"series.flowGL",dependencies:["geo","grid","bmap"],visualColorAccessPath:"itemStyle.color",getInitialData:function(e,t){var r=i.a.getCoordinateSystemDimensions(this.get("coordinateSystem"))||["x","y"];r.push("vx","vy");var n=i.a.helper.completeDimensions(r,this.getSource(),{encodeDef:this.get("encode"),dimsDef:this.get("dimensions")}),a=new i.a.List(n,this);return a.initData(this.getSource()),a},defaultOption:{coordinateSystem:"cartesian2d",zlevel:10,supersampling:1,particleType:"point",particleDensity:128,particleSize:1,particleSpeed:1,particleTrail:2,colorTexture:null,gridWidth:"auto",gridHeight:"auto",itemStyle:{color:"#fff",opacity:.8}}})},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=(r(282),r(283),r(17));i.a.registerVisual(Object(a.a)("linesGL"))},function(e,t,r){"use strict";var n=r(0),i=r.n(n),a=r(13),o=(r.n(a),i.a.extendSeriesModel({type:"series.linesGL",dependencies:["grid","geo"],visualColorAccessPath:"lineStyle.color",streamEnabled:!0,init:function(e){var t=this._processFlatCoordsArray(e.data);this._flatCoords=t.flatCoords,this._flatCoordsOffset=t.flatCoordsOffset,t.flatCoords&&(e.data=new Float32Array(t.count)),o.superApply(this,"init",arguments)},mergeOption:function(e){var t=this._processFlatCoordsArray(e.data);this._flatCoords=t.flatCoords,this._flatCoordsOffset=t.flatCoordsOffset,t.flatCoords&&(e.data=new Float32Array(t.count)),o.superApply(this,"mergeOption",arguments)},appendData:function(e){var t=this._processFlatCoordsArray(e.data);t.flatCoords&&(this._flatCoords?(this._flatCoords=Object(a.concatArray)(this._flatCoords,t.flatCoords),this._flatCoordsOffset=Object(a.concatArray)(this._flatCoordsOffset,t.flatCoordsOffset)):(this._flatCoords=t.flatCoords,this._flatCoordsOffset=t.flatCoordsOffset),e.data=new Float32Array(t.count)),this.getRawData().appendData(e.data)},_getCoordsFromItemModel:function(e){var t=this.getData().getItemModel(e),r=t.option instanceof Array?t.option:t.getShallow("coords");return r},getLineCoordsCount:function(e){return this._flatCoordsOffset?this._flatCoordsOffset[2*e+1]:this._getCoordsFromItemModel(e).length},getLineCoords:function(e,t){if(this._flatCoordsOffset){for(var r=this._flatCoordsOffset[2*e],n=this._flatCoordsOffset[2*e+1],i=0;i1?(t.material.shader!==this._meshLinesShader&&t.material.attachShader(this._meshLinesShader),t.mode=a.a.Mesh.TRIANGLES):(t.material.shader!==this._nativeLinesShader&&t.material.attachShader(this._nativeLinesShader),t.mode=a.a.Mesh.LINES),r=r||0,n=n||o.count(),h.resetOffset();var f=0,p=0,m=[],g=[],_=[],v=[],y=[],x=.3,T=.7;if(u||0!==s)for(var b=r;b