Files
lifeRestart/public/libs/laya/min/laya.webgl.min.js
Vick Scarlet f40698d63e add laya
2021-10-31 00:13:22 +08:00

1 line
171 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(x){x.un,x.uns;var e=x.static,l=x.class,a=x.getset,n=x.__newvec,u=laya.maths.Arith,_=laya.maths.Bezier,i=laya.resource.Bitmap,o=laya.utils.Browser,h=laya.utils.Byte,d=laya.utils.Color,v=(laya.filters.ColorFilter,x.Config),r=laya.resource.Context,b=(laya.events.Event,laya.filters.Filter),s=laya.display.Graphics,c=laya.resource.HTMLCanvas,f=(laya.utils.HTMLChar,laya.resource.HTMLImage),m=laya.resource.HTMLSubImage,y=(laya.utils.Handler,laya.net.Loader,laya.maths.Matrix),T=laya.maths.Point,A=laya.maths.Rectangle,p=laya.renders.Render,g=(laya.renders.RenderContext,laya.renders.RenderSprite),E=laya.resource.Resource,t=laya.resource.ResourceManager,S=laya.utils.RunDriver,w=laya.display.Sprite,R=laya.display.Stage,I=laya.utils.Stat,M=laya.utils.StringKey,C=(laya.display.css.Style,laya.system.System),L=laya.display.Text,P=laya.resource.Texture,D=(laya.display.css.TransformInfo,laya.net.URL,laya.utils.Utils),F=laya.utils.VectorGraphManager;laya.utils.WordText;x.interface("laya.webgl.shapes.IShape"),x.interface("laya.webgl.submit.ISubmit"),x.interface("laya.webgl.text.ICharSegment"),x.interface("laya.webgl.canvas.save.ISaveData"),x.interface("laya.webgl.resource.IMergeAtlasBitmap"),x.interface("laya.filters.IFilterActionGL","laya.filters.IFilterAction");var B=function(){function t(){}l(t,"laya.filters.webgl.FilterActionGL");var e=t.prototype;return x.imps(e,{"laya.filters.IFilterActionGL":!0}),e.setValue=function(t){},e.setValueMix=function(t){},e.apply3d=function(t,e,i,r,s){return null},e.apply=function(t){return null},a(0,e,"typeMix",function(){return 0}),t}(),N=(l(O,"laya.webgl.shader.ShaderValue"),O);function O(){}var V=function(){var r,s;function t(t,e,i){this._atlasID=0,this._width=0,this._height=0,this._texCount=0,this._rowInfo=null,this._cells=null,this._failSize=new s,void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this._cells=null,this._rowInfo=null,this._init(t,e),this._atlasID=i}l(t,"laya.webgl.atlas.AtlasGrid");var e=t.prototype;return e.getAltasID=function(){return this._atlasID},e.setAltasID=function(t){0<=t&&(this._atlasID=t)},e.addTex=function(t,e,i){var r=this._get(e,i);return 0==r.ret||(this._fill(r.x,r.y,e,i,t),this._texCount++),r},e._release=function(){null!=this._cells&&(this._cells.length=0,this._cells=null),this._rowInfo&&(this._rowInfo.length=0,this._rowInfo=null)},e._init=function(t,e){if(this._width=t,this._height=e,this._release(),0==this._width)return!1;this._cells=new Uint8Array(this._width*this._height*3),this._rowInfo=n(this._height);for(var i=0;i<this._height;i++)this._rowInfo[i]=new r;return this._clear(),!0},e._get=function(t,e){var i=new k;if(t>=this._failSize.width&&e>=this._failSize.height)return i;for(var r=-1,s=this._width,n=this._height,a=this._cells,h=0;h<n;h++)if(!(this._rowInfo[h].spaceCount<t))for(var l=0;l<s;){var o=3*(h*s+l);if(0!=a[o]||a[1+o]<t||a[2+o]<e)l+=a[1+o];else{for(var r=l,u=h,_=0;_<t;_++)if(a[3*_+o+2]<e){r=-1;break}if(!(r<0))return i.ret=!0,i.x=r,i.y=u,i;l+=a[1+o]}}return i},e._fill=function(t,e,i,r,s){var n=this._width,a=this._height;this._check(t+i<=n&&e+r<=a);for(var h=e;h<r+e;++h){this._check(this._rowInfo[h].spaceCount>=i),this._rowInfo[h].spaceCount-=i;for(var l=0;l<i;l++){var o=3*(t+h*n+l);this._check(0==this._cells[o]),this._cells[o]=s,this._cells[1+o]=i,this._cells[2+o]=r}}if(0<t)for(h=0;h<r;++h){for(var u=0,l=t-1;0<=l&&0==this._cells[3*((e+h)*n+l)];--l,++u);for(l=u;0<l;--l)this._cells[3*((e+h)*n+t-l)+1]=l,this._check(0<l)}if(0<e)for(l=t;l<t+i;++l){for(u=0,h=e-1;0<=h&&0==this._cells[3*(l+h*n)];--h,u++);for(h=u;0<h;--h)this._cells[3*(l+(e-h)*n)+2]=h,this._check(0<h)}},e._check=function(t){0==t&&console.log("xtexMerger 错误啦")},e._clear=function(){for(var t=this._texCount=0;t<this._height;t++)this._rowInfo[t].spaceCount=this._width;for(var e=0;e<this._height;e++)for(var i=0;i<this._width;i++){var r=3*(e*this._width+i);this._cells[r]=0,this._cells[1+r]=this._width-i,this._cells[2+r]=this._width-e}this._failSize.width=this._width+1,this._failSize.height=this._height+1},t.__init$=function(){function t(){this.spaceCount=0}function e(){this.width=0,this.height=0}l(t,""),r=t,l(e,""),s=e},t}(),U=function(){function g(t,e,i,r){this._currentAtlasCount=0,this._maxAtlaserCount=0,this._width=0,this._height=0,this._gridSize=0,this._gridNumX=0,this._gridNumY=0,this._init=!1,this._curAtlasIndex=0,this._setAtlasParam=!1,this._atlaserArray=null,this._needGC=!1,this._setAtlasParam=!0,this._width=t,this._height=e,this._gridSize=i,this._maxAtlaserCount=r,this._gridNumX=t/i,this._gridNumY=e/i,this._curAtlasIndex=0,this._atlaserArray=[]}l(g,"laya.webgl.atlas.AtlasResourceManager");var t=g.prototype;return t.setAtlasParam=function(t,e,i,r){if(1==this._setAtlasParam)return g._sid_=0,this._width=t,this._height=e,this._gridSize=i,this._maxAtlaserCount=r,this._gridNumX=t/i,this._gridNumY=e/i,this._curAtlasIndex=0,this.freeAll(),!0;throw console.log("设置大图合集参数错误,只能在开始页面设置各种参数"),-1},t.pushData=function(t){var e,i=t.bitmap,r=-1,s=null,n=0,a=0;for(n=0,e=this._atlaserArray.length;n<e&&(a=(this._curAtlasIndex+n)%e,-1==(r=(s=this._atlaserArray[a]).findBitmapIsExist(i)));n++);if(-1!=r){var h=s.InAtlasWebGLImagesOffsetValue[r],l=h[0],o=h[1];return s.addToAtlas(t,l,o),!0}this._setAtlasParam=!1;for(var u=Math.ceil((t.bitmap.width+2)/this._gridSize),_=Math.ceil((t.bitmap.height+2)/this._gridSize),c=!1,d=0;d<2;d++){for(var f=this._maxAtlaserCount,n=0;n<f;n++){a=(this._curAtlasIndex+n)%f,this._atlaserArray.length-1>=a||this._atlaserArray.push(new Ut(this._gridNumX,this._gridNumY,this._width,this._height,g._sid_++));var m=this._atlaserArray[a],l=0,o=0,p=m.addTex(1,u,_);if(p.ret){l=p.x*this._gridSize+1,o=p.y*this._gridSize+1,i.lock=!0,m.addToAtlasTexture(i,l,o),m.addToAtlas(t,l,o),c=!0,this._curAtlasIndex=a;break}}if(c)break;this._atlaserArray.push(new Ut(this._gridNumX,this._gridNumY,this._width,this._height,g._sid_++)),this._needGC=!0,this.garbageCollection(),this._curAtlasIndex=this._atlaserArray.length-1}return c||console.log(">>>AtlasManager pushData error"),c},t.addToAtlas=function(t){laya.webgl.atlas.AtlasResourceManager.instance.pushData(t)},t.garbageCollection=function(){if(!0===this._needGC){for(var t=this._atlaserArray.length-this._maxAtlaserCount,e=0;e<t;e++)this._atlaserArray[e].dispose(),console.log("AtlasResourceManager:Dispose the inner Atlas。");console.log(">>>>altas garbageCollection ="+t),this._atlaserArray.splice(0,t),this._needGC=!1}return!0},t.freeAll=function(){for(var t=0,e=this._atlaserArray.length;t<e;t++)this._atlaserArray[t].dispose();this._atlaserArray.length=0,this._curAtlasIndex=0},t.getAtlaserCount=function(){return this._atlaserArray.length},t.getAtlaserByIndex=function(t){return this._atlaserArray[t]},a(1,g,"instance",function(){return g._Instance=!g._Instance?new g(laya.webgl.atlas.AtlasResourceManager.atlasTextureWidth,laya.webgl.atlas.AtlasResourceManager.atlasTextureHeight,16,laya.webgl.atlas.AtlasResourceManager.maxTextureCount):g._Instance}),a(1,g,"enabled",function(){return v.atlasEnable}),a(1,g,"atlasLimitWidth",function(){return g._atlasLimitWidth},function(t){g._atlasLimitWidth=t}),a(1,g,"atlasLimitHeight",function(){return g._atlasLimitHeight},function(t){g._atlasLimitHeight=t}),g._enable=function(){v.atlasEnable=!0},g._disable=function(){v.atlasEnable=!1},g.__init__=function(){g.atlasTextureWidth=2048,g.atlasTextureHeight=2048,g.maxTextureCount=6,g.atlasLimitWidth=512,g.atlasLimitHeight=512},g._atlasLimitWidth=0,g._atlasLimitHeight=0,g.gridSize=16,g.atlasTextureWidth=0,g.atlasTextureHeight=0,g.maxTextureCount=0,g._atlasRestore=0,g.BOARDER_TYPE_NO=0,g.BOARDER_TYPE_RIGHT=1,g.BOARDER_TYPE_LEFT=2,g.BOARDER_TYPE_BOTTOM=4,g.BOARDER_TYPE_TOP=8,g.BOARDER_TYPE_ALL=15,g._sid_=0,g._Instance=null,g}(),k=(l(H,"laya.webgl.atlas.MergeFillInfo"),H);function H(){this.x=0,this.y=0,this.ret=!1,this.ret=!1,this.x=0,this.y=0}var G=(l(z,"laya.webgl.canvas.BlendMode"),z._init_=function(t){z.fns=[z.BlendNormal,z.BlendAdd,z.BlendMultiply,z.BlendScreen,z.BlendOverlay,z.BlendLight,z.BlendMask,z.BlendDestinationOut],z.targetFns=[z.BlendNormalTarget,z.BlendAddTarget,z.BlendMultiplyTarget,z.BlendScreenTarget,z.BlendOverlayTarget,z.BlendLightTarget,z.BlendMask,z.BlendDestinationOut]},z.BlendNormal=function(t){t.blendFunc(1,771)},z.BlendAdd=function(t){t.blendFunc(1,772)},z.BlendMultiply=function(t){t.blendFunc(774,771)},z.BlendScreen=function(t){t.blendFunc(1,1)},z.BlendOverlay=function(t){t.blendFunc(1,769)},z.BlendLight=function(t){t.blendFunc(1,1)},z.BlendNormalTarget=function(t){t.blendFunc(1,771)},z.BlendAddTarget=function(t){t.blendFunc(1,772)},z.BlendMultiplyTarget=function(t){t.blendFunc(774,771)},z.BlendScreenTarget=function(t){t.blendFunc(1,1)},z.BlendOverlayTarget=function(t){t.blendFunc(1,769)},z.BlendLightTarget=function(t){t.blendFunc(1,1)},z.BlendMask=function(t){t.blendFunc(0,770)},z.BlendDestinationOut=function(t){t.blendFunc(0,0)},z.activeBlendFunction=null,z.NAMES=["normal","add","multiply","screen","overlay","light","mask","destination-out"],z.TOINT={normal:0,add:1,multiply:2,screen:3,lighter:1,overlay:4,light:5,mask:6,"destination-out":7},z.NORMAL="normal",z.ADD="add",z.MULTIPLY="multiply",z.SCREEN="screen",z.LIGHT="light",z.OVERLAY="overlay",z.DESTINATIONOUT="destination-out",z.fns=[],z.targetFns=[],z);function z(){}var W=function(){function i(t){this._color=d.create("black"),this.setValue(t)}l(i,"laya.webgl.canvas.DrawStyle");var t=i.prototype;return t.setValue=function(t){t&&("string"!=typeof t?t instanceof laya.utils.Color&&(this._color=t):this._color=d.create(t))},t.reset=function(){this._color=d.create("black")},t.equal=function(t){return"string"==typeof t?this._color.strColor===t:t instanceof laya.utils.Color&&this._color.numColor===t.numColor},t.toColorStr=function(){return this._color.strColor},i.create=function(t){var e;if(t&&("string"==typeof t?e=d.create(t):t instanceof laya.utils.Color&&(e=t),e))return e._drawStyle||(e._drawStyle=new i(t));return laya.webgl.canvas.DrawStyle.DEFAULT},e(i,["DEFAULT",function(){return this.DEFAULT=new i("#000000")}]),i}(),Y=function(){function t(){this._x=0,this._y=0,this.dirty=!1,this.offset=0,this.count=0,this.geoStart=0,this.tempArray=[],this.closePath=!1,this.geomatrys=[];Ct.mainContext;this.ib=pe.create(35048),this.vb=ge.create(5)}l(t,"laya.webgl.canvas.Path");var e=t.prototype;return e.addPoint=function(t,e){this.tempArray.push(t,e)},e.getEndPointX=function(){return this.tempArray[this.tempArray.length-2]},e.getEndPointY=function(){return this.tempArray[this.tempArray.length-1]},e.polygon=function(t,e,i,r,s,n){return this.geomatrys.push(this._curGeomatry=s=new Yt(t,e,i,r,s,n)),r||(s.fill=!1),null==n&&(s.borderWidth=0),s},e.setGeomtry=function(t){this.geomatrys.push(this._curGeomatry=t)},e.drawLine=function(t,e,i,r,s){var n;return this.closePath?this.geomatrys.push(this._curGeomatry=n=new Wt(t,e,i,r,s)):this.geomatrys.push(this._curGeomatry=n=new zt(t,e,i,r,s)),n.fill=!1,n},e.update=function(){var t=this.ib._byteLength,e=this.geomatrys.length;this.offset=t;for(var i=this.geoStart;i<e;i++)this.geomatrys[i].getData(this.ib,this.vb,this.vb._byteLength/20);this.geoStart=e,this.count=(this.ib._byteLength-t)/yt.BYTES_PIDX},e.reset=function(){this.vb.clear(),this.ib.clear(),this.offset=this.count=this.geoStart=0,this.geomatrys.length=0},e.recover=function(){this._curGeomatry=null,this.vb.destory(),this.vb=null,this.ib.destory(),this.ib=null},t}(),X=function(){function n(){}l(n,"laya.webgl.canvas.save.SaveBase");var t=n.prototype;return x.imps(t,{"laya.webgl.canvas.save.ISaveData":!0}),t.isSaveMark=function(){return!1},t.restore=function(t){this._dataObj[this._valueName]=this._value,(n._cache[n._cache._length++]=this)._newSubmit&&(t._curSubmit=ut.RENDERBASE,t._renderKey=0)},n._createArray=function(){var t=[];return t._length=0,t},n._init=function(){var t=n._namemap={};return t[1]="ALPHA",t[2]="fillStyle",t[8]="font",t[256]="lineWidth",t[512]="strokeStyle",t[8192]="_mergeID",t[1024]=t[2048]=t[4096]=[],t[16384]="textBaseline",t[32768]="textAlign",t[65536]="_nBlendType",t[1048576]="shader",t[2097152]="filters",t},n.save=function(t,e,i,r){var s;(t._saveMark._saveuse&e)!==e&&(t._saveMark._saveuse|=e,(s=0<(s=n._cache)._length?s[--s._length]:new n)._value=i[s._valueName=n._namemap[e]],s._dataObj=i,s._newSubmit=r,(t=t._save)[t._length++]=s)},n._cache=laya.webgl.canvas.save.SaveBase._createArray(),n._namemap=n._init(),n}(),K=function(){function r(){this._clipRect=new A}l(r,"laya.webgl.canvas.save.SaveClipRect");var t=r.prototype;return x.imps(t,{"laya.webgl.canvas.save.ISaveData":!0}),t.isSaveMark=function(){return!1},t.restore=function(t){t._clipRect=this._clipSaveRect,(r._cache[r._cache._length++]=this)._submitScissor.submitLength=t._submits._length-this._submitScissor.submitIndex,t._curSubmit=ut.RENDERBASE,t._renderKey=0},r.save=function(t,e){var i;131072!=(131072&t._saveMark._saveuse)&&(t._saveMark._saveuse|=131072,(i=0<(i=r._cache)._length?i[--i._length]:new r)._clipSaveRect=t._clipRect,t._clipRect=i._clipRect.copyFrom(t._clipRect),i._submitScissor=e,(t=t._save)[t._length++]=i)},e(r,["_cache",function(){return this._cache=X._createArray()}]),r}(),Q=function(){function _(){this._contextX=0,this._contextY=0,this._clipRect=new A,this._rect=new A,this._matrix=new y}l(_,"laya.webgl.canvas.save.SaveClipRectStencil");var t=_.prototype;return x.imps(t,{"laya.webgl.canvas.save.ISaveData":!0}),t.isSaveMark=function(){return!1},t.restore=function(t){mt.restore(t,this._rect,this._saveMatrix,this._contextX,this._contextY),t._clipRect=this._clipSaveRect,t._curMat=this._saveMatrix,t._x=this._contextX,t._y=this._contextY,_._cache[_._cache._length++]=this,t._curSubmit=ut.RENDERBASE},_.save=function(t,e,i,r,s,n,a,h,l,o){var u;262144!=(262144&t._saveMark._saveuse)&&(t._saveMark._saveuse|=262144,(u=0<(u=_._cache)._length?u[--u._length]:new _)._clipSaveRect=t._clipRect,u._clipRect.setTo(a,h,l,o),t._clipRect=u._clipRect,u._rect.x=i,u._rect.y=r,u._rect.width=s,u._rect.height=n,u._contextX=t._x,u._contextY=t._y,u._saveMatrix=t._curMat,t._curMat.copyTo(u._matrix),t._curMat=u._matrix,u._submitStencil=e,(t=t._save)[t._length++]=u)},e(_,["_cache",function(){return this._cache=X._createArray()}]),_}(),Z=function(){function i(){this._saveuse=0}l(i,"laya.webgl.canvas.save.SaveMark");var t=i.prototype;return x.imps(t,{"laya.webgl.canvas.save.ISaveData":!0}),t.isSaveMark=function(){return!0},t.restore=function(t){t._saveMark=this._preSaveMark,i._no[i._no._length++]=this},i.Create=function(t){var e=i._no,e=0<e._length?e[--e._length]:new i;return e._saveuse=0,e._preSaveMark=t._saveMark,t._saveMark=e},e(i,["_no",function(){return this._no=X._createArray()}]),i}(),q=function(){function i(){this._matrix=new y}l(i,"laya.webgl.canvas.save.SaveTransform");var t=i.prototype;return x.imps(t,{"laya.webgl.canvas.save.ISaveData":!0}),t.isSaveMark=function(){return!1},t.restore=function(t){t._curMat=this._savematrix,i._no[i._no._length++]=this},i.save=function(t){var e=t._saveMark;2048!=(2048&e._saveuse)&&(e._saveuse|=2048,(e=0<(e=i._no)._length?e[--e._length]:new i)._savematrix=t._curMat,t._curMat=t._curMat.copyTo(e._matrix),(t=t._save)[t._length++]=e)},e(i,["_no",function(){return this._no=X._createArray()}]),i}(),j=function(){function i(){}l(i,"laya.webgl.canvas.save.SaveTranslate");var t=i.prototype;return x.imps(t,{"laya.webgl.canvas.save.ISaveData":!0}),t.isSaveMark=function(){return!1},t.restore=function(t){t._curMat;t._x=this._x,t._y=this._y,i._no[i._no._length++]=this},i.save=function(t){var e=i._no,e=0<e._length?e[--e._length]:new i;e._x=t._x,e._y=t._y;t=t._save;t[t._length++]=e},e(i,["_no",function(){return this._no=X._createArray()}]),i}(),$=function(){function t(){this.target=null,this.repaint=!1,this._width=NaN,this._height=NaN,this._sp=null,this._clipRect=new A}l(t,"laya.webgl.resource.RenderTargetMAX");var e=t.prototype;return e.setSP=function(t){this._sp=t},e.size=function(t,e){var i=this;this._width!==t||this._height!==e?(this.repaint=!0,this._width=t,this._height=e,this.target?this.target.size(t,e):this.target=jt.create(t,e),this.target.hasListener("recovered")||this.target.on("recovered",this,function(t){x.timer.callLater(i._sp,i._sp.repaint)})):this.target.size(t,e)},e._flushToTarget=function(t,e){var i,r,s,n,a,h,l;e._destroy||(l=Rt.worldScissorTest,i=Rt.worldClipRect,Rt.worldClipRect=this._clipRect,this._clipRect.x=this._clipRect.y=0,this._clipRect.width=this._width,this._clipRect.height=this._height,Rt.worldScissorTest=!1,Ct.mainContext.disable(3089),r=Rt.worldAlpha,s=Rt.worldMatrix4,n=Rt.worldMatrix,a=Rt.worldFilters,h=Rt.worldShaderDefines,Rt.worldMatrix=y.EMPTY,Rt.restoreTempArray(),Rt.worldMatrix4=Rt.TEMPMAT4_ARRAY,Rt.worldAlpha=1,Rt.worldFilters=null,Rt.worldShaderDefines=null,Zt.activeShader=null,e.start(),v.showCanvasMark?e.clear(0,1,0,.3):e.clear(0,0,0,0),t.flush(),e.end(),Zt.activeShader=null,Rt.worldAlpha=r,Rt.worldMatrix4=s,Rt.worldMatrix=n,Rt.worldFilters=a,Rt.worldShaderDefines=h,(Rt.worldScissorTest=l)&&(l=Rt.height-i.y-i.height,Ct.mainContext.scissor(i.x,l,i.width,i.height),Ct.mainContext.enable(3089)),Rt.worldClipRect=i)},e.flush=function(t){this.repaint&&(this._flushToTarget(t,this.target),this.repaint=!1)},e.drawTo=function(t,e,i,r,s){t.drawTexture(this.target.getTexture(),e,i,r,s,0,0)},e.destroy=function(){this.target&&(this.target.destroy(),this.target=null,this._sp=null)},t}(),J=(l(tt,"laya.webgl.shader.d2.Shader2D"),tt.prototype.destroy=function(){this.defines=null,this.filters=null,this.glTexture=null,this.strokeStyle=null,this.fillStyle=null},tt.__init__=function(){ce.addInclude("parts/ColorFilter_ps_uniform.glsl","uniform vec4 colorAlpha;\nuniform mat4 colorMat;"),ce.addInclude("parts/ColorFilter_ps_logic.glsl","mat4 alphaMat =colorMat;\n\nalphaMat[0][3] *= gl_FragColor.a;\nalphaMat[1][3] *= gl_FragColor.a;\nalphaMat[2][3] *= gl_FragColor.a;\n\ngl_FragColor = gl_FragColor * alphaMat;\ngl_FragColor += colorAlpha/255.0*gl_FragColor.a;\n"),ce.addInclude("parts/GlowFilter_ps_uniform.glsl","uniform vec4 u_color;\nuniform float u_strength;\nuniform float u_blurX;\nuniform float u_blurY;\nuniform float u_offsetX;\nuniform float u_offsetY;\nuniform float u_textW;\nuniform float u_textH;"),ce.addInclude("parts/GlowFilter_ps_logic.glsl","const float c_IterationTime = 10.0;\nfloat floatIterationTotalTime = c_IterationTime * c_IterationTime;\nvec4 vec4Color = vec4(0.0,0.0,0.0,0.0);\nvec2 vec2FilterDir = vec2(-(u_offsetX)/u_textW,-(u_offsetY)/u_textH);\nvec2 vec2FilterOff = vec2(u_blurX/u_textW/c_IterationTime * 2.0,u_blurY/u_textH/c_IterationTime * 2.0);\nfloat maxNum = u_blurX * u_blurY;\nvec2 vec2Off = vec2(0.0,0.0);\nfloat floatOff = c_IterationTime/2.0;\nfor(float i = 0.0;i<=c_IterationTime; ++i){\n\tfor(float j = 0.0;j<=c_IterationTime; ++j){\n\t\tvec2Off = vec2(vec2FilterOff.x * (i - floatOff),vec2FilterOff.y * (j - floatOff));\n\t\tvec4Color += texture2D(texture, v_texcoord + vec2FilterDir + vec2Off)/floatIterationTotalTime;\n\t}\n}\ngl_FragColor = vec4(u_color.rgb,vec4Color.a * u_strength);\ngl_FragColor.rgb *= gl_FragColor.a;"),ce.addInclude("parts/BlurFilter_ps_logic.glsl","gl_FragColor = blur();\ngl_FragColor.w*=alpha;"),ce.addInclude("parts/BlurFilter_ps_uniform.glsl","uniform vec4 strength_sig2_2sig2_gauss1;\nuniform vec2 blurInfo;\n\n#define PI 3.141593\n\n//float sigma=strength/3.0;//3σ以外影响很小。即当σ=1的时候半径为3\n//float sig2 = sigma*sigma;\n//float _2sig2 = 2.0*sig2;\n//return 1.0/(2*PI*sig2)*exp(-(x*x+y*y)/_2sig2)\n//float gauss1 = 1.0/(2.0*PI*sig2);\n\nfloat getGaussian(float x, float y){\n return strength_sig2_2sig2_gauss1.w*exp(-(x*x+y*y)/strength_sig2_2sig2_gauss1.z);\n}\n\nvec4 blur(){\n const float blurw = 9.0;\n vec4 vec4Color = vec4(0.0,0.0,0.0,0.0);\n vec2 halfsz=vec2(blurw,blurw)/2.0/blurInfo; \n vec2 startpos=v_texcoord-halfsz;\n vec2 ctexcoord = startpos;\n vec2 step = 1.0/blurInfo; //每个像素 \n \n for(float y = 0.0;y<=blurw; ++y){\n ctexcoord.x=startpos.x;\n for(float x = 0.0;x<=blurw; ++x){\n //TODO 纹理坐标的固定偏移应该在vs中处理\n vec4Color += texture2D(texture, ctexcoord)*getGaussian(x-blurw/2.0,y-blurw/2.0);\n ctexcoord.x+=step.x;\n }\n ctexcoord.y+=step.y;\n }\n return vec4Color;\n}"),ce.addInclude("parts/ColorAdd_ps_uniform.glsl","uniform vec4 colorAdd;\n"),ce.addInclude("parts/ColorAdd_ps_logic.glsl","gl_FragColor = vec4(colorAdd.rgb,colorAdd.a*gl_FragColor.a);\ngl_FragColor.xyz *= colorAdd.a;"),ce.preCompile2D(0,1,"attribute vec4 position;\nattribute vec2 texcoord;\nuniform vec2 size;\n\n#ifdef WORLDMAT\nuniform mat4 mmat;\n#endif\nvarying vec2 v_texcoord;\nvoid main() {\n #ifdef WORLDMAT\n vec4 pos=mmat*position;\n gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n #else\n gl_Position =vec4((position.x/size.x-0.5)*2.0,(0.5-position.y/size.y)*2.0,position.z,1.0);\n #endif\n \n v_texcoord = texcoord;\n}",'precision mediump float;\n//precision highp float;\nvarying vec2 v_texcoord;\nuniform sampler2D texture;\nuniform float alpha;\n#include?BLUR_FILTER "parts/BlurFilter_ps_uniform.glsl";\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\n#include?GLOW_FILTER "parts/GlowFilter_ps_uniform.glsl";\n#include?COLOR_ADD "parts/ColorAdd_ps_uniform.glsl";\n\nvoid main() {\n vec4 color= texture2D(texture, v_texcoord);\n color.a*=alpha;\n color.rgb*=alpha;\n gl_FragColor=color;\n #include?COLOR_ADD "parts/ColorAdd_ps_logic.glsl"; \n #include?BLUR_FILTER "parts/BlurFilter_ps_logic.glsl";\n #include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n #include?GLOW_FILTER "parts/GlowFilter_ps_logic.glsl";\n}',null),ce.preCompile2D(0,2,"attribute vec4 position;\nuniform vec2 size;\nuniform mat4 mmat;\nvoid main() {\n vec4 pos=mmat*position;\n gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n}",'precision mediump float;\nuniform vec4 color;\nuniform float alpha;\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\nvoid main() {\n\tvec4 a = vec4(color.r, color.g, color.b, color.a);\n\ta.w = alpha;\n\ta.xyz *= alpha;\n\tgl_FragColor = a;\n\t#include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n}',null),ce.preCompile2D(0,4,"attribute vec4 position;\nattribute vec3 a_color;\nuniform mat4 mmat;\nuniform mat4 u_mmat2;\nuniform vec2 u_pos;\nuniform vec2 size;\nvarying vec3 color;\nvoid main(){\n vec4 tPos = vec4(position.x + u_pos.x,position.y + u_pos.y,position.z,position.w);\n vec4 pos=mmat*u_mmat2*tPos;\n gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n color=a_color;\n}","precision mediump float;\n//precision mediump float;\nvarying vec3 color;\nuniform float alpha;\nvoid main(){\n\t//vec4 a=vec4(color.r, color.g, color.b, 1);\n\t//a.a*=alpha;\n gl_FragColor=vec4(color.r, color.g, color.b, alpha);\n\tgl_FragColor.rgb*=alpha;\n}",null),ce.preCompile2D(0,256,"attribute vec4 position;\nattribute vec2 texcoord;\nuniform vec2 size;\n\n#ifdef WORLDMAT\nuniform mat4 mmat;\n#endif\nvarying vec2 v_texcoord;\nvoid main() {\n #ifdef WORLDMAT\n vec4 pos=mmat*position;\n gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n #else\n gl_Position =vec4((position.x/size.x-0.5)*2.0,(0.5-position.y/size.y)*2.0,position.z,1.0);\n #endif\n \n v_texcoord = texcoord;\n}",'#ifdef FSHIGHPRECISION\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n//precision highp float;\nvarying vec2 v_texcoord;\nuniform sampler2D texture;\nuniform float alpha;\nuniform vec4 u_TexRange;\nuniform vec2 u_offset;\n#include?BLUR_FILTER "parts/BlurFilter_ps_uniform.glsl";\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\n#include?GLOW_FILTER "parts/GlowFilter_ps_uniform.glsl";\n#include?COLOR_ADD "parts/ColorAdd_ps_uniform.glsl";\n\nvoid main() {\n vec2 newTexCoord;\n newTexCoord.x = mod(u_offset.x + v_texcoord.x,u_TexRange.y) + u_TexRange.x;\n newTexCoord.y = mod(u_offset.y + v_texcoord.y,u_TexRange.w) + u_TexRange.z;\n vec4 color= texture2D(texture, newTexCoord);\n color.a*=alpha;\n gl_FragColor=color;\n #include?COLOR_ADD "parts/ColorAdd_ps_logic.glsl"; \n #include?BLUR_FILTER "parts/BlurFilter_ps_logic.glsl";\n #include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n #include?GLOW_FILTER "parts/GlowFilter_ps_logic.glsl";\n}',null),ce.preCompile2D(0,512,"attribute vec2 position;\nattribute vec2 texcoord;\nattribute vec4 color;\nuniform vec2 size;\nuniform float offsetX;\nuniform float offsetY;\nuniform mat4 mmat;\nuniform mat4 u_mmat2;\nvarying vec2 v_texcoord;\nvarying vec4 v_color;\nvoid main() {\n vec4 pos=mmat*u_mmat2*vec4(offsetX+position.x,offsetY+position.y,0,1 );\n gl_Position = vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n v_color = color;\n v_color.rgb *= v_color.a;\n v_texcoord = texcoord; \n}","precision mediump float;\nvarying vec2 v_texcoord;\nvarying vec4 v_color;\nuniform sampler2D texture;\nuniform float alpha;\nvoid main() {\n\tvec4 t_color = texture2D(texture, v_texcoord);\n\tgl_FragColor = t_color.rgba * v_color;\n\tgl_FragColor *= alpha;\n}",null)},tt);function tt(){this.ALPHA=1,this.shaderType=0,this.defines=new kt}var et=function(){function e(t,e,i){this._value=0,this._name2int=t,this._int2name=e,this._int2nameMap=i}l(e,"laya.webgl.shader.ShaderDefines");var t=e.prototype;return t.add=function(t){return"string"==typeof t&&(t=this._name2int[t]),this._value|=t,this._value},t.addInt=function(t){return this._value|=t,this._value},t.remove=function(t){return"string"==typeof t&&(t=this._name2int[t]),this._value&=~t,this._value},t.isDefine=function(t){return(this._value&t)===t},t.getValue=function(){return this._value},t.setValue=function(t){this._value=t},t.toNameDic=function(){var t=this._int2nameMap[this._value];return t||e._toText(this._value,this._int2name,this._int2nameMap)},e._reg=function(t,e,i,r){r[i[t]=e]=t},e._toText=function(t,e,i){var r=i[t];if(r)return r;for(var s,n,a={},h=0;h<32&&!(t<(s=1<<h));h++)t&s&&((n=e[s])&&(a[n]=""));return i[t]=a},e._toInt=function(t,e){for(var i=t.split("."),r=0,s=0,n=i.length;s<n;s++){var a=e[i[s]];if(!a)throw new Error("Defines to int err:"+t+"/"+i[s]);r|=a}return r},e}(),it=function(){function a(){this.mVBBuffer=null,this.mIBBuffer=null,this.mVBData=null,this.mIBData=null,this.mEleNum=0,this.mTexture=null,this.transform=null,this._vs=null,this._ps=null,this._indexStart=-1,this._verticles=null,this._uvs=null,this._tempMatrix=new y}l(a,"laya.webgl.shader.d2.skinAnishader.SkinMesh");var t=a.prototype;return t.init=function(t,e,i){var r;e?this._vs=e:(this._vs=[],r=t.width,e=t.height,this._vs.push(0,0,0,0,1,1,1,1),this._vs.push(r,0,1,0,1,1,1,1),this._vs.push(r,e,1,1,1,1,1,1),this._vs.push(0,e,0,1,1,1,1,1)),i?this._ps=i:(a._defaultPS||(a._defaultPS=[]).push(0,1,3,3,1,2),this._ps=a._defaultPS),this.mVBData=new Float32Array(this._vs),this.mIBData=new Uint16Array(this._ps.length),this.mIBData.start=-1,this.mEleNum=this._ps.length,this.mTexture=t},t.init2=function(t,e,i,r,s){this.transform&&(this.transform=null),i?this._ps=i:(this._ps=[],this._ps.push(0,1,3,3,1,2)),this._verticles=r,this._uvs=s,this.mEleNum=this._ps.length,this.mTexture=t,(p.isConchNode||p.isConchApp)&&(this._initMyData(),this.mVBData=new Float32Array(this._vs))},t._initMyData=function(){var t=0,e=0,i=4*this._verticles.length;this._vs=a._tempVS;var r=!1;if((p.isConchNode||p.isConchApp||this._vs.length<i)&&(this._vs.length=i,r=!0),a._tVSLen=i,r)for(;t<i;)this._vs[t]=this._verticles[e],this._vs[t+1]=this._verticles[e+1],this._vs[t+2]=this._uvs[e],this._vs[t+3]=this._uvs[e+1],this._vs[t+4]=1,this._vs[t+5]=1,this._vs[t+6]=1,this._vs[t+7]=1,t+=8,e+=2;else for(;t<i;)this._vs[t]=this._verticles[e],this._vs[t+1]=this._verticles[e+1],this._vs[t+2]=this._uvs[e],this._vs[t+3]=this._uvs[e+1],t+=8,e+=2},t.getData2=function(t,e,i){var r;this.mVBBuffer=t,this.mIBBuffer=e,this._initMyData(),t.appendEx2(this._vs,Float32Array,a._tVSLen,4),this._indexStart=e._byteLength,(r=a._tempIB).length<this._ps.length&&(r.length=this._ps.length);for(var s=0,n=this._ps.length;s<n;s++)r[s]=this._ps[s]+i;e.appendEx2(r,Uint16Array,this._ps.length,2)},t.getData=function(t,e,i){if(this.mVBBuffer=t,this.mIBBuffer=e,t.append(this.mVBData),this._indexStart=e._byteLength,this.mIBData.start!=i){for(var r=0,s=this._ps.length;r<s;r++)this.mIBData[r]=this._ps[r]+i;this.mIBData.start=i}e.append(this.mIBData)},t.render=function(t,e,i){var r,s,n;p.isWebGL&&this.mTexture?(t._renderKey=0,t._shader2D.glTexture=null,rt.getInstance().addSkinMesh(this),r=ut.createShape(t,this.mIBBuffer,this.mVBBuffer,this.mEleNum,this._indexStart,Nt.create(512,0)),this.transform||(this.transform=y.EMPTY),this.transform.translate(e,i),y.mul(this.transform,t._curMat,this._tempMatrix),this.transform.translate(-e,-i),n=(s=r.shaderValue).u_mmat2||Rt.getMatrArray(),Rt.mat2MatArray(this._tempMatrix,n),s.textureHost=this.mTexture,s.offsetX=0,s.offsetY=0,s.u_mmat2=n,s.ALPHA=t._shader2D.ALPHA,t._submits[t._submits._length++]=r):p.isConchApp&&this.mTexture&&(this.transform||(this.transform=y.EMPTY),t.setSkinMesh&&t.setSkinMesh(e,i,this._ps,this.mVBData,this.mEleNum,0,this.mTexture,this.transform))},a._tempVS=[],a._tempIB=[],a._defaultPS=null,a._tVSLen=0,a}(),rt=function(){function t(){this.ib=null,this.vb=null;Ct.mainContext;this.ib=pe.create(35048),this.vb=ge.create(8)}l(t,"laya.webgl.shader.d2.skinAnishader.SkinMeshBuffer");var e=t.prototype;return e.addSkinMesh=function(t){t.getData2(this.vb,this.ib,this.vb._byteLength/32)},e.reset=function(){this.vb.clear(),this.ib.clear()},t.getInstance=function(){return t.instance=t.instance||new t},t.instance=null,t}(),st=function(){function t(t,e,i,r,s,n,a,h,l){this.r0=0,this.fill=!0,this.r1=Math.PI/2,void 0===l&&(l=0),this.x=t,this.y=e,this.width=i,this.height=r,this.edges=s,this.color=n,this.borderWidth=a,this.borderColor=h}l(t,"laya.webgl.shapes.BasePoly");var e=t.prototype;return x.imps(e,{"laya.webgl.shapes.IShape":!0}),e.getData=function(t,e,i){},e.rebuild=function(t){},e.setMatrix=function(t){},e.needUpdate=function(t){return!0},e.sector=function(t,e,i){var r=this.x,s=this.y,n=this.edges,a=(this.r1-this.r0)/n,h=this.width,l=this.height,o=this.color,u=(o>>16&255)/255,_=(o>>8&255)/255,c=(255&o)/255;t.push(r,s,u,_,c);for(var d=0;d<n+1;d++)t.push(r+Math.sin(a*d+this.r0)*h,s+Math.cos(a*d+this.r0)*l),t.push(u,_,c);for(d=0;d<n;d++)e.push(i,i+d+1,i+d+2)},e.createLine2=function(t,e,i,r,s,n){var a,h,l,o,u,_,c,d=t.concat(),f=s,s=this.borderColor,m=(s>>16&255)/255,p=(s>>8&255)/255,g=(255&s)/255,x=d.length/2,v=r,b=i/2,y=d[0],T=d[1],A=d[2],E=d[3],S=-(T-E),w=y-A,R=Math.sqrt(S*S+w*w);f.push(y-(S=S/R*b)+this.x,T-(w=w/R*b)+this.y,m,p,g,y+S+this.x,T+w+this.y,m,p,g);for(var I=1;I<x-1;I++)y=d[2*(I-1)],T=d[2*(I-1)+1],A=d[2*I],E=d[2*I+1],o=d[2*(I+1)],h=d[2*(I+1)+1],w=y-A,c=A-o,l=(-(S=(S=-(T-E))/(R=Math.sqrt(S*S+w*w))*b)+y)*(-(w=w/R*b)+E)-(-S+A)*(-w+T),_=(-(u=(u=-(E-h))/(R=Math.sqrt(u*u+c*c))*b)+o)*(-(c=c/R*b)+E)-(-u+A)*(-c+h),c=(a=-w+T-(-w+E))*(u=-u+A-(-u+o))-(o=-c+h-(-c+E))*(h=-S+A-(-S+y)),Math.abs(c)<.1?(c+=10.1,f.push(A-S+this.x,E-w+this.y,m,p,g,A+S+this.x,E+w+this.y,m,p,g)):(u=(h*_-u*l)/c,c=(o*l-a*_)/c,f.push(u+this.x,c+this.y,m,p,g,A-(u-A)+this.x,E-(c-E)+this.y,m,p,g));y=d[d.length-4],T=d[d.length-3],A=d[d.length-2],S=-(T-(E=d[d.length-1])),w=y-A,R=Math.sqrt(S*S+w*w),f.push(A-(S=S/R*b)+this.x,E-(w=w/R*b)+this.y,m,p,g,A+S+this.x,E+w+this.y,m,p,g);for(var M=n,I=1;I<M;I++)e.push(v+2*(I-1),v+2*(I-1)+1,v+2*I+1,v+2*I+1,v+2*I,v+2*(I-1));return f},e.createLine=function(t,e,i,r){var s=t.concat(),n=t,t=this.borderColor,a=(t>>16&255)/255,h=(t>>8&255)/255,l=(255&t)/255;s.splice(0,5);var o,u,_,c,d,f,m,p=s.length/5,g=r,x=i/2,v=s[0],b=s[1],y=s[5],T=s[6],A=-(b-T),E=v-y,S=Math.sqrt(A*A+E*E);n.push(v-(A=A/S*x),b-(E=E/S*x),a,h,l,v+A,b+E,a,h,l);for(var w=1;w<p-1;w++)v=s[5*(w-1)],b=s[5*(w-1)+1],y=s[5*w],T=s[5*w+1],c=s[5*(w+1)],u=s[5*(w+1)+1],E=v-y,m=y-c,_=(-(A=(A=-(b-T))/(S=Math.sqrt(A*A+E*E))*x)+v)*(-(E=E/S*x)+T)-(-A+y)*(-E+b),f=(-(d=(d=-(T-u))/(S=Math.sqrt(d*d+m*m))*x)+c)*(-(m=m/S*x)+T)-(-d+y)*(-m+u),m=(o=-E+b-(-E+T))*(d=-d+y-(-d+c))-(c=-m+u-(-m+T))*(u=-A+y-(-A+v)),Math.abs(m)<.1?(m+=10.1,n.push(y-A,T-E,a,h,l,y+A,T+E,a,h,l)):(d=(u*f-d*_)/m,m=(c*_-o*f)/m,n.push(d,m,a,h,l,y-(d-y),T-(m-T),a,h,l));v=s[s.length-10],b=s[s.length-9],y=s[s.length-5],A=-(b-(T=s[s.length-4])),E=v-y,S=Math.sqrt(A*A+E*E),n.push(y-(A=A/S*x),T-(E=E/S*x),a,h,l,y+A,T+E,a,h,l);for(var R=this.edges+1,w=1;w<R;w++)e.push(g+2*(w-1),g+2*(w-1)+1,g+2*w+1,g+2*w+1,g+2*w,g+2*(w-1));return n},e.createLoopLine=function(t,e,i,r,s,n){var a=t.concat(),h=s||t,l=this.borderColor,o=(l>>16&255)/255,u=(l>>8&255)/255,_=(255&l)/255;a.splice(0,5);s=[a[0],a[1]],t=[a[a.length-5],a[a.length-4]],l=t[0]+.5*(s[0]-t[0]),t=t[1]+.5*(s[1]-t[1]);a.unshift(l,t,0,0,0),a.push(l,t,0,0,0);var c,d,f,m,p,g,x,v=a.length/5,b=r,y=i/2,T=a[0],A=a[1],E=a[5],S=a[6],w=-(A-S),R=T-E,I=Math.sqrt(w*w+R*R);h.push(T-(w=w/I*y),A-(R=R/I*y),o,u,_,T+w,A+R,o,u,_);for(var M=1;M<v-1;M++)T=a[5*(M-1)],A=a[5*(M-1)+1],E=a[5*M],S=a[5*M+1],m=a[5*(M+1)],d=a[5*(M+1)+1],R=T-E,x=E-m,f=(-(w=(w=-(A-S))/(I=Math.sqrt(w*w+R*R))*y)+T)*(-(R=R/I*y)+S)-(-w+E)*(-R+A),g=(-(p=(p=-(S-d))/(I=Math.sqrt(p*p+x*x))*y)+m)*(-(x=x/I*y)+S)-(-p+E)*(-x+d),x=(c=-R+A-(-R+S))*(p=-p+E-(-p+m))-(m=-x+d-(-x+S))*(d=-w+E-(-w+T)),Math.abs(x)<.1?(x+=10.1,h.push(E-w,S-R,o,u,_,E+w,S+R,o,u,_)):(p=(d*g-p*f)/x,x=(m*f-c*g)/x,h.push(p,x,o,u,_,E-(p-E),S-(x-S),o,u,_));n&&(e=n);for(var C=this.edges+1,M=1;M<C;M++)e.push(b+2*(M-1),b+2*(M-1)+1,b+2*M+1,b+2*M+1,b+2*M,b+2*(M-1));return e.push(b+2*(M-1),b+2*(M-1)+1,b+1,b+1,b,b+2*(M-1)),h},t}(),nt=(l(at,"laya.webgl.shapes.Earcut"),at.earcut=function(t,e,i){i=i||2;var r,s,n,a,h,l=e&&e.length,o=l?e[0]*i:t.length,u=at.linkedList(t,0,o,i,!0),_=[];if(!u)return _;if(l&&(u=at.eliminateHoles(t,e,u,i)),t.length>80*i){for(var c=r=t[0],d=s=t[1],f=i;f<o;f+=i)(n=t[f])<c&&(c=n),(a=t[f+1])<d&&(d=a),r<n&&(r=n),s<a&&(s=a);h=0!==(h=Math.max(r-c,s-d))?1/h:0}return at.earcutLinked(u,_,i,c,d,h),_},at.linkedList=function(t,e,i,r,s){var n,a;if(s===0<at.signedArea(t,e,i,r))for(n=e;n<i;n+=r)a=at.insertNode(n,t[n],t[n+1],a);else for(n=i-r;e<=n;n-=r)a=at.insertNode(n,t[n],t[n+1],a);return a&&at.equals(a,a.next)&&(at.removeNode(a),a=a.next),a},at.filterPoints=function(t,e){if(!t)return t;e=e||t;var i,r=t;do{if(i=!1,r.steiner||!at.equals(r,r.next)&&0!==at.area(r.prev,r,r.next))r=r.next;else{if(at.removeNode(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e},at.earcutLinked=function(t,e,i,r,s,n,a){if(t){!a&&n&&at.indexCurve(t,r,s,n);for(var h,l,o=t;t.prev!==t.next;)if(h=t.prev,l=t.next,n?at.isEarHashed(t,r,s,n):at.isEar(t))e.push(h.i/i),e.push(t.i/i),e.push(l.i/i),at.removeNode(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?(t=at.cureLocalIntersections(t,e,i),at.earcutLinked(t,e,i,r,s,n,2)):2===a&&at.splitEarcut(t,e,i,r,s,n):at.earcutLinked(at.filterPoints(t,null),e,i,r,s,n,1);break}}},at.isEar=function(t){var e=t.prev,i=t,r=t.next;if(0<=at.area(e,i,r))return!1;for(var s=t.next.next;s!==t.prev;){if(at.pointInTriangle(e.x,e.y,i.x,i.y,r.x,r.y,s.x,s.y)&&0<=at.area(s.prev,s,s.next))return!1;s=s.next}return!0},at.isEarHashed=function(t,e,i,r){var s=t.prev,n=t,a=t.next;if(0<=at.area(s,n,a))return!1;for(var h=(s.x<n.x?s.x<a.x?s:a:n.x<a.x?n:a).x,l=(s.y<n.y?s.y<a.y?s:a:n.y<a.y?n:a).y,o=(s.x>n.x?s.x>a.x?s:a:n.x>a.x?n:a).x,u=(s.y>n.y?s.y>a.y?s:a:n.y>a.y?n:a).y,_=at.zOrder(h,l,e,i,r),c=at.zOrder(o,u,e,i,r),d=t.nextZ;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&at.pointInTriangle(s.x,s.y,n.x,n.y,a.x,a.y,d.x,d.y)&&0<=at.area(d.prev,d,d.next))return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=_;){if(d!==t.prev&&d!==t.next&&at.pointInTriangle(s.x,s.y,n.x,n.y,a.x,a.y,d.x,d.y)&&0<=at.area(d.prev,d,d.next))return!1;d=d.prevZ}return!0},at.cureLocalIntersections=function(t,e,i){var r=t;do{var s=r.prev,n=r.next.next}while(!at.equals(s,n)&&at.intersects(s,r,r.next,n)&&at.locallyInside(s,n)&&at.locallyInside(n,s)&&(e.push(s.i/i),e.push(r.i/i),e.push(n.i/i),at.removeNode(r),at.removeNode(r.next),r=t=n),(r=r.next)!==t);return r},at.splitEarcut=function(t,e,i,r,s,n){var a=t;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&at.isValidDiagonal(a,h)){var l=at.splitPolygon(a,h),a=at.filterPoints(a,a.next),l=at.filterPoints(l,l.next);return at.earcutLinked(a,e,i,r,s,n),void at.earcutLinked(l,e,i,r,s,n)}h=h.next}}while((a=a.next)!==t)},at.eliminateHoles=function(t,e,i,r){for(var s,n,a=[],h=0,l=e.length;h<l;h++)s=e[h]*r,n=h<l-1?e[h+1]*r:t.length,(n=at.linkedList(t,s,n,r,!1))===n.next&&(n.steiner=!0),a.push(at.getLeftmost(n));for(a.sort(at.compareX),h=0;h<a.length;h++)at.eliminateHole(a[h],i),i=at.filterPoints(i,i.next);return i},at.compareX=function(t,e){return t.x-e.x},at.eliminateHole=function(t,e){(e=at.findHoleBridge(t,e))&&(t=at.splitPolygon(e,t),at.filterPoints(t,t.next))},at.findHoleBridge=function(t,e){var i,r=e,s=t.x,n=t.y,a=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var h=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=s&&a<h){if((a=h)===s){if(n===r.y)return r;if(n===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}}while((r=r.next)!==e);if(!i)return null;if(s===a)return i.prev;for(var l,o=i,u=i.x,_=i.y,c=1/0,r=i.next;r!==o;)s>=r.x&&r.x>=u&&s!==r.x&&at.pointInTriangle(n<_?s:a,n,u,_,n<_?a:s,n,r.x,r.y)&&((l=Math.abs(n-r.y)/(s-r.x))<c||l===c&&r.x>i.x)&&at.locallyInside(r,t)&&(i=r,c=l),r=r.next;return i},at.indexCurve=function(t,e,i,r){for(var s=t;null===s.z&&(s.z=at.zOrder(s.x,s.y,e,i,r)),s.prevZ=s.prev,s.nextZ=s.next,(s=s.next)!==t;);s.prevZ.nextZ=null,s.prevZ=null,at.sortLinked(s)},at.sortLinked=function(t){var e,i,r,s,n,a,h,l,o=1;do{for(i=t,n=t=null,a=0;i;){for(a++,r=i,e=h=0;e<o&&(h++,r=r.nextZ);e++);for(l=o;0<h||0<l&&r;)0!==h&&(0===l||!r||i.z<=r.z)?(i=(s=i).nextZ,h--):(r=(s=r).nextZ,l--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;i=r}}while(n.nextZ=null,o*=2,1<a);return t},at.zOrder=function(t,e,i,r,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*s)|e<<8))|e<<4))|e<<2))|e<<1))<<1},at.getLeftmost=function(t){for(var e=t,i=t;e.x<i.x&&(i=e),(e=e.next)!==t;);return i},at.pointInTriangle=function(t,e,i,r,s,n,a,h){return 0<=(s-a)*(e-h)-(t-a)*(n-h)&&0<=(t-a)*(r-h)-(i-a)*(e-h)&&0<=(i-a)*(n-h)-(s-a)*(r-h)},at.isValidDiagonal=function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!at.intersectsPolygon(t,e)&&at.locallyInside(t,e)&&at.locallyInside(e,t)&&at.middleInside(t,e)},at.area=function(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)},at.equals=function(t,e){return t.x===e.x&&t.y===e.y},at.intersects=function(t,e,i,r){return!!(at.equals(t,e)&&at.equals(i,r)||at.equals(t,r)&&at.equals(i,e))||0<at.area(t,e,i)!=0<at.area(t,e,r)&&0<at.area(i,r,t)!=0<at.area(i,r,e)},at.intersectsPolygon=function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&at.intersects(i,i.next,t,e))return!0}while((i=i.next)!==t);return!1},at.locallyInside=function(t,e){return at.area(t.prev,t,t.next)<0?0<=at.area(t,e,t.next)&&0<=at.area(t,t.prev,e):at.area(t,e,t.prev)<0||at.area(t,t.next,e)<0},at.middleInside=function(t,e){for(var i=t,r=!1,s=(t.x+e.x)/2,n=(t.y+e.y)/2;i.y>n!=i.next.y>n&&i.next.y!==i.y&&s<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),(i=i.next)!==t;);return r},at.splitPolygon=function(t,e){var i=new ht(t.i,t.x,t.y),r=new ht(e.i,e.x,e.y),s=t.next,n=e.prev;return(t.next=e).prev=t,(i.next=s).prev=i,(r.next=i).prev=r,(n.next=r).prev=n,r},at.insertNode=function(t,e,i,r){i=new ht(t,e,i);return r?(i.next=r.next,(i.prev=r).next.prev=i,r.next=i):(i.prev=i).next=i,i},at.removeNode=function(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)},at.signedArea=function(t,e,i,r){for(var s=0,n=e,a=i-r;n<i;n+=r)s+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return s},at);function at(){}var ht=(l(lt,"laya.webgl.shapes.EarcutNode"),lt);function lt(t,e,i){this.i=null,this.x=null,this.y=null,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=null,this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}(function(){function t(t,e,i,r,s,n,a){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this.fillColor=r,this.fillAlpha=s,this.shape=a,this.fill=n}l(t,"laya.webgl.shapes.GeometryData");var e=t.prototype;e.clone=function(){return new t(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.fill,this.shape)},e.getIndexData=function(){return null},e.getVertexData=function(){return null},e.destroy=function(){this.shape=null}})(),function(){function t(t){t instanceof Float32Array?this.points=t:t instanceof Array&&(t.length,this.points=new Float32Array(t))}l(t,"laya.webgl.shapes.Vertex");var e=t.prototype;x.imps(e,{"laya.webgl.shapes.IShape":!0}),e.getData=function(t,e,i){},e.needUpdate=function(t){return!1},e.rebuild=function(t){},e.setMatrix=function(t){}}();var ot,ut=function(){function h(t){this._renderType=t=void 0===t?1e4:t}l(h,"laya.webgl.submit.Submit");var t=h.prototype;return x.imps(t,{"laya.webgl.submit.ISubmit":!0}),t.releaseRender=function(){var t=h._cache;(t[t._length++]=this).shaderValue.release(),this._vb=null},t.getRenderType=function(){return this._renderType},t.renderSubmit=function(){if(0===this._numEle)return 1;var t=this.shaderValue.textureHost;if(t){var e=t.source;if(!t.bitmap||!e)return 1;this.shaderValue.texture=e}this._vb.bind_upload(this._ib);e=Ct.mainContext;return this.shaderValue.upload(),G.activeBlendFunction!==this._blendFn&&(e.enable(3042),this._blendFn(e),G.activeBlendFunction=this._blendFn),I.drawCall++,I.trianglesFaces+=this._numEle/3,e.drawElements(4,this._numEle,5123,this._startIdx),1},h.__init__=function(){var t=h.RENDERBASE=new h(-1);t.shaderValue=new Nt(0,0),t.shaderValue.ALPHA=-1234},h.createSubmit=function(t,e,i,r,s){var n=h._cache._length?h._cache[--h._cache._length]:new h;null==i&&((i=n._selfVb||(n._selfVb=ge.create(-1))).clear(),r=0),n._ib=e,n._vb=i,n._startIdx=r*yt.BYTES_PIDX,n._numEle=0;r=t._nBlendType;n._blendFn=(t._targets?G.targetFns:G.fns)[r],n.shaderValue=s,n.shaderValue.setValue(t._shader2D);t=t._shader2D.filters;return t&&n.shaderValue.setFilters(t),n},h.createShape=function(t,e,i,r,s,n){var a=h._cache._length?h._cache[--h._cache._length]:new h;a._ib=e,a._vb=i,a._numEle=r,a._startIdx=s,a.shaderValue=n,a.shaderValue.setValue(t._shader2D);n=t._nBlendType;return a._blendFn=(t._targets?G.targetFns:G.fns)[n],a},h.TYPE_2D=1e4,h.TYPE_CANVAS=10003,h.TYPE_CMDSETRT=10004,h.TYPE_CUSTOM=10005,h.TYPE_BLURRT=10006,h.TYPE_CMDDESTORYPRERT=10007,h.TYPE_DISABLESTENCIL=10008,h.TYPE_OTHERIBVB=10009,h.TYPE_PRIMITIVE=10010,h.TYPE_RT=10011,h.TYPE_BLUR_RT=10012,h.TYPE_TARGET=10013,h.TYPE_CHANGE_VALUE=10014,h.TYPE_SHAPE=10015,h.TYPE_TEXTURE=10016,h.TYPE_FILLTEXTURE=10017,h.RENDERBASE=null,h._cache=((h._cache=[])._length=0,h._cache),h}(),_t=function(){function r(){this.fun=null,this.args=null}l(r,"laya.webgl.submit.SubmitCMD");var t=r.prototype;return x.imps(t,{"laya.webgl.submit.ISubmit":!0}),t.renderSubmit=function(){return this.fun.apply(null,this.args),1},t.getRenderType=function(){return 0},t.releaseRender=function(){var t=r._cache;t[t._length++]=this},r.create=function(t,e){var i=r._cache._length?r._cache[--r._cache._length]:new r;return i.fun=e,i.args=t,i},r._cache=((r._cache=[])._length=0,r._cache),r}(),ct=function(){function t(){this.variables={}}l(t,"laya.webgl.submit.SubmitCMDScope");var e=t.prototype;return e.getValue=function(t){return this.variables[t]},e.addValue=function(t,e){return this.variables[t]=e},e.setValue=function(t,e){return this.variables.hasOwnProperty(t)?this.variables[t]=e:null},e.clear=function(){for(var t in this.variables)delete this.variables[t]},e.recycle=function(){this.clear(),t.POOL.push(this)},t.create=function(){return t.POOL.pop()||new t},t.POOL=[],t}(),dt=function(){function u(){this.offset=0,this.startIndex=0,this._mat=y.create()}l(u,"laya.webgl.submit.SubmitOtherIBVB");var t=u.prototype;return x.imps(t,{"laya.webgl.submit.ISubmit":!0}),t.releaseRender=function(){var t=u._cache;t[t._length++]=this},t.getRenderType=function(){return 10009},t.renderSubmit=function(){var t=this._shaderValue.textureHost;if(t){var e=t.source;if(!t.bitmap||!e)return 1;this._shaderValue.texture=e}this._vb.bind_upload(this._ib);var i=Rt.worldMatrix4,t=y.TEMP;y.mulPre(this._mat,i[0],i[1],i[4],i[5],i[12],i[13],t);e=Rt.worldMatrix4=u.tempMatrix4;e[0]=t.a,e[1]=t.b,e[4]=t.c,e[5]=t.d,e[12]=t.tx,e[13]=t.ty,this._shader._offset=this.offset,this._shaderValue.refresh(),this._shader.upload(this._shaderValue),this._shader._offset=0;t=Ct.mainContext;return G.activeBlendFunction!==this._blendFn&&(t.enable(3042),this._blendFn(t),G.activeBlendFunction=this._blendFn),I.drawCall++,I.trianglesFaces+=this._numEle/3,t.drawElements(4,this._numEle,5123,this.startIndex),Rt.worldMatrix4=i,Zt.activeShader=null,1},u.create=function(t,e,i,r,s,n,a,h,l){void 0===l&&(l=0);var o=u._cache._length?u._cache[--u._cache._length]:new u;o._ib=i,o._vb=e,o._numEle=r,o._shader=s,o._shaderValue=n;n=t._nBlendType;switch(o._blendFn=(t._targets?G.targetFns:G.fns)[n],l){case 0:o.offset=0,o.startIndex=h/(yt.BYTES_PE*e.vertexStride)*1.5,o.startIndex*=yt.BYTES_PIDX;break;case 1:o.startIndex=a,o.offset=h}return o},u._cache=((u._cache=[])._length=0,u._cache),u.tempMatrix4=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u}(),ft=function(){function i(){this.submitIndex=0,this.submitLength=0,this.context=null,this.clipRect=new A,this.screenRect=new A}l(i,"laya.webgl.submit.SubmitScissor");var t=i.prototype;return x.imps(t,{"laya.webgl.submit.ISubmit":!0}),t._scissor=function(t,e,i,r){var s=Rt.worldMatrix4,n=s[0],a=s[5],h=s[12],s=s[13];if(r*=a,(i*=n)<1||r<1)return!1;h=(t=t*n+h)+i,a=(e=e*a+s)+r;t<0&&(i=h-(t=0)),e<0&&(r=a-(e=0));s=Rt.worldClipRect;if(t=Math.max(t,s.x),e=Math.max(e,s.y),i=Math.min(h,s.right)-t,r=Math.min(a,s.bottom)-e,i<1||r<1)return!1;a=Rt.worldScissorTest;return this.screenRect.copyFrom(s),s.x=t,s.y=e,s.width=i,s.height=r,Rt.worldScissorTest=!0,e=Rt.height-e-r,Ct.mainContext.scissor(t,e,i,r),Ct.mainContext.enable(3089),this.context.submitElement(this.submitIndex,this.submitIndex+this.submitLength),a?(e=Rt.height-this.screenRect.y-this.screenRect.height,Ct.mainContext.scissor(this.screenRect.x,e,this.screenRect.width,this.screenRect.height),Ct.mainContext.enable(3089)):(Ct.mainContext.disable(3089),Rt.worldScissorTest=!1),s.copyFrom(this.screenRect),!0},t._scissorWithTagart=function(t,e,i,r){if(i<1||r<1)return!1;var s=t+i,n=e+r;t<0&&(i=s-(t=0)),e<0&&(r=n-(e=0));var a=Rt.worldClipRect;if(t=Math.max(t,a.x),e=Math.max(e,a.y),i=Math.min(s,a.right)-t,r=Math.min(n,a.bottom)-e,i<1||r<1)return!1;n=Rt.worldScissorTest;return this.screenRect.copyFrom(a),Rt.worldScissorTest=!0,a.x=t,a.y=e,a.width=i,a.height=r,e=Rt.height-e-r,Ct.mainContext.scissor(t,e,i,r),Ct.mainContext.enable(3089),this.context.submitElement(this.submitIndex,this.submitIndex+this.submitLength),n?(e=Rt.height-this.screenRect.y-this.screenRect.height,Ct.mainContext.scissor(this.screenRect.x,e,this.screenRect.width,this.screenRect.height),Ct.mainContext.enable(3089)):(Ct.mainContext.disable(3089),Rt.worldScissorTest=!1),a.copyFrom(this.screenRect),!0},t.renderSubmit=function(){return this.submitLength=Math.min(this.context._submits._length-1,this.submitLength),this.submitLength<1||this.clipRect.width<1||this.clipRect.height<1||(this.context._targets?this._scissorWithTagart(this.clipRect.x,this.clipRect.y,this.clipRect.width,this.clipRect.height):this._scissor(this.clipRect.x,this.clipRect.y,this.clipRect.width,this.clipRect.height)),this.submitLength+1},t.getRenderType=function(){return 0},t.releaseRender=function(){var t=i._cache;(t[t._length++]=this).context=null},i.create=function(t){var e=i._cache._length?i._cache[--i._cache._length]:new i;return e.context=t,e},i._cache=((i._cache=[])._length=0,i._cache),i}(),mt=function(){function h(){this.step=0,this.blendMode=null,this.level=0}l(h,"laya.webgl.submit.SubmitStencil");var t=h.prototype;return x.imps(t,{"laya.webgl.submit.ISubmit":!0}),t.renderSubmit=function(){switch(this.step){case 1:this.do1();break;case 2:this.do2();break;case 3:this.do3();break;case 4:this.do4();break;case 5:this.do5();break;case 6:this.do6();break;case 7:this.do7();break;case 8:this.do8()}return 1},t.getRenderType=function(){return 0},t.releaseRender=function(){var t=h._cache;t[t._length++]=this},t.do1=function(){var t=Ct.mainContext;t.enable(2960),t.clear(1024),t.colorMask(!1,!1,!1,!1),t.stencilFunc(514,this.level,255),t.stencilOp(7680,7680,7682)},t.do2=function(){var t=Ct.mainContext;t.stencilFunc(514,this.level+1,255),t.colorMask(!0,!0,!0,!0),t.stencilOp(7680,7680,7680)},t.do3=function(){var t=Ct.mainContext;t.colorMask(!0,!0,!0,!0),t.stencilOp(7680,7680,7680),t.clear(1024),t.disable(2960)},t.do4=function(){var t=Ct.mainContext;0==this.level&&(t.enable(2960),t.clear(1024)),t.colorMask(!1,!1,!1,!1),t.stencilFunc(519,0,255),t.stencilOp(7680,7680,7682)},t.do5=function(){var t=Ct.mainContext;t.stencilFunc(514,this.level,255),t.colorMask(!0,!0,!0,!0),t.stencilOp(7680,7680,7680)},t.do6=function(){var t=Ct.mainContext;G.targetFns[G.TOINT[this.blendMode]](t)},t.do7=function(){var t=Ct.mainContext;t.colorMask(!1,!1,!1,!1),t.stencilOp(7680,7680,7683)},t.do8=function(){var t=Ct.mainContext;t.colorMask(!0,!0,!0,!0),t.stencilFunc(514,this.level,255),t.stencilOp(7680,7680,7680)},h.restore=function(t,e,i,r,s){var n,a;(t._renderKey=0)<h._mask&&h._mask--,0==h._mask?(n=laya.webgl.submit.SubmitStencil.create(3),t.addRenderObject(n),t._curSubmit=ut.RENDERBASE):(n=laya.webgl.submit.SubmitStencil.create(7),t.addRenderObject(n),(a=t._vb)._byteLength,At.fillRectImgVb(a,null,e.x,e.y,e.width,e.height,P.DEF_UV,i,r,s,0,0)?(t._shader2D.glTexture=null,(a=t._curSubmit=ut.createSubmit(t,t._ib,a,(a._byteLength-64)/32*3,Nt.create(2,0))).shaderValue.ALPHA=1,t._submits[t._submits._length++]=a,t._curSubmit._numEle+=6,t._curSubmit=ut.RENDERBASE):alert("clipRect calc stencil rect error"),n=laya.webgl.submit.SubmitStencil.create(8),t.addRenderObject(n))},h.restore2=function(t,e){var i;(t._renderKey=0)<h._mask&&h._mask--,0==h._mask?(i=laya.webgl.submit.SubmitStencil.create(3),t.addRenderObject(i),t._curSubmit=ut.RENDERBASE):(i=laya.webgl.submit.SubmitStencil.create(7),t.addRenderObject(i),t._submits[t._submits._length++]=e,i=laya.webgl.submit.SubmitStencil.create(8),t.addRenderObject(i))},h.create=function(t){var e=h._cache._length?h._cache[--h._cache._length]:new h;return 5==(e.step=t)&&++h._mask,e.level=h._mask,e},h._cache=((h._cache=[])._length=0,h._cache),h._mask=0,h}(),pt=function(){function h(){this._renderType=0,this._vb=null,this._ib=null,this._startIdx=0,this._numEle=0,this.shaderValue=null,this.blendType=0,this.proName=null,this.scope=null}l(h,"laya.webgl.submit.SubmitTarget");var t=h.prototype;return x.imps(t,{"laya.webgl.submit.ISubmit":!0}),t.renderSubmit=function(){this._vb.bind_upload(this._ib);var t=this.scope.getValue(this.proName);return t&&(this.shaderValue.texture=t.source,this.shaderValue.strength&&!this.shaderValue.blurInfo&&(this.shaderValue.blurInfo=[t.width,t.height]),this.shaderValue.upload(),this.blend(),I.drawCall++,I.trianglesFaces+=this._numEle/3,Ct.mainContext.drawElements(4,this._numEle,5123,this._startIdx)),1},t.blend=function(){var t;G.activeBlendFunction!==G.fns[this.blendType]&&((t=Ct.mainContext).enable(3042),G.fns[this.blendType](t),G.activeBlendFunction=G.fns[this.blendType])},t.getRenderType=function(){return 0},t.releaseRender=function(){var t=h._cache;t[t._length++]=this},h.create=function(t,e,i,r,s,n){var a=h._cache._length?h._cache[--h._cache._length]:new h;return a._ib=e,a._vb=i,a.proName=n,a._startIdx=r*yt.BYTES_PIDX,a._numEle=0,a.blendType=t._nBlendType,a.shaderValue=s,a.shaderValue.setValue(t._shader2D),a},h._cache=((h._cache=[])._length=0,h._cache),h}(),gt=function(){function t(){this._sourceStr=null}l(t,"laya.webgl.text.CharSegment");var e=t.prototype;return x.imps(e,{"laya.webgl.text.ICharSegment":!0}),e.textToSpit=function(t){this._sourceStr=t},e.getChar=function(t){return this._sourceStr.charAt(t)},e.getCharCode=function(t){return this._sourceStr.charCodeAt(t)},e.length=function(){return this._sourceStr.length},t}(),xt=(l(vt,"laya.webgl.text.DrawText"),vt.__init__=function(){vt._charsTemp=new Array,vt._drawValue=new ot,vt._charSeg=new gt},vt.customCharSeg=function(t){vt._charSeg=t},vt.getChar=function(t,e,i){i=oe.createOneChar(t,i);return-1!=e&&(vt._charsCache[e]=i),i},vt._drawSlow=function(t,e,i,r,s,n,a,h,l,o,u,_,c,d,f){var m,p,g=vt._drawValue.value(n,h,l,o,c,d,f),x=0,v=0,b=vt._charsTemp,y=0,T=NaN;if(r)for(b.length=r.length,x=0,v=r.length;x<v;x++)T=(p=r[x]).charNum+g.txtID,b[x]=m=vt._charsCache[T]||vt.getChar(p.char,T,g),m.active();else{f=i instanceof laya.utils.WordText?i.toString():i;if(L.CharacterCache){vt._charSeg.textToSpit(f);for(i=vt._charSeg.length(),x=0,v=b.length=i;x<v;x++)T=vt._charSeg.getCharCode(x)+g.txtID,b[x]=m=vt._charsCache[T]||vt.getChar(vt._charSeg.getChar(x),T,g),m.active(),y+=m.cw}else b.length=0,(m=vt.getChar(f,-1,g)).active(),y+=m.cw,b[0]=m}var A=0;null!==a&&"left"!==a&&(A=-("center"==a?y/2:y));var E,S,w=NaN,R=0;if(r)for(x=0,v=b.length;x<v;x++)(m=b[x]).isSpace||(p=r[x],w=m.borderSize,E=m.texture,e._drawText(E,u+A+p.x*c-w,_+p.y*d-w,E.width,E.height,s,0,0,0,0));else{for(x=0,v=b.length;x<v;x++)(m=b[x]).isSpace||(w=m.borderSize,E=m.texture,e._drawText(E,u+A-w,_-w,E.width,E.height,s,0,0,0,0),t&&((S=(S=t[R++])||(t[R-1]=[]))[0]=E,S[1]=A-w,S[2]=-w)),A+=m.cw;t&&(t.length=R)}},vt._drawFast=function(t,e,i,r,s){for(var n,a,h=0,l=t.length;h<l;h++)(n=(a=t[h])[0]).active(),e._drawText(n,r+a[1],s+a[2],n.width,n.height,i,0,0,0,0)},vt.drawText=function(t,e,i,r,s,n,a,h,l,o,u,_){var c,d,f,m,p,g;void 0===_&&(_=0),e&&0===e.length||i&&0===i.length||(c=r.a,d=r.d,!(!(1!==(c=0!==r.b||0!==r.c?d=1:c)||1!==d)||!x.stage.transform)&&((m=x.stage.transform).a===c&&m.d===d)?(f=(r=r.copyTo(Bt._tmpMatrix)).tx,m=r.ty,r.scale(1/c,1/d),r._checkTransform(),o*=c,u*=d,o+=f-r.tx,u+=m-r.ty):c=d=1,i?vt._drawSlow(null,t,e,i,r,s,n,a,h,l,o,u,c,d,_):null!==e.toUpperCase?(p=e+s.toString()+a+h+l+c+d+n,g=vt._textsCache[p],L.CharacterCache?g?vt._drawFast(g,t,r,o,u):(vt._textsCache.__length||(vt._textsCache.__length=0),vt._textsCache.__length>v.WebGLTextCacheCount&&((vt._textsCache={}).__length=0,vt._curPoolIndex=0),vt._textCachesPool[vt._curPoolIndex]?(g=vt._textsCache[p]=vt._textCachesPool[vt._curPoolIndex]).length=0:vt._textCachesPool[vt._curPoolIndex]=g=vt._textsCache[p]=[],vt._textsCache.__length++,vt._curPoolIndex++,vt._drawSlow(g,t,e,i,r,s,n,a,h,l,o,u,c,d,_)):vt._drawSlow(g,t,e,i,r,s,n,a,h,l,o,u,c,d,_)):(p=c+1e5*d,(g=e).changed||g.id!==p?(g.id=p,g.changed=!1,vt._drawSlow(g.save,t,e,i,r,s,n,a,h,l,o,u,c,d,_)):vt._drawFast(g.save,t,r,o,u)))},vt._charsTemp=null,vt._textCachesPool=[],vt._curPoolIndex=0,vt._charsCache={},vt._textsCache={},vt._drawValue=null,vt.d=[],vt._charSeg=null,vt.__init$=function(){function h(){}l(h,""),h.prototype.value=function(t,e,i,r,s,n,a){this.font=t,this.fillColor=e,this.borderColor=i,this.lineWidth=r,this.scaleX=s,this.scaleY=n,this.underLine=a;a=t.toString()+s+n+r+e+i+a;return this.txtID=h._keymap[a],this.txtID||(this.txtID=1e-7*++h._keymapCount,h._keymap[a]=this.txtID),this},h.clear=function(){h._keymap={},h._keymapCount=1},h._keymap={},h._keymapCount=1,ot=h},vt);function vt(){}var bt=function(){function s(t){this._index=0,this._size=14,this._italic=-2,s._cache2=s._cache2||[],this.setFont(t||"14px Arial")}l(s,"laya.webgl.text.FontInContext");var t=s.prototype;return t.setFont=function(t){var e=s._cache2[t];if(e)this._words=e[0],this._size=e[1];else{this._words=t.split(" ");for(var i=0,r=this._words.length;i<r;i++)if(0<this._words[i].indexOf("px")){this._index=i;break}this._size=parseInt(this._words[this._index]),s._cache2[t]=[this._words,this._size]}this._text=null,this._italic=-2},t.getItalic=function(){return-2===this._italic&&(this._italic=this.hasType("italic")),this._italic},t.hasType=function(t){for(var e=0,i=this._words.length;e<i;e++)if(this._words[e]===t)return e;return-1},t.removeType=function(t){for(var e=0,i=this._words.length;e<i;e++)if(this._words[e]===t){this._words.splice(e,1),this._index>e&&this._index--;break}this._text=null,this._italic=-2},t.copyTo=function(t){return t._text=this._text,t._size=this._size,t._index=this._index,t._words=this._words.slice(),t._italic=-2,t},t.toString=function(){return this._text||(this._text=this._words.join(" "))},a(0,t,"size",function(){return this._size},function(t){this._size=t,this._words[this._index]=t+"px",this._text=null}),s.create=function(t){var e=s._cache[t];return e=e||(s._cache[t]=new s(t))},s.EMPTY=new s,s._cache={},s._cache2=null,s}(),yt=(l(Tt,"laya.webgl.utils.CONST3D2D"),Tt.defaultMatrix4=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Tt.defaultMinusYMatrix4=[1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1],Tt.uniformMatrix3=[1,0,0,0,0,1,0,0,0,0,1,0],Tt._TMPARRAY=[],Tt._OFFSETX=0,Tt._OFFSETY=0,e(Tt,["BYTES_PE",function(){return this.BYTES_PE=Float32Array.BYTES_PER_ELEMENT},"BYTES_PIDX",function(){return this.BYTES_PIDX=Uint16Array.BYTES_PER_ELEMENT}]),Tt);function Tt(){}var At=(l(Et,"laya.webgl.utils.GlUtils"),Et.make2DProjection=function(t,e,i){return[2/t,0,0,0,0,-2/e,0,0,0,0,2/i,0,-1,1,0,1]},Et.fillIBQuadrangle=function(t,e){if(65535/4<e)throw Error("IBQuadrangle count:"+e+" must<:"+Math.floor(65535/4));e=Math.floor(e),t._resizeBuffer(6*(e+1)*2,!1),t.byteLength=t.bufferLength;for(var i=t.getUint16Array(),r=0,s=0;s<e;s++)i[r++]=4*s,i[r++]=4*s+2,i[r++]=4*s+1,i[r++]=4*s,i[r++]=4*s+3,i[r++]=4*s+2;return t.setNeedUpload(),!0},Et.expandIBQuadrangle=function(t,e){t.bufferLength>=6*e*2||Et.fillIBQuadrangle(t,e)},Et.mathCeilPowerOfTwo=function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},Et.fillQuadrangleImgVb=function(t,e,i,r,s,n,a,h){var l=16+(t._byteLength>>2);t.byteLength=l<<2;var o=t.getFloat32Array();o[2+(l-=16)]=s[0],o[3+l]=s[1],o[6+l]=s[2],o[7+l]=s[3],o[10+l]=s[4],o[11+l]=s[5],o[14+l]=s[6],o[15+l]=s[7];var u,_=n.a,c=n.b,d=n.c,f=n.d;return 1!==_||0!==c||0!==d||1!==f?(n.bTransform=!0,u=n.tx+a,s=n.ty+h,o[l]=(r[0]+e)*_+(r[1]+i)*d+u,o[1+l]=(r[0]+e)*c+(r[1]+i)*f+s,o[4+l]=(r[2]+e)*_+(r[3]+i)*d+u,o[5+l]=(r[2]+e)*c+(r[3]+i)*f+s,o[8+l]=(r[4]+e)*_+(r[5]+i)*d+u,o[9+l]=(r[4]+e)*c+(r[5]+i)*f+s,o[12+l]=(r[6]+e)*_+(r[7]+i)*d+u,o[13+l]=(r[6]+e)*c+(r[7]+i)*f+s):(n.bTransform=!1,e+=n.tx+a,i+=n.ty+h,o[l]=e+r[0],o[1+l]=i+r[1],o[4+l]=e+r[2],o[5+l]=i+r[3],o[8+l]=e+r[4],o[9+l]=i+r[5],o[12+l]=e+r[6],o[13+l]=i+r[7]),t._upload=!0},Et.fillTranglesVB=function(t,e,i,r,s,n,a){var h=(t._byteLength>>2)+r.length;t.byteLength=h<<2;var l=t.getFloat32Array();h-=r.length;for(var o,u,_=r.length,c=s.a,d=s.b,f=s.c,m=s.d,p=0;p<_;p+=4)l[h+p+2]=r[p+2],l[h+p+3]=r[p+3],1!==c||0!==d||0!==f||1!==m?(s.bTransform=!0,o=s.tx+n,u=s.ty+a,l[h+p]=(r[p]+e)*c+(r[p+1]+i)*f+o,l[h+p+1]=(r[p]+e)*d+(r[p+1]+i)*m+u):(s.bTransform=!1,e+=s.tx+n,i+=s.ty+a,l[h+p]=e+r[p],l[h+p+1]=i+r[p+1]);return t._upload=!0},Et.copyPreImgVb=function(t,e,i){var r=t._byteLength>>2;t.byteLength=r+16<<2;for(var s=t.getFloat32Array(),n=0,a=r-16;n<4;n++)s[r]=s[a]+e,s[++r]=s[++a]+i,s[++r]=s[++a],s[++r]=s[++a],++r,++a;t._upload=!0},Et.fillRectImgVb=function(t,e,i,r,s,n,a,h,l,o,u,_,c){void 0===c&&(c=!1);var d,f,m,p,g,x,v,b,y,T,A,E,S=1,w=h.a,R=h.b,I=h.c,M=h.d,C=e&&e.width<99999999;if(1!==w||0!==R||0!==I||1!==M?(h.bTransform=!0,0===R&&0===I&&(S=23,d=w*i+(B=h.tx+l),m=w*(D=s+i)+B,f=M*r+(N=h.ty+o),p=M*(F=n+r)+N)):(h.bTransform=!(S=23),m=(d=i+h.tx+l)+s,p=(f=r+h.ty+o)+n),C&&(g=e.x,x=e.y,v=e.width+g,b=e.height+x),1!==S){if(Math.min(d,m)>=v)return!1;if(Math.min(f,p)>=b)return!1;if(Math.max(m,d)<=g)return!1;if(Math.max(p,f)<=x)return!1}var L=t._byteLength>>2;t.byteLength=16+L<<2;var P=t.getFloat32Array();switch(P[2+L]=a[0],P[3+L]=a[1],P[6+L]=a[2],P[7+L]=a[3],P[10+L]=a[4],P[11+L]=a[5],P[14+L]=a[6],P[15+L]=a[7],S){case 1:var D,F,B=h.tx+l,N=h.ty+o,O=w*i,V=I*r,U=M*r,k=R*i,H=w*(D=s+i),G=I*(F=n+r),z=M*F,W=R*D;c?(y=O+V+B,A=Math.round(y)-y,T=U+k+N,E=Math.round(T)-T,P[L]=y+A,P[1+L]=T+E,P[4+L]=H+V+B+A,P[5+L]=U+W+N+E,P[8+L]=H+G+B+A,P[9+L]=z+W+N+E,P[12+L]=O+G+B+A,P[13+L]=z+k+N+E):(P[L]=O+V+B,P[1+L]=U+k+N,P[4+L]=H+V+B,P[5+L]=U+W+N,P[8+L]=H+G+B,P[9+L]=z+W+N,P[12+L]=O+G+B,P[13+L]=z+k+N);break;case 23:c?(y=d+u,A=Math.round(y)-y,T=f,E=Math.round(T)-T,P[L]=y+A,P[1+L]=T+E,P[4+L]=m+u+A,P[5+L]=f+E,P[8+L]=m+A,P[9+L]=p+E,P[12+L]=d+A,P[13+L]=p+E):(P[L]=d+u,P[1+L]=f,P[4+L]=m+u,P[5+L]=f,P[8+L]=m,P[9+L]=p,P[12+L]=d,P[13+L]=p)}return t._upload=!0},Et.fillLineVb=function(t,e,i,r,s,n,a,h){var l=.5*a,o=Et._fillLineArray,u=-(r-n),_=i-s,a=Math.sqrt(u*u+_*_);u/=a,_/=a,_*=l,o[0]=i-(u*=l),o[1]=r-_,o[4]=i+u,o[5]=r+_,o[8]=s+u,o[9]=n+_,o[12]=s-u,o[13]=n-_,h&&h.transformPointArray(o,o);h=16+(t._byteLength>>2);return t.byteLength=h<<2,t.insertData(o,h-16),!0},Et._fillLineArray=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Et);function Et(){}l(St,"laya.webgl.utils.MatirxArray"),St.ArrayMul=function(t,e,i){if(t)if(e)for(var r,s,n,a,h=0;h<4;h++)r=t[h],s=t[h+4],n=t[h+8],a=t[h+12],i[h]=r*e[0]+s*e[1]+n*e[2]+a*e[3],i[h+4]=r*e[4]+s*e[5]+n*e[6]+a*e[7],i[h+8]=r*e[8]+s*e[9]+n*e[10]+a*e[11],i[h+12]=r*e[12]+s*e[13]+n*e[14]+a*e[15];else St.copyArray(t,i);else St.copyArray(e,i)},St.copyArray=function(t,e){if(t&&e)for(var i=0;i<t.length;i++)e[i]=t[i]};function St(){}var wt=function(){function e(t,e,i){this._stride=0,this.vertNum=0,this.indexNum=0,this._applied=!1,this._vb=null,this._ib=null,this._vao=null,this._attribInfo=null,this._quadNum=0,this.canReuse=!1,this._stride=t,this._vb=new ge(t,35048),e&&this._vb._resizeBuffer(e,!1),this._ib=new pe,i&&this._ib._resizeBuffer(i,!1)}l(e,"laya.webgl.utils.Mesh2D");var t=e.prototype;return t.cloneWithNewVB=function(){var t=new e(this._stride,0,0);return t._ib=this._ib,t._quadNum=this._quadNum,t._attribInfo=this._attribInfo,t},t.cloneWithNewVBIB=function(){var t=new e(this._stride,0,0);return t._attribInfo=this._attribInfo,t},t.getVBW=function(){return this._vb.setNeedUpload(),this._vb},t.getVBR=function(){return this._vb},t.getIBR=function(){return this._ib},t.getIBW=function(){return this._ib.setNeedUpload(),this._ib},t.createQuadIB=function(t){this._quadNum=t,this._ib._resizeBuffer(6*t*2,!1),this._ib.byteLength=this._ib.bufferLength;for(var e=this._ib.getUint16Array(),i=0,r=0,s=0;s<t;s++)e[i++]=r,e[i++]=r+2,e[i++]=r+1,e[i++]=r,e[i++]=r+3,e[i++]=r+2,r+=4;this._ib.setNeedUpload()},t.setAttributes=function(t){if(this._attribInfo=t,this._attribInfo.length%3!=0)throw"Mesh2D setAttributes error!"},t.getEleNum=function(){return this._ib.getBuffer().byteLength/2},t.releaseMesh=function(){},t.destroy=function(){},t.clearVB=function(){this._vb.clear()},e._gvaoid=0,e}(),Rt=(l(It,"laya.webgl.utils.RenderState2D"),It.getMatrArray=function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},It.mat2MatArray=function(t,e){var i=t,t=e;return t[0]=i.a,t[1]=i.b,t[2]=It.EMPTYMAT4_ARRAY[2],t[3]=It.EMPTYMAT4_ARRAY[3],t[4]=i.c,t[5]=i.d,t[6]=It.EMPTYMAT4_ARRAY[6],t[7]=It.EMPTYMAT4_ARRAY[7],t[8]=It.EMPTYMAT4_ARRAY[8],t[9]=It.EMPTYMAT4_ARRAY[9],t[10]=It.EMPTYMAT4_ARRAY[10],t[11]=It.EMPTYMAT4_ARRAY[11],t[12]=i.tx,t[13]=i.ty,t[14]=It.EMPTYMAT4_ARRAY[14],t[15]=It.EMPTYMAT4_ARRAY[15],e},It.restoreTempArray=function(){It.TEMPMAT4_ARRAY[0]=1,It.TEMPMAT4_ARRAY[1]=0,It.TEMPMAT4_ARRAY[4]=0,It.TEMPMAT4_ARRAY[5]=1,It.TEMPMAT4_ARRAY[12]=0,It.TEMPMAT4_ARRAY[13]=0},It.clear=function(){It.worldScissorTest=!1,It.worldShaderDefines=null,It.worldFilters=null,It.worldAlpha=1,It.worldClipRect.x=It.worldClipRect.y=0,It.worldClipRect.width=It.width,It.worldClipRect.height=It.height,It.curRenderTarget=null},It._MAXSIZE=99999999,It.EMPTYMAT4_ARRAY=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],It.worldMatrix4=It.TEMPMAT4_ARRAY=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],It.worldAlpha=1,It.worldScissorTest=!1,It.worldFilters=null,It.worldShaderDefines=null,It.curRenderTarget=null,It.width=0,It.height=0,e(It,["worldMatrix",function(){return this.worldMatrix=new y},"worldClipRect",function(){return this.worldClipRect=new A(0,0,99999999,99999999)}]),It);function It(){}var Mt=function(){var g,i;function x(t,e,i,r,s){var n=this;function a(t){var e=[],i=new g(e);return n._compileToTree(i,t.split("\n"),0,e,s),i}var h=o.now();this._VS=a(e),this._PS=a(i),this._nameMap=r,2<o.now()-h&&console.log("ShaderCompile use time:"+(o.now()-h)+" size:"+e.length+"/"+i.length)}l(x,"laya.webgl.utils.ShaderCompile");var t=x.prototype;return t._compileToTree=function(t,e,i,r,s){for(var n,a,h,l,o,u,_=0,c=0,d=0,c=i;c<e.length;c++)if(!((h=e[c]).length<1)&&0!==(_=h.indexOf("//"))){if(0<=_&&(h=h.substr(0,_)),n=o||new g(r),o=null,n.text=h,n.noCompile=!0,0<=(_=h.indexOf("#"))){for(l="#",d=_+1,u=h.length;d<u;d++){var f=h.charAt(d);if(" "===f||"\t"===f||"?"===f)break;l+=f}switch(n.name=l){case"#ifdef":case"#ifndef":if(n.src=h,n.noCompile=null!=h.match(/[!&|()=<>]/),n.noCompile?console.log("function():Boolean{return "+h.substr(_+n.name.length)+"}"):(m=h.replace(/^\s*/,"").split(/\s+/),n.setCondition(m[1],"#ifdef"===l?1:2),n.text="//"+n.text),n.setParent(t),t=n,s)for(m=h.substr(d).split(x._splitToWordExps3),d=0;d<m.length;d++)(h=m[d]).length&&(s[h]=!0);continue;case"#if":if(n.src=h,n.noCompile=!0,n.setParent(t),t=n,s)for(m=h.substr(d).split(x._splitToWordExps3),d=0;d<m.length;d++)(h=m[d]).length&&"defined"!=h&&(s[h]=!0);continue;case"#else":n.src=h,a=(t=t.parent).childs[t.childs.length-1],n.noCompile=a.noCompile,n.noCompile||(n.condition=a.condition,n.conditionType=1==a.conditionType?2:1,n.text="//"+n.text+" "+a.text+" "+n.conditionType),n.setParent(t),t=n;continue;case"#endif":a=(t=t.parent).childs[t.childs.length-1],n.noCompile=a.noCompile,n.noCompile||(n.text="//"+n.text),n.setParent(t);continue;case"#include":var m=x.splitToWords(h,null),p=x.includes[m[1]];if(!p)throw"ShaderCompile error no this include file:"+m[1];if((_=m[0].indexOf("?"))<0){n.setParent(t),h=p.getWith("with"==m[2]?m[3]:null),this._compileToTree(n,h.split("\n"),0,r,s),n.text="";continue}n.setCondition(m[0].substr(_+1),1),n.text=p.getWith("with"==m[2]?m[3]:null);break;case"#import":p=(m=x.splitToWords(h,null))[1],r.push({node:n,file:x.includes[p],ofs:n.text.length});continue}}else{if((a=t.childs[t.childs.length-1])&&!a.name){0<r.length&&x.splitToWords(h,a),o=n,a.text+="\n"+h;continue}0<r.length&&x.splitToWords(h,n)}n.setParent(t)}},t.createShader=function(t,e,i){var r={},s="";if(t)for(var n in t)s+="#define "+n+"\n",r[n]=!0;var a=this._VS.toscript(r,[]),t=this._PS.toscript(r,[]);return(i||ce.create)(s+a.join("\n"),s+t.join("\n"),e,this._nameMap)},x._parseOne=function(t,e,i,r,s,n){var a={type:x.shaderParamsMap[i[r+1]],name:i[r+2],size:isNaN(parseInt(i[r+3]))?1:parseInt(i[r+3])};return n&&("attribute"==s?t:e).push(a),":"==i[r+3]&&(a.type=i[r+4],r+=2),r+=2},x.addInclude=function(t,e){if(!e||0===e.length)throw new Error("add shader include file err:"+t);if(x.includes[t])throw new Error("add shader include file err, has add:"+t);x.includes[t]=new i(e)},x.preGetParams=function(t,e){var i=[t,e],e={},r=[],s=[],n={},a=[];e.attributes=r,e.uniforms=s,e.defines=n;for(var h=0,l=0;l<2;l++){i[l]=i[l].replace(x._removeAnnotation,"");for(var o=i[l].match(x._reg),h=0,u=o.length;h<u;h++){var _=o[h];if("attribute"==_||"uniform"==_)h=x._parseOne(r,s,o,h,_,!0);else if("#define"!=_){if("#ifdef"==_){var c;n[c=o[++h]]=n[c]||[];for(h++;h<u;h++)if("attribute"==(_=o[h])||"uniform"==_)h=x._parseOne(r,s,o,h,_,a[c]);else if("#else"==_)for(h++;h<u;h++)if("attribute"==(_=o[h])||"uniform"==_)h=x._parseOne(r,s,o,h,_,!a[c]);else if("#endif"==_)break}}else a[_=o[++h]]=1}}return e},x.splitToWords=function(t,e){for(var i,r=[],s=-1,n=0,a=t.length;n<a;n++)if(h=t.charAt(n),0<=" \t=+-*/&%!<>()'\",;".indexOf(h))if(0<=s&&1<n-s&&(i=t.substr(s,n-s),r.push(i)),'"'!=h&&"'"!=h)"("==h&&e&&0<r.length&&(i=r[r.length-1]+";","vec4;main;".indexOf(i)<0&&(e.useFuns+=i)),s=-1;else{var h=t.indexOf(h,n+1);if(h<0)throw"Sharder err:"+t;r.push(t.substr(n+1,h-n-1)),n=h,s=-1}else s<0&&(s=n);return s<a&&1<a-s&&(i=t.substr(s,a-s),r.push(i)),r},x.IFDEF_NO=0,x.IFDEF_YES=1,x.IFDEF_ELSE=2,x.IFDEF_PARENT=3,x._removeAnnotation=new RegExp("(/\\*([^*]|[\\r\\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/)|(//.*)","g"),x._reg=new RegExp("(\".*\")|('.*')|([#\\w\\*-\\.+/()=<>{}\\\\]+)|([,;:\\\\])","g"),x._splitToWordExps=new RegExp("[(\".*\")]+|[('.*')]+|([ \\t=\\+\\-*/&%!<>!%(),;])","g"),x.includes={},e(x,["shaderParamsMap",function(){return this.shaderParamsMap={float:5126,int:5124,bool:35670,vec2:35664,vec3:35665,vec4:35666,ivec2:35667,ivec3:35668,ivec4:35669,bvec2:35671,bvec3:35672,bvec4:35673,mat2:35674,mat3:35675,mat4:35676,sampler2D:35678,samplerCube:35680}},"_splitToWordExps3",function(){return this._splitToWordExps3=new RegExp("[ \\t=\\+\\-*/&%!<>!%(),;\\|]","g")}]),x.__init$=function(){g=function(){function i(t){this.childs=[],this.text="",this.parent=null,this.name=null,this.noCompile=!1,this.includefiles=null,this.condition=null,this.conditionType=0,this.useFuns="",this.z=0,this.src=null,this.includefiles=t}l(i,"");var t=i.prototype;return t.setParent=function(t){t.childs.push(this),this.z=t.z+1,this.parent=t},t.setCondition=function(t,e){t&&(this.conditionType=e,t=t.replace(/(\s*$)/g,""),this.condition=function(){return this[t]},this.condition.__condition=t)},t.toscript=function(t,e){return this._toscript(t,e,++i.__id)},t._toscript=function(r,s,n){if(this.childs.length<1&&!this.text)return s;s.length;if(this.condition){var t=!!this.condition.call(r);if(!(t=2===this.conditionType?!t:t))return s}if(this.text&&s.push(this.text),0<this.childs.length&&this.childs.forEach(function(t,e,i){t._toscript(r,s,n)}),0<this.includefiles.length&&0<this.useFuns.length)for(var e,i=0,a=this.includefiles.length;i<a;i++)this.includefiles[i].curUseID!=n&&0<(e=this.includefiles[i].file.getFunsScript(this.useFuns)).length&&(this.includefiles[i].curUseID=n,s[0]=e+s[0]);return s},i.__id=1,i}(),i=function(){function t(t){this.script=null,this.codes={},this.funs={},this.curUseID=-1,this.funnames="",this.script=t;for(var e=0,i=0,r=0;!((e=t.indexOf("#begin",e))<0);){for(r=e+5;!((r=t.indexOf("#end",r))<0)&&"i"===t.charAt(r+4);)r+=5;if(r<0)throw"add include err,no #end:"+t;var i=t.indexOf("\n",e),s=x.splitToWords(t.substr(e,i-e),null);"code"==s[1]?this.codes[s[2]]=t.substr(i+1,r-i-1):"function"==s[1]&&(i=t.indexOf("function",e),i+="function".length,this.funs[s[3]]=t.substr(i+1,r-i-1),this.funnames+=s[3]+";"),e=r+1}}l(t,"");var e=t.prototype;return e.getWith=function(t){var e=t?this.codes[t]:this.script;if(!e)throw"get with error:"+t;return e},e.getFunsScript=function(t){var e,i="";for(e in this.funs)0<=t.indexOf(e+";")&&(i+=this.funs[e]);return i},t}()},x}(),Ct=(l(Lt,"laya.webgl.WebGL"),Lt._uint8ArraySlice=function(){for(var t=this.length,e=new Uint8Array(this.length),i=0;i<t;i++)e[i]=this[i];return e},Lt._float32ArraySlice=function(){for(var t=this.length,e=new Float32Array(this.length),i=0;i<t;i++)e[i]=this[i];return e},Lt._uint16ArraySlice=function(t){var e,i=arguments,r=0,s=0;if(0===i.length)for(r=this.length,e=new Uint16Array(r),s=0;s<r;s++)e[s]=this[s];else if(2===i.length){var n=i[0],a=i[1];if(n<a)for(r=a-n,e=new Uint16Array(r),s=n;s<a;s++)e[s-n]=this[s];else e=new Uint16Array(0)}return e},Lt.expandContext=function(){var t=r.prototype,e=CanvasRenderingContext2D.prototype;e.fillTrangles=t.fillTrangles,de.__int__(null),e.setIBVB=function(t,e,i,r,s,n,a,h,l,o){void 0===l&&(l=0),void 0===o&&(o=0),null===i&&(this._ib=this._ib||pe.QuadrangleIB,i=this._ib,At.expandIBQuadrangle(i,r._byteLength/64+8)),this._setIBVB(t,e,i,r,s,n,a,h,l,o)},e.fillTrangles=function(t,e,i,r,s){this._curMat=this._curMat||y.create(),this._vb=this._vb||ge.create(),this._ib||(this._ib=pe.create(),At.fillIBQuadrangle(this._ib,a/4));var n=this._vb,a=r.length>>4;At.fillTranglesVB(n,e,i,r,s||this._curMat,0,0),At.expandIBQuadrangle(this._ib,n._byteLength/64+8);r=new Nt(1,0);r.textureHost=t;t=new me("attribute vec2 position; attribute vec2 texcoord; uniform vec2 size; uniform mat4 mmat; varying vec2 v_texcoord; void main() { vec4 p=vec4(position.xy,0.0,1.0);vec4 pos=mmat*p; gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0); v_texcoord = texcoord; }","precision mediump float; varying vec2 v_texcoord; uniform sampler2D texture; void main() {vec4 color= texture2D(texture, v_texcoord); color.a*=1.0; gl_FragColor= color;}");n._vertType=3,this._setIBVB(e,i,this._ib,n,6*a,s,t,r,0,0)}},Lt.enable=function(){if(o.__init__(),p.isConchApp&&!p.isConchWebGL)return S.skinAniSprite=function(){return new it},Lt.expandContext(),!1;if(S.getWebGLContext=function(t){for(var e,i=["webgl","experimental-webgl","webkit-3d","moz-webgl"],r=0;r<i.length;r++){try{e=t.getContext(i[r],{stencil:v.isStencil,alpha:v.isAlpha,antialias:v.isAntialias,premultipliedAlpha:v.premultipliedAlpha,preserveDrawingBuffer:v.preserveDrawingBuffer})}catch(t){}if(e)return e}return null},null==(Lt.mainContext=S.getWebGLContext(p._mainCanvas)))return!1;if(p.isWebGL)return!0;f.create=function(t,e){return new xe(t,e)},m.create=function(t,e,i,r,s,n,a){return new _e(t,e,i,r,s,n,a)},p.WebGL=Lt,p.isWebGL=!0,xt.__init__(),S.createRenderSprite=function(t,e){return new Ot(t,e)},S.createWebGLContext2D=function(t){return new Bt(t)},S.changeWebGLSize=function(t,e){laya.webgl.WebGL.onStageResize(t,e)},S.createGraphics=function(){return new Ft};var t=S.createFilterAction;return S.createFilterAction=t||function(t){return new Vt},S.clear=function(t){Rt.worldScissorTest&&laya.webgl.WebGL.mainContext.disable(3089);var e=p.context.ctx,t=t&&(0==e._submits._length||v.preserveDrawingBuffer)?d.create(t)._color:R._wgColor;t?e.clearBG(t[0],t[1],t[2],t[3]):e.clearBG(0,0,0,0),Rt.clear()},S.addToAtlas=function(t,e){void 0===e&&(e=!1);e=t.bitmap;p.optimizeTextureMemory(t.url,t)?x.__typeof(e,"laya.webgl.resource.IMergeAtlasBitmap")&&e.allowMerageInAtlas&&e.on("recovered",t,t.addTextureToAtlas):e.enableMerageInAtlas=!1},S.isAtlas=function(t){return t instanceof laya.webgl.atlas.AtlasWebGLCanvas},U._enable(),S.beginFlush=function(){for(var t=U.instance,e=t.getAtlaserCount(),i=0;i<e;i++){var r=t.getAtlaserByIndex(i).texture;r._flashCacheImageNeedFlush&&S.flashFlushImage(r)}},S.drawToCanvas=function(t,e,i,r,s,n){(i<=0||r<=0)&&console.log("[error] canvasWidth and canvasHeight should greater than zero"),s|=0,n|=0;var a=jt.create(i|=0,r|=0,6408,5121,0,!1);a.start(),a.clear(0,0,0,0),p.context.clear(),g.renders[e]._fun(t,p.context,s,Rt.height-r+n),p.context.flush(),a.end();e=a.getData(0,0,i,r);if(a.recycle(),e.byteLength==i*r*4){t=new le;t._canvas=o.createElement("canvas"),t.size(i,r);s=t._canvas.getContext("2d");o.canvas.size(i,r);n=o.context,a=n.createImageData(i,r);return a.data.set(new Uint8ClampedArray(e.buffer)),t._imgData=a,n.putImageData(a,0,0),s.save(),s.translate(0,r),s.scale(1,-1),s.drawImage(o.canvas.source,0,0),s.restore(),t}console.log("drawToCanvas error: w:"+i+",h:"+r+",datalen:"+e.byteLength)},S.createFilterAction=function(t){var e;return e=32===t?new Vt:e},S.addTextureToAtlas=function(t){t._uvID++,U._atlasRestore++,t.bitmap.enableMerageInAtlas&&U.instance.addToAtlas(t)},S.getTexturePixels=function(t,e,i,r,s){p.context.ctx.clear();var n=new w;n.graphics.drawTexture(t,-e,-i);i=jt.create(r,s);i.start(),i.clear(0,0,0,0),n.render(p.context,0,0),p.context.ctx.flush(),i.end();for(var a,h=i.getData(0,0,r,s),l=[],o=s-1;0<=o;o--)for(var u=0;u<r;u++)l.push(h[a=4*(o*r+u)]),l.push(h[1+a]),l.push(h[2+a]),l.push(h[3+a]);return l},S.skinAniSprite=function(){return new it},c.create=function(t,e){var i=new le;return i._imgData=e,i.flipY=!1,i},b._filterStart=function(t,e,i,r,s){var n=t.getValue("bounds"),n=jt.create(n.width,n.height);n.start(),n.clear(0,0,0,0),t.addValue("src",n),t.addValue("ScissorTest",Rt.worldScissorTest),Rt.worldScissorTest&&((n=new A).copyFrom(i.ctx._clipRect),t.addValue("clipRect",n),Rt.worldScissorTest=!1,laya.webgl.WebGL.mainContext.disable(3089))},b._filterEnd=function(t,e,i,r,s){var n=t.getValue("bounds");t.getValue("src").end();n=jt.create(n.width,n.height);n.start(),n.clear(0,0,0,0),t.addValue("out",n),e._set$P("_filterCache",n),e._set$P("_isHaveGlowFilter",t.getValue("_isHaveGlowFilter"))},b._EndTarget=function(t,e){t.getValue("src").recycle(),t.getValue("out").end(),t.getValue("ScissorTest")&&(Rt.worldScissorTest=!0,laya.webgl.WebGL.mainContext.enable(3089),e.ctx.save(),t=t.getValue("clipRect"),e.ctx.clipRect(t.x,t.y,t.width,t.height))},b._useSrc=function(t){var e=t.getValue("out");e.end(),(e=t.getValue("src")).start(),e.clear(0,0,0,0)},b._endSrc=function(t){t.getValue("src").end()},b._useOut=function(t){var e=t.getValue("src");e.end(),(e=t.getValue("out")).start(),e.clear(0,0,0,0)},b._endOut=function(t){t.getValue("out").end()},b._recycleScope=function(t){t.recycle()},b._filter=function(t,e,i,r){var s=this._next;if(s){var n,a,h=t.filters,l=h.length;if(1==l&&32==h[0].type)return e.ctx.save(),e.ctx.setFilters([h[0]]),s._fun.call(s,t,e,i,r),void e.ctx.restore();var o=ct.create(),u=T.TEMP,_=e.ctx._getTransformMatrix(),c=y.create();_.copyTo(c);var d=0,f=0,m=!1,p=t._$P._filterCache||null;if(!p||t._repaint){m=t._isHaveGlowFilter(),o.addValue("_isHaveGlowFilter",m),m&&(d=50,f=25),(a=new A).copyFrom(t.getSelfBounds()),a.x+=t.x,a.y+=t.y,a.x-=t.pivotX+4,a.y-=t.pivotY+4;var g=a.x,_=a.y;if(a.width+=d+8,a.height+=d+8,u.x=a.x*c.a+a.y*c.c,u.y=a.y*c.d+a.x*c.b,a.x=u.x,a.y=u.y,u.x=a.width*c.a+a.height*c.c,u.y=a.height*c.d+a.width*c.b,a.width=u.x,a.height=u.y,a.width<=0||a.height<=0)return;p&&p.recycle(),o.addValue("bounds",a);var x=_t.create([o,t,e,0,0],b._filterStart);e.addRenderObject(x),e.ctx._renderKey=0,e.ctx._shader2D.glTexture=null;g=t.x-g+f,_=t.y-_+f;s._fun.call(s,t,e,g,_),x=_t.create([o,t,e,0,0],b._filterEnd),e.addRenderObject(x);for(var v=0;v<l;v++)0!=v&&(x=_t.create([o],b._useSrc),e.addRenderObject(x),n=Nt.create(1,0),y.TEMP.identity(),e.ctx.drawTarget(o,0,0,a.width,a.height,y.TEMP,"out",n,null,G.TOINT.overlay),x=_t.create([o],b._useOut),e.addRenderObject(x)),h[v].action.apply3d(o,t,e,0,0);x=_t.create([o,e],b._EndTarget),e.addRenderObject(x)}else{if((m=t._$P._isHaveGlowFilter||!1)&&(d=50,f=25),(a=t.getBounds()).width<=0||a.height<=0)return;a.width+=d,a.height+=d,u.x=a.x*c.a+a.y*c.c,u.y=a.y*c.d+a.x*c.b,a.x=u.x,a.y=u.y,u.x=a.width*c.a+a.height*c.c,u.y=a.height*c.d+a.width*c.b,a.width=u.x,a.height=u.y,o.addValue("out",p)}i=i-f-t.x,r=r-f-t.y,u.setTo(i,r),c.transformPoint(u),i=u.x+a.x,r=u.y+a.y,n=Nt.create(1,0),y.TEMP.identity(),e.ctx.drawTarget(o,i,r,a.width,a.height,y.TEMP,"out",n,null,G.TOINT.overlay),x=_t.create([o],b._recycleScope),e.addRenderObject(x),c.destroy()}},Float32Array.prototype.slice||(Float32Array.prototype.slice=Lt._float32ArraySlice),Uint16Array.prototype.slice||(Uint16Array.prototype.slice=Lt._uint16ArraySlice),Uint8Array.prototype.slice||(Uint8Array.prototype.slice=Lt._uint8ArraySlice),!0},Lt.onStageResize=function(t,e){null!=Lt.mainContext&&(Lt.mainContext.viewport(0,0,t,e),Rt.width=t,Rt.height=e)},Lt.onInvalidGLRes=function(){U.instance.freeAll(),t.releaseContentManagers(!0),Lt.doNodeRepaint(x.stage),Lt.mainContext.viewport(0,0,Rt.width,Rt.height),x.stage.event("devicelost")},Lt.doNodeRepaint=function(t){0==t.numChildren&&t.repaint();for(var e=0;e<t.numChildren;e++)Lt.doNodeRepaint(t.getChildAt(e))},Lt.init=function(t,e,i){Lt.mainCanvas=t,c._createContext=function(t){return new Bt(t)},le._createContext=function(t){return new Bt(t)};var r,s=laya.webgl.WebGL.mainContext;if(null!=s.getShaderPrecisionFormat?(r=s.getShaderPrecisionFormat(35633,36338),t=s.getShaderPrecisionFormat(35632,36338),Lt.shaderHighPrecision=!(!r.precision||!t.precision)):Lt.shaderHighPrecision=!1,Lt.compressAstc=s.getExtension("WEBGL_compressed_texture_astc"),Lt.compressAtc=s.getExtension("WEBGL_compressed_texture_atc"),Lt.compressEtc=s.getExtension("WEBGL_compressed_texture_etc"),Lt.compressEtc1=s.getExtension("WEBGL_compressed_texture_etc1"),Lt.compressPvrtc=s.getExtension("WEBGL_compressed_texture_pvrtc"),Lt.compressS3tc=s.getExtension("WEBGL_compressed_texture_s3tc"),Lt.compressS3tc_srgb=s.getExtension("WEBGL_compressed_texture_s3tc_srgb"),s.deleteTexture1=s.deleteTexture,s.deleteTexture=function(t){t==Pt.curBindTexValue&&(Pt.curBindTexValue=null),s.deleteTexture1(t)},Lt.onStageResize(e,i),null==Lt.mainContext)throw new Error("webGL getContext err!");C.__init__(),U.__init__(),kt.__init__(),ut.__init__(),Bt.__init__(),Nt.__init__(),J.__init__(),de.__int__(s),G._init_(s),p.isConchApp&&conch.setOnInvalidGLRes(Lt.onInvalidGLRes)},Lt.compressAstc=null,Lt.compressAtc=null,Lt.compressEtc=null,Lt.compressEtc1=null,Lt.compressPvrtc=null,Lt.compressS3tc=null,Lt.compressS3tc_srgb=null,Lt.mainCanvas=null,Lt.mainContext=null,Lt.antialias=!0,Lt.shaderHighPrecision=!1,Lt._bg_null=[0,0,0,0],Lt);function Lt(){}var Pt=(l(Dt,"laya.webgl.WebGLContext"),Dt.UseProgram=function(t){return Dt._useProgram!==t&&(Ct.mainContext.useProgram(t),Dt._useProgram=t,!0)},Dt.setDepthTest=function(t,e){e!==Dt._depthTest&&((Dt._depthTest=e)?t.enable(2929):t.disable(2929))},Dt.setDepthMask=function(t,e){e!==Dt._depthMask&&(Dt._depthMask=e,t.depthMask(e))},Dt.setDepthFunc=function(t,e){e!==Dt._depthFunc&&(Dt._depthFunc=e,t.depthFunc(e))},Dt.setBlend=function(t,e){e!==Dt._blend&&((Dt._blend=e)?t.enable(3042):t.disable(3042))},Dt.setBlendFunc=function(t,e,i){e===Dt._sFactor&&i===Dt._dFactor||(Dt._sFactor=e,Dt._dFactor=i,t.blendFunc(e,i))},Dt.setCullFace=function(t,e){e!==Dt._cullFace&&((Dt._cullFace=e)?t.enable(2884):t.disable(2884))},Dt.setFrontFace=function(t,e){e!==Dt._frontFace&&(Dt._frontFace=e,t.frontFace(e))},Dt.bindTexture=function(t,e,i){t.bindTexture(e,i),Dt.curBindTexTarget=e,Dt.curBindTexValue=i},Dt.DEPTH_BUFFER_BIT=256,Dt.STENCIL_BUFFER_BIT=1024,Dt.COLOR_BUFFER_BIT=16384,Dt.POINTS=0,Dt.LINES=1,Dt.LINE_LOOP=2,Dt.LINE_STRIP=3,Dt.TRIANGLES=4,Dt.TRIANGLE_STRIP=5,Dt.TRIANGLE_FAN=6,Dt.ZERO=0,Dt.ONE=1,Dt.SRC_COLOR=768,Dt.ONE_MINUS_SRC_COLOR=769,Dt.SRC_ALPHA=770,Dt.ONE_MINUS_SRC_ALPHA=771,Dt.DST_ALPHA=772,Dt.ONE_MINUS_DST_ALPHA=773,Dt.DST_COLOR=774,Dt.ONE_MINUS_DST_COLOR=775,Dt.SRC_ALPHA_SATURATE=776,Dt.FUNC_ADD=32774,Dt.BLEND_EQUATION=32777,Dt.BLEND_EQUATION_RGB=32777,Dt.BLEND_EQUATION_ALPHA=34877,Dt.FUNC_SUBTRACT=32778,Dt.FUNC_REVERSE_SUBTRACT=32779,Dt.BLEND_DST_RGB=32968,Dt.BLEND_SRC_RGB=32969,Dt.BLEND_DST_ALPHA=32970,Dt.BLEND_SRC_ALPHA=32971,Dt.CONSTANT_COLOR=32769,Dt.ONE_MINUS_CONSTANT_COLOR=32770,Dt.CONSTANT_ALPHA=32771,Dt.ONE_MINUS_CONSTANT_ALPHA=32772,Dt.BLEND_COLOR=32773,Dt.ARRAY_BUFFER=34962,Dt.ELEMENT_ARRAY_BUFFER=34963,Dt.ARRAY_BUFFER_BINDING=34964,Dt.ELEMENT_ARRAY_BUFFER_BINDING=34965,Dt.STREAM_DRAW=35040,Dt.STATIC_DRAW=35044,Dt.DYNAMIC_DRAW=35048,Dt.BUFFER_SIZE=34660,Dt.BUFFER_USAGE=34661,Dt.CURRENT_VERTEX_ATTRIB=34342,Dt.FRONT=1028,Dt.BACK=1029,Dt.CULL_FACE=2884,Dt.FRONT_AND_BACK=1032,Dt.BLEND=3042,Dt.DITHER=3024,Dt.STENCIL_TEST=2960,Dt.DEPTH_TEST=2929,Dt.SCISSOR_TEST=3089,Dt.POLYGON_OFFSET_FILL=32823,Dt.SAMPLE_ALPHA_TO_COVERAGE=32926,Dt.SAMPLE_COVERAGE=32928,Dt.NO_ERROR=0,Dt.INVALID_ENUM=1280,Dt.INVALID_VALUE=1281,Dt.INVALID_OPERATION=1282,Dt.OUT_OF_MEMORY=1285,Dt.CW=2304,Dt.CCW=2305,Dt.LINE_WIDTH=2849,Dt.ALIASED_POINT_SIZE_RANGE=33901,Dt.ALIASED_LINE_WIDTH_RANGE=33902,Dt.CULL_FACE_MODE=2885,Dt.FRONT_FACE=2886,Dt.DEPTH_RANGE=2928,Dt.DEPTH_WRITEMASK=2930,Dt.DEPTH_CLEAR_VALUE=2931,Dt.DEPTH_FUNC=2932,Dt.STENCIL_CLEAR_VALUE=2961,Dt.STENCIL_FUNC=2962,Dt.STENCIL_FAIL=2964,Dt.STENCIL_PASS_DEPTH_FAIL=2965,Dt.STENCIL_PASS_DEPTH_PASS=2966,Dt.STENCIL_REF=2967,Dt.STENCIL_VALUE_MASK=2963,Dt.STENCIL_WRITEMASK=2968,Dt.STENCIL_BACK_FUNC=34816,Dt.STENCIL_BACK_FAIL=34817,Dt.STENCIL_BACK_PASS_DEPTH_FAIL=34818,Dt.STENCIL_BACK_PASS_DEPTH_PASS=34819,Dt.STENCIL_BACK_REF=36003,Dt.STENCIL_BACK_VALUE_MASK=36004,Dt.STENCIL_BACK_WRITEMASK=36005,Dt.VIEWPORT=2978,Dt.SCISSOR_BOX=3088,Dt.COLOR_CLEAR_VALUE=3106,Dt.COLOR_WRITEMASK=3107,Dt.UNPACK_ALIGNMENT=3317,Dt.PACK_ALIGNMENT=3333,Dt.MAX_TEXTURE_SIZE=3379,Dt.MAX_VIEWPORT_DIMS=3386,Dt.SUBPIXEL_BITS=3408,Dt.RED_BITS=3410,Dt.GREEN_BITS=3411,Dt.BLUE_BITS=3412,Dt.ALPHA_BITS=3413,Dt.DEPTH_BITS=3414,Dt.STENCIL_BITS=3415,Dt.POLYGON_OFFSET_UNITS=10752,Dt.POLYGON_OFFSET_FACTOR=32824,Dt.TEXTURE_BINDING_2D=32873,Dt.SAMPLE_BUFFERS=32936,Dt.SAMPLES=32937,Dt.SAMPLE_COVERAGE_VALUE=32938,Dt.SAMPLE_COVERAGE_INVERT=32939,Dt.NUM_COMPRESSED_TEXTURE_FORMATS=34466,Dt.COMPRESSED_TEXTURE_FORMATS=34467,Dt.DONT_CARE=4352,Dt.FASTEST=4353,Dt.NICEST=4354,Dt.GENERATE_MIPMAP_HINT=33170,Dt.BYTE=5120,Dt.UNSIGNED_BYTE=5121,Dt.SHORT=5122,Dt.UNSIGNED_SHORT=5123,Dt.INT=5124,Dt.UNSIGNED_INT=5125,Dt.FLOAT=5126,Dt.DEPTH_COMPONENT=6402,Dt.ALPHA=6406,Dt.RGB=6407,Dt.RGBA=6408,Dt.LUMINANCE=6409,Dt.LUMINANCE_ALPHA=6410,Dt.UNSIGNED_SHORT_4_4_4_4=32819,Dt.UNSIGNED_SHORT_5_5_5_1=32820,Dt.UNSIGNED_SHORT_5_6_5=33635,Dt.FRAGMENT_SHADER=35632,Dt.VERTEX_SHADER=35633,Dt.MAX_VERTEX_ATTRIBS=34921,Dt.MAX_VERTEX_UNIFORM_VECTORS=36347,Dt.MAX_VARYING_VECTORS=36348,Dt.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661,Dt.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660,Dt.MAX_TEXTURE_IMAGE_UNITS=34930,Dt.MAX_FRAGMENT_UNIFORM_VECTORS=36349,Dt.SHADER_TYPE=35663,Dt.DELETE_STATUS=35712,Dt.LINK_STATUS=35714,Dt.VALIDATE_STATUS=35715,Dt.ATTACHED_SHADERS=35717,Dt.ACTIVE_UNIFORMS=35718,Dt.ACTIVE_ATTRIBUTES=35721,Dt.SHADING_LANGUAGE_VERSION=35724,Dt.CURRENT_PROGRAM=35725,Dt.NEVER=512,Dt.LESS=513,Dt.EQUAL=514,Dt.LEQUAL=515,Dt.GREATER=516,Dt.NOTEQUAL=517,Dt.GEQUAL=518,Dt.ALWAYS=519,Dt.KEEP=7680,Dt.REPLACE=7681,Dt.INCR=7682,Dt.DECR=7683,Dt.INVERT=5386,Dt.INCR_WRAP=34055,Dt.DECR_WRAP=34056,Dt.VENDOR=7936,Dt.RENDERER=7937,Dt.VERSION=7938,Dt.NEAREST=9728,Dt.LINEAR=9729,Dt.NEAREST_MIPMAP_NEAREST=9984,Dt.LINEAR_MIPMAP_NEAREST=9985,Dt.NEAREST_MIPMAP_LINEAR=9986,Dt.LINEAR_MIPMAP_LINEAR=9987,Dt.TEXTURE_MAG_FILTER=10240,Dt.TEXTURE_MIN_FILTER=10241,Dt.TEXTURE_WRAP_S=10242,Dt.TEXTURE_WRAP_T=10243,Dt.TEXTURE_2D=3553,Dt.TEXTURE=5890,Dt.TEXTURE_CUBE_MAP=34067,Dt.TEXTURE_BINDING_CUBE_MAP=34068,Dt.TEXTURE_CUBE_MAP_POSITIVE_X=34069,Dt.TEXTURE_CUBE_MAP_NEGATIVE_X=34070,Dt.TEXTURE_CUBE_MAP_POSITIVE_Y=34071,Dt.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072,Dt.TEXTURE_CUBE_MAP_POSITIVE_Z=34073,Dt.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074,Dt.MAX_CUBE_MAP_TEXTURE_SIZE=34076,Dt.TEXTURE0=33984,Dt.TEXTURE1=33985,Dt.TEXTURE2=33986,Dt.TEXTURE3=33987,Dt.TEXTURE4=33988,Dt.TEXTURE5=33989,Dt.TEXTURE6=33990,Dt.TEXTURE7=33991,Dt.TEXTURE8=33992,Dt.TEXTURE9=33993,Dt.TEXTURE10=33994,Dt.TEXTURE11=33995,Dt.TEXTURE12=33996,Dt.TEXTURE13=33997,Dt.TEXTURE14=33998,Dt.TEXTURE15=33999,Dt.TEXTURE16=34e3,Dt.TEXTURE17=34001,Dt.TEXTURE18=34002,Dt.TEXTURE19=34003,Dt.TEXTURE20=34004,Dt.TEXTURE21=34005,Dt.TEXTURE22=34006,Dt.TEXTURE23=34007,Dt.TEXTURE24=34008,Dt.TEXTURE25=34009,Dt.TEXTURE26=34010,Dt.TEXTURE27=34011,Dt.TEXTURE28=34012,Dt.TEXTURE29=34013,Dt.TEXTURE30=34014,Dt.TEXTURE31=34015,Dt.ACTIVE_TEXTURE=34016,Dt.REPEAT=10497,Dt.CLAMP_TO_EDGE=33071,Dt.MIRRORED_REPEAT=33648,Dt.FLOAT_VEC2=35664,Dt.FLOAT_VEC3=35665,Dt.FLOAT_VEC4=35666,Dt.INT_VEC2=35667,Dt.INT_VEC3=35668,Dt.INT_VEC4=35669,Dt.BOOL=35670,Dt.BOOL_VEC2=35671,Dt.BOOL_VEC3=35672,Dt.BOOL_VEC4=35673,Dt.FLOAT_MAT2=35674,Dt.FLOAT_MAT3=35675,Dt.FLOAT_MAT4=35676,Dt.SAMPLER_2D=35678,Dt.SAMPLER_CUBE=35680,Dt.VERTEX_ATTRIB_ARRAY_ENABLED=34338,Dt.VERTEX_ATTRIB_ARRAY_SIZE=34339,Dt.VERTEX_ATTRIB_ARRAY_STRIDE=34340,Dt.VERTEX_ATTRIB_ARRAY_TYPE=34341,Dt.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922,Dt.VERTEX_ATTRIB_ARRAY_POINTER=34373,Dt.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975,Dt.COMPILE_STATUS=35713,Dt.LOW_FLOAT=36336,Dt.MEDIUM_FLOAT=36337,Dt.HIGH_FLOAT=36338,Dt.LOW_INT=36339,Dt.MEDIUM_INT=36340,Dt.HIGH_INT=36341,Dt.FRAMEBUFFER=36160,Dt.RENDERBUFFER=36161,Dt.RGBA4=32854,Dt.RGB5_A1=32855,Dt.RGB565=36194,Dt.DEPTH_COMPONENT16=33189,Dt.STENCIL_INDEX=6401,Dt.STENCIL_INDEX8=36168,Dt.DEPTH_STENCIL=34041,Dt.RENDERBUFFER_WIDTH=36162,Dt.RENDERBUFFER_HEIGHT=36163,Dt.RENDERBUFFER_INTERNAL_FORMAT=36164,Dt.RENDERBUFFER_RED_SIZE=36176,Dt.RENDERBUFFER_GREEN_SIZE=36177,Dt.RENDERBUFFER_BLUE_SIZE=36178,Dt.RENDERBUFFER_ALPHA_SIZE=36179,Dt.RENDERBUFFER_DEPTH_SIZE=36180,Dt.RENDERBUFFER_STENCIL_SIZE=36181,Dt.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048,Dt.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049,Dt.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050,Dt.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051,Dt.COLOR_ATTACHMENT0=36064,Dt.DEPTH_ATTACHMENT=36096,Dt.STENCIL_ATTACHMENT=36128,Dt.DEPTH_STENCIL_ATTACHMENT=33306,Dt.NONE=0,Dt.FRAMEBUFFER_COMPLETE=36053,Dt.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054,Dt.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055,Dt.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057,Dt.FRAMEBUFFER_UNSUPPORTED=36061,Dt.FRAMEBUFFER_BINDING=36006,Dt.RENDERBUFFER_BINDING=36007,Dt.MAX_RENDERBUFFER_SIZE=34024,Dt.INVALID_FRAMEBUFFER_OPERATION=1286,Dt.UNPACK_FLIP_Y_WEBGL=37440,Dt.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441,Dt.CONTEXT_LOST_WEBGL=37442,Dt.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443,Dt.BROWSER_DEFAULT_WEBGL=37444,Dt._useProgram=null,Dt._depthTest=!0,Dt._depthMask=!0,Dt._blend=!1,Dt._cullFace=!1,Dt.curBindTexTarget=null,Dt.curBindTexValue=null,e(Dt,["_depthFunc",function(){return this._depthFunc=513},"_sFactor",function(){return this._sFactor=1},"_dFactor",function(){return this._dFactor=0},"_frontFace",function(){return this._frontFace=2305}]),Dt);function Dt(){}var Ft=function(){function t(){t.__super.call(this)}l(t,"laya.webgl.display.GraphicsGL",s);var e=t.prototype;return e.setShader=function(t){this._saveToCmd(p.context._setShader,[t])},e.setIBVB=function(t,e,i,r,s,n){this._saveToCmd(p.context._setIBVB,[t,e,i,r,s,n])},e.drawParticle=function(t,e,i){i=S.createParticleTemplate2D(i);i.x=t,i.y=e,this._saveToCmd(p.context._drawParticle,[i])},t}(),Bt=function(){var i;function S(t){this._x=0,this._y=0,this._id=++S._COUNT,this._path=null,this._drawCount=1,this._maxNumEle=0,this._clear=!1,this._isMain=!1,this._atlasResourceChange=0,this._submits=null,this._curSubmit=null,this._ib=null,this._vb=null,this._nBlendType=0,this._saveMark=null,this._shader2D=null,this.meshlist=[],this.mId=-1,this.mHaveKey=!1,this.mHaveLineKey=!1,this.mX=0,this.mY=0,S.__super.call(this),this._width=99999999,this._height=99999999,this._clipRect=S.MAXCLIPRECT,this.mOutPoint,this._canvas=t,S._contextcount++,p.isFlash?(this._ib=pe.create(35044),At.fillIBQuadrangle(this._ib,16)):this._ib=pe.QuadrangleIB,this.clear()}l(S,"laya.webgl.canvas.WebGLContext2D",r);var t=S.prototype;return t.setIsMainContext=function(){this._isMain=!0},t.clearBG=function(t,e,i,r){var s=Ct.mainContext;s.clearColor(t,e,i,r),s.clear(16384)},t._getSubmits=function(){return this._submits},t._releaseMem=function(){if(this._submits){this._curMat.destroy(),this._curMat=null,this._shader2D.destroy(),this._shader2D=null;for(var t=0,e=this._submits._length;t<e;t++)this._submits[t].releaseRender();this._submits.length=0,this._submits._length=0,this._submits=null,this._curSubmit=null,this._path&&this._path.recover(),this._path=null,this._other&&(this._other.font=null),this._save=null,this._vb&&(this._vb.releaseResource(),this._vb.destroy(),this._vb.destory(),this._vb=null)}},t.destroy=function(){--S._contextcount,this.sprite=null,this._releaseMem(),this._targets&&this._targets.destroy(),this._targets=null,this._canvas=null,this._ib&&this._ib!=pe.QuadrangleIB&&this._ib.releaseResource()},t.clear=function(){this._submits||(this._other=i.DEFAULT,this._curMat=y.create(),this._vb=ge.create(-1),this._submits=[],this._save=[Z.Create(this)],this._save.length=10,this._shader2D=new J,this._triangleMesh=Qt.getAMesh()),this._vb.clear(),this._targets&&(this._targets.repaint=!0),this._other=i.DEFAULT,this._clear=!0,this._repaint=!1,this._drawCount=1,this._renderKey=0,this._other.lineWidth=this._shader2D.ALPHA=1,this._nBlendType=0,this._clipRect=S.MAXCLIPRECT,this._curSubmit=ut.RENDERBASE,this._shader2D.glTexture=null,this._shader2D.fillStyle=this._shader2D.strokeStyle=W.DEFAULT;for(var t=0,e=this._submits._length;t<e;t++)this._submits[t].releaseRender();this._submits._length=0,this._curMat.identity(),this._other.clear(),this._saveMark=this._save[0],this._save._length=1},t.size=function(t,e){if(this._width!=t||this._height!=e)if(0==t||0==e){0!=this._vb._byteLength&&(this._width=t,this._height=e,this._vb.clear(),this._vb.upload());for(var i=0,r=this._submits._length;i<r;i++)this._submits[i].releaseRender();this._submits.length=0,this._submits._length=0,this._curSubmit=null,this._path&&this._path.recover(),this._path=null,this.sprite=null,this._targets&&this._targets.destroy(),this._targets=null}else this._width=t,this._height=e,this._targets&&this._targets.size(t,e),this._canvas.memorySize-=this._canvas.memorySize;0===t&&0===e&&this._releaseMem()},t._getTransformMatrix=function(){return this._curMat},t.translate=function(t,e){0===t&&0===e||(j.save(this),this._curMat.bTransform&&(q.save(this),this._curMat.transformPointN(T.TEMP.setTo(t,e)),t=T.TEMP.x,e=T.TEMP.y),this._x+=t,this._y+=e)},t.save=function(){this._save[this._save._length++]=Z.Create(this)},t.restore=function(){var t=this._save._length;if(!(t<1))for(var e=t-1;0<=e;e--){var i=this._save[e];if(i.restore(this),i.isSaveMark())return void(this._save._length=e)}},t._fillText=function(t,e,i,r,s,n,a,h,l,o){void 0===o&&(o=0);var u=this._shader2D,_=this._curSubmit.shaderValue,c=s?bt.create(s):this._other.font;U.enabled?u.ALPHA!==_.ALPHA&&(u.glTexture=null):(this._shader2D.defines.getValue(),s=n?d.create(n)._color:u.colorAdd,u.ALPHA===_.ALPHA&&s===u.colorAdd&&_.colorAdd===u.colorAdd||(u.glTexture=null,u.colorAdd=s)),xt.drawText(this,t,e,this._curMat,c,l||this._other.textAlign,n,a,h,i,r,o)},t.fillWords=function(t,e,i,r,s,n){this._fillText(null,t,e,i,r,s,null,-1,null,n)},t.fillBorderWords=function(t,e,i,r,s,n,a){this._fillBorderText(null,t,e,i,r,s,n,a,null)},t.fillText=function(t,e,i,r,s,n){this._fillText(t,null,e,i,r,s,null,-1,n)},t.strokeText=function(t,e,i,r,s,n,a){this._fillText(t,null,e,i,r,null,s,n||1,a)},t.fillBorderText=function(t,e,i,r,s,n,a,h){this._fillBorderText(t,null,e,i,r,s,n,a,h)},t._fillBorderText=function(t,e,i,r,s,n,a,h,l){if(!U.enabled)return this._fillText(t,e,i,r,s,null,a,h||1,l),void this._fillText(t,e,i,r,s,n,null,-1,l);var o=this._shader2D,u=this._curSubmit.shaderValue;o.ALPHA!==u.ALPHA&&(o.glTexture=null);s=s?(S._fontTemp.setFont(s),S._fontTemp):this._other.font;xt.drawText(this,t,e,this._curMat,s,l||this._other.textAlign,n,a,h||1,i,r,0)},t.fillRect=function(t,e,i,r,s){var n=this._vb;At.fillRectImgVb(n,this._clipRect,t,e,i,r,P.DEF_UV,this._curMat,this._x,this._y,0,0)&&(this._renderKey=0,i=this._shader2D.fillStyle,s&&(this._shader2D.fillStyle=W.create(s)),r=this._shader2D,s=this._curSubmit.shaderValue,r.fillStyle===s.fillStyle&&r.ALPHA===s.ALPHA||(r.glTexture=null,(n=this._curSubmit=ut.createSubmit(this,this._ib,n,(n._byteLength-64)/32*3,Nt.create(2,0))).shaderValue.color=r.fillStyle._color._color,n.shaderValue.ALPHA=r.ALPHA,this._submits[this._submits._length++]=n),this._curSubmit._numEle+=6,this._shader2D.fillStyle=i)},t.fillTexture=function(t,e,i,r,s,n,a,h){if(t.loaded&&t.bitmap&&t.source){var l,o,u,_=this._vb,c=t.bitmap.width,d=t.bitmap.height,f=t.uv,m=a.x%t.width,p=a.y%t.height;if(c!=h.w||d!=h.h){if(!h.w&&!h.h)switch(h.oy=h.ox=0,n){case"repeat":h.width=r,h.height=s;break;case"repeat-x":h.width=r,p<0?t.height+p>s?h.height=s:h.height=t.height+p:(h.oy=p,t.height+p>s?h.height=s-p:h.height=t.height);break;case"repeat-y":m<0?t.width+m>r?h.width=r:h.width=t.width+m:(h.ox=m,t.width+m>r?h.width=r-m:h.width=t.width),h.height=s;break;case"no-repeat":m<0?t.width+m>r?h.width=r:h.width=t.width+m:(h.ox=m,t.width+m>r?h.width=r-m:h.width=t.width),p<0?t.height+p>s?h.height=s:h.height=t.height+p:(h.oy=p,t.height+p>s?h.height=s-p:h.height=t.height);break;default:h.width=r,h.height=s}h.w=c,h.h=d,h.uv=[0,0,h.width/c,0,h.width/c,h.height/d,0,h.height/d]}e+=h.ox,i+=h.oy,m-=h.ox,p-=h.oy,At.fillRectImgVb(_,this._clipRect,e,i,h.width,h.height,h.uv,this._curMat,this._x,this._y,0,0)&&(this._renderKey=0,l=Kt.create(this,this._ib,_,(_._byteLength-64)/32*3,Nt.create(256,0)),(o=(this._submits[this._submits._length++]=l).shaderValue).textureHost=t,u=f[0]*c,a=f[1]*d,n=(f[2]-f[0])*c,e=(f[5]-f[3])*d,i=-m/c,f=-p/d,o.u_TexRange[0]=u/c,o.u_TexRange[1]=n/c,o.u_TexRange[2]=a/d,o.u_TexRange[3]=e/d,o.u_offset[0]=i,o.u_offset[1]=f,U.enabled&&!this._isMain&&l.addTexture(t,(_._byteLength>>2)-16),(this._curSubmit=l)._renderType=10017,l._numEle+=6)}else this.sprite&&x.timer.callLater(this,this._repaintSprite)},t.setShader=function(t){X.save(this,1048576,this._shader2D,!0),this._shader2D.shader=t},t.setFilters=function(t){X.save(this,2097152,this._shader2D,!0),this._shader2D.filters=t,this._curSubmit=ut.RENDERBASE,this._renderKey=0,this._drawCount++},t.drawTexture=function(t,e,i,r,s,n,a){this._drawTextureM(t,e,i,r,s,n,a,null,1)},t.addTextureVb=function(t,e,i){var r=this._curSubmit._vb||this._vb,s=r._byteLength>>2;r.byteLength=s+16<<2;for(var n=r.getFloat32Array(),a=0;a<16;a+=4)n[s++]=t[a]+e,n[s++]=t[a+1]+i,n[s++]=t[a+2],n[s++]=t[a+3];this._curSubmit._numEle+=6,this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle),r._upload=!0},t.willDrawTexture=function(t,e){if(!(t.loaded&&t.bitmap&&t.source))return this.sprite&&x.timer.callLater(this,this._repaintSprite),0;var i=t.bitmap,r=i.id+this._shader2D.ALPHA*e+10016;if(r==this._renderKey)return r;var s=this._shader2D,n=s.ALPHA,a=this._curSubmit.shaderValue;s.ALPHA*=e,this._renderKey=r,this._drawCount++,s.glTexture=i;var h=this._vb,e=null,i=h._byteLength/32*3,e=Kt.create(this,this._ib,h,i,Nt.create(1,0));return(this._submits[this._submits._length++]=e).shaderValue.textureHost=t,e._renderType=10016,e._preIsSameTextureShader=10016===this._curSubmit._renderType&&s.ALPHA===a.ALPHA,this._curSubmit=e,s.ALPHA=n,r},t.drawTextures=function(t,e,i,r){if(t.loaded&&t.bitmap&&t.source){var s=this._clipRect;if(this._clipRect=S.MAXCLIPRECT,this._drawTextureM(t,e[0],e[1],t.width,t.height,i,r,null,1)){if(this._clipRect=s,I.drawCall++,!(e.length<4)){for(var n=this._curSubmit._vb||this._vb,a=this._curMat.a,h=this._curMat.d,l=2,o=e.length;l<o;l+=2)At.copyPreImgVb(n,(e[l]-e[l-2])*a,(e[l+1]-e[l-1])*h),this._curSubmit._numEle+=6;this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle)}}else alert("drawTextures err")}else this.sprite&&x.timer.callLater(this,this._repaintSprite)},t._drawTextureM=function(t,e,i,r,s,n,a,h,l){if(!t.loaded||!t.source)return this.sprite&&x.timer.callLater(this,this._repaintSprite),!1;var o=this._curSubmit._vb||this._vb,u=t.bitmap;e+=n,i+=a,this._drawCount++;var _,c=u.id+this._shader2D.ALPHA*l+10016;return c!=this._renderKey&&(this._renderKey=c,_=this._curSubmit.shaderValue,a=(n=this._shader2D).ALPHA,n.ALPHA*=l,n.glTexture=u,c=null,u=(l=this._vb)._byteLength/32*3,c=Kt.create(this,this._ib,l,u,Nt.create(1,0)),(this._submits[this._submits._length++]=c).shaderValue.textureHost=t,c._renderType=10016,c._preIsSameTextureShader=10016===this._curSubmit._renderType&&n.ALPHA===_.ALPHA,this._curSubmit=c,o=this._curSubmit._vb||this._vb,n.ALPHA=a),!!At.fillRectImgVb(o,this._clipRect,e,i,r||t.width,s||t.height,t.uv,h||this._curMat,this._x,this._y,0,0)&&(U.enabled&&!this._isMain&&this._curSubmit.addTexture(t,(o._byteLength>>2)-16),this._curSubmit._numEle+=6,this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle),!0)},t._repaintSprite=function(){this.sprite&&this.sprite.repaint()},t._drawText=function(t,e,i,r,s,n,a,h,l,o){var u=t.bitmap;this._drawCount++;var _,c,d=u.id+this._shader2D.ALPHA+10016;d!=this._renderKey&&(this._renderKey=d,_=this._curSubmit.shaderValue,(c=this._shader2D).glTexture=u,f=null,u=(d=this._vb)._byteLength/32*3,(f=U.enabled?Kt.create(this,this._ib,d,u,Nt.create(1,0)):Kt.create(this,this._ib,d,u,fe.create()))._preIsSameTextureShader=10016===this._curSubmit._renderType&&c.ALPHA===_.ALPHA,(this._submits[this._submits._length++]=f).shaderValue.textureHost=t,f._renderType=10016,this._curSubmit=f),t.active();var f=this._curSubmit._vb||this._vb;At.fillRectImgVb(f,this._clipRect,e+a,i+h,r||t.width,s||t.height,t.uv,n||this._curMat,this._x,this._y,l,o,!0)&&(U.enabled&&!this._isMain&&this._curSubmit.addTexture(t,(f._byteLength>>2)-16),this._curSubmit._numEle+=6,this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle))},t.drawTextureWithTransform=function(t,e,i,r,s,n,a,h,l){var o,u,_;n?(o=this._curMat,u=this._x,_=this._y,0===a&&0===h||(this._x=a*o.a+h*o.c,this._y=h*o.d+a*o.b),n&&o.bTransform?(y.mul(n,o,S._tmpMatrix),(n=S._tmpMatrix)._checkTransform()):(this._x+=o.tx,this._y+=o.ty),this._drawTextureM(t,e,i,r,s,0,0,n,l),this._x=u,this._y=_):this._drawTextureM(t,e,i,r,s,a,h,null,l)},t.fillQuadrangle=function(t,e,i,r,s){var n,a=this._curSubmit,h=this._vb,l=this._shader2D,o=a.shaderValue;this._renderKey=0,t.bitmap?(n=t.bitmap,l.glTexture==n&&l.ALPHA===o.ALPHA||(l.glTexture=n,(a=this._curSubmit=ut.createSubmit(this,this._ib,h,h._byteLength/32*3,Nt.create(1,0))).shaderValue.glTexture=n,this._submits[this._submits._length++]=a),At.fillQuadrangleImgVb(h,e,i,r,t.uv,s||this._curMat,this._x,this._y)):(a.shaderValue.fillStyle&&a.shaderValue.fillStyle.equal(t)&&l.ALPHA===o.ALPHA||(l.glTexture=null,(a=this._curSubmit=ut.createSubmit(this,this._ib,h,h._byteLength/32*3,Nt.create(2,0))).shaderValue.defines.add(2),a.shaderValue.fillStyle=W.create(t),this._submits[this._submits._length++]=a),At.fillQuadrangleImgVb(h,e,i,r,P.DEF_UV,s||this._curMat,this._x,this._y)),a._numEle+=6},t.drawTexture2=function(t,e,i,r,s,n,a,h){var l;0!=n&&(l=this._curMat,this._x=t*l.a+e*l.c,this._y=e*l.d+t*l.b,s=s&&(l.bTransform||s.bTransform?(y.mul(s,l,S._tmpMatrix),S._tmpMatrix):(this._x+=s.tx+l.tx,this._y+=s.ty+l.ty,y.EMPTY)),1!==n||a?(t=this._shader2D.ALPHA,l=this._nBlendType,this._shader2D.ALPHA=n,a&&(this._nBlendType=G.TOINT(a)),this._drawTextureM(h[0],h[1]-i,h[2]-r,h[3],h[4],0,0,s,1),this._shader2D.ALPHA=t,this._nBlendType=l):this._drawTextureM(h[0],h[1]-i,h[2]-r,h[3],h[4],0,0,s,1),this._x=this._y=0)},t.drawCanvas=function(t,e,i,r,s){var n,a,h=t.context;this._renderKey=0,h._targets?(this._submits[this._submits._length++]=Xt.create(h,0,null),this._curSubmit=ut.RENDERBASE,h._targets.drawTo(this,e,i,r,s)):(n=this._submits[this._submits._length++]=Xt.create(h,this._shader2D.ALPHA,this._shader2D.filters),a=r/t.width,t=s/t.height,n=n._matrix,this._curMat.copyTo(n),1!=a&&1!=t&&n.scale(a,t),a=n.tx,t=n.ty,n.tx=n.ty=0,n.transformPoint(T.TEMP.setTo(e,i)),n.translate(T.TEMP.x+a,T.TEMP.y+t),this._curSubmit=ut.RENDERBASE),v.showCanvasMark&&(this.save(),this.lineWidth=4,this.strokeStyle=h._targets?"yellow":"green",this.strokeRect(e-1,i-1,r+2,s+2,1),this.strokeRect(e,i,r,s,1),this.restore())},t.drawTarget=function(t,e,i,r,s,n,a,h,l,o){void 0===o&&(o=-1);var u=this._vb;At.fillRectImgVb(u,this._clipRect,e,i,r,s,l||P.DEF_UV,n||this._curMat,this._x,this._y,0,0)&&(this._renderKey=0,this._shader2D.glTexture=null,this._curSubmit.shaderValue,(a=this._curSubmit=pt.create(this,this._ib,u,(u._byteLength-64)/32*3,h,a)).blendType=-1==o?this._nBlendType:o,a.scope=t,this._submits[this._submits._length++]=a,this._curSubmit._numEle+=6)},t.mixRGBandAlpha=function(t){return this._mixRGBandAlpha(t,this._shader2D.ALPHA)},t._mixRGBandAlpha=function(t,e){var i=(4278190080&t)>>>24;return 0!=i?i*=e:i=255*e,16777215&t|i<<24},t.drawTriangles=function(t,e,i,r,s,n,a,h,l,o){if(!t.loaded||!t.source)return this.sprite&&x.timer.callLater(this,this._repaintSprite),!1;this._drawCount++;t.bitmap;var u=this._mixRGBandAlpha(4294967295,h),_=(r.length,n.length);this._renderKey=-1;h=this._curSubmit=Kt.create(this,this._triangleMesh.getIBR(),this._triangleMesh.getVBR(),this._triangleMesh.indexNum,Nt.create(1,0));return h.shaderValue.textureHost=t,h._renderType=10016,this._submits[this._submits._length++]=h,a?(S._tmpMatrix.a=a.a,S._tmpMatrix.b=a.b,S._tmpMatrix.c=a.c,S._tmpMatrix.d=a.d,S._tmpMatrix.tx=a.tx+e,S._tmpMatrix.ty=a.ty+i,y.mul(S._tmpMatrix,this._curMat,S._tmpMatrix)):(S._tmpMatrix.a=this._curMat.a,S._tmpMatrix.b=this._curMat.b,S._tmpMatrix.c=this._curMat.c,S._tmpMatrix.d=this._curMat.d,S._tmpMatrix.tx=this._curMat.tx+e,S._tmpMatrix.ty=this._curMat.ty+i),this._triangleMesh.addData(r,s,n,S._tmpMatrix,u,this),this._curSubmit._numEle+=_,this._maxNumEle=Math.max(this._maxNumEle,this._curSubmit._numEle),!0},t.transform=function(t,e,i,r,s,n){q.save(this),y.mul(y.TEMP.setTo(t,e,i,r,s,n),this._curMat,this._curMat),this._curMat._checkTransform()},t.setTransformByMatrix=function(t){t.copyTo(this._curMat)},t.transformByMatrix=function(t){q.save(this),y.mul(t,this._curMat,this._curMat),this._curMat._checkTransform()},t.rotate=function(t){q.save(this),this._curMat.rotateEx(t)},t.scale=function(t,e){q.save(this),this._curMat.scaleEx(t,e)},t.clipRect=function(t,e,i,r){var s,n,a,h,l,o;0!=this._curMat.b||0!=this._curMat.c?(this._renderKey=0,h=mt.create(4),this.addRenderObject(h),l=(o=this._vb)._byteLength>>2,At.fillRectImgVb(o,null,t,e,i,r,P.DEF_UV,this._curMat,this._x,this._y,0,0)?(this._shader2D.glTexture=null,(a=this._curSubmit=ut.createSubmit(this,this._ib,o,(o._byteLength-64)/32*3,Nt.create(2,0))).shaderValue.ALPHA=1,this._submits[this._submits._length++]=a,this._curSubmit._numEle+=6):alert("clipRect calc stencil rect error"),s=mt.create(5),this.addRenderObject(s),n=o.getFloat32Array(),h=Math.min(Math.min(Math.min(n[l],n[4+l]),n[8+l]),n[12+l]),a=Math.max(Math.max(Math.max(n[l],n[4+l]),n[8+l]),n[12+l]),o=Math.min(Math.min(Math.min(n[1+l],n[5+l]),n[9+l]),n[13+l]),l=Math.max(Math.max(Math.max(n[1+l],n[5+l]),n[9+l]),n[13+l]),Q.save(this,s,t,e,i,r,h,o,a-h,l-o)):(i*=this._curMat.a,r*=this._curMat.d,h=T.TEMP,this._curMat.transformPoint(h.setTo(t,e)),i<0&&(h.x=h.x+i,i=-i),r<0&&(h.y=h.y+r,r=-r),this._renderKey=0,l=this._curSubmit=ft.create(this),(this._submits[this._submits._length++]=l).submitIndex=this._submits._length,l.submitLength=9999999,K.save(this,l),t=(o=this._clipRect).x,e=o.y,i=h.x+i,r=h.y+r,t<h.x&&(o.x=h.x),e<h.y&&(o.y=h.y),o.width=Math.min(i,t+o.width)-o.x,o.height=Math.min(r,e+o.height)-o.y,this._shader2D.glTexture=null,l.clipRect.copyFrom(o)),this._curSubmit=ut.RENDERBASE},t.setIBVB=function(t,e,i,r,s,n,a,h,l,o,u){var _;if(void 0===l&&(l=0),void 0===o&&(o=0),void 0===u&&(u=0),null===i&&(i=p.isFlash?((_=r)._selfIB||(_._selfIB=pe.create(35044)),_._selfIB.clear(),_._selfIB):this._ib,At.expandIBQuadrangle(i,r._byteLength/(4*r.vertexStride*4))),!h||!a)throw Error("setIBVB must input:shader shaderValues");u=dt.create(this,r,i,s,a,h,l,o,u);(n=n||y.EMPTY).translate(t,e),y.mul(n,this._curMat,u._mat),n.translate(-t,-e),this._submits[this._submits._length++]=u,this._curSubmit=ut.RENDERBASE,this._renderKey=0},t.addRenderObject=function(t){this._submits[this._submits._length++]=t},t.fillTrangles=function(t,e,i,r,s){var n=this._curSubmit,a=this._vb,h=this._shader2D,l=n.shaderValue,o=r.length>>4,u=t.bitmap;this._renderKey=0,h.glTexture==u&&h.ALPHA===l.ALPHA||((n=this._curSubmit=ut.createSubmit(this,this._ib,a,a._byteLength/32*3,Nt.create(1,0))).shaderValue.textureHost=t,this._submits[this._submits._length++]=n),At.fillTranglesVB(a,e,i,r,s||this._curMat,this._x,this._y),n._numEle+=6*o},t.submitElement=function(t,e){var i=this._submits;for(e<0&&(e=i._length);t<e;)t+=i[t].renderSubmit()},t.finish=function(){Ct.mainContext.finish()},t.flush=function(){var t=Math.max(this._vb._byteLength/64,this._maxNumEle/6)+8;if(t>this._ib.bufferLength/12&&At.expandIBQuadrangle(this._ib,t),!this._isMain&&U.enabled&&U._atlasRestore>this._atlasResourceChange){this._atlasResourceChange=U._atlasRestore;for(var e=this._submits,i=0,r=e._length;i<r;i++){var s=e[i];10016===s.getRenderType()&&s.checkTexture()}}this.submitElement(0,this._submits._length),this._path&&this._path.reset(),rt.instance&&rt.getInstance().reset();for(var i=0,n=this.meshlist.length;i<n;i++){var a=this.meshlist[i];a.canReuse?a.releaseMesh():a.destroy()}return this.meshlist.length=0,this._curSubmit=ut.RENDERBASE,this._renderKey=0,this._triangleMesh=Qt.getAMesh(),this.meshlist.push(this._triangleMesh),this._submits._length},t.setPathId=function(t){this.mId=t,-1!=this.mId&&(this.mHaveKey=!1,(t=F.getInstance()).shapeDic[this.mId]&&(this.mHaveKey=!0),this.mHaveLineKey=!1,t.shapeLineDic[this.mId]&&(this.mHaveLineKey=!0))},t.movePath=function(t,e){var i=t;t=this._curMat.a*i+this._curMat.c*e+this._curMat.tx,e=this._curMat.b*i+this._curMat.d*e+this._curMat.ty,this.mX+=t,this.mY+=e},t.beginPath=function(){var t=this._getPath();t.tempArray.length=0,t.closePath=!1,this.mX=0,this.mY=0},t.closePath=function(){this._path.closePath=!0},t.fill=function(t){void 0===t&&(t=!1);var e=this._getPath();this.drawPoly(0,0,e.tempArray,this.fillStyle._color.numColor,0,0,t)},t.stroke=function(){var t,e=this._getPath();0<this.lineWidth&&(-1==this.mId?e.drawLine(0,0,e.tempArray,this.lineWidth,this.strokeStyle._color.numColor):this.mHaveLineKey?((t=F.getInstance().shapeLineDic[this.mId]).rebuild(e.tempArray),e.setGeomtry(t)):F.getInstance().addLine(this.mId,e.drawLine(0,0,e.tempArray,this.lineWidth,this.strokeStyle._color.numColor)),e.update(),t=[this.mX,this.mY],(e=ut.createShape(this,e.ib,e.vb,e.count,e.offset,Nt.create(4,0))).shaderValue.ALPHA=this._shader2D.ALPHA,e.shaderValue.u_pos=t,e.shaderValue.u_mmat2=Rt.TEMPMAT4_ARRAY,this._submits[this._submits._length++]=e,this._renderKey=-1)},t.line=function(t,e,i,r,s,n){var a=this._curSubmit,h=this._vb;At.fillLineVb(h,this._clipRect,t,e,i,r,s,n)&&(this._renderKey=0,s=this._shader2D,n=a.shaderValue,s.strokeStyle===n.strokeStyle&&s.ALPHA===n.ALPHA||(s.glTexture=null,(a=this._curSubmit=ut.createSubmit(this,this._ib,h,(h._byteLength-64)/32*3,Nt.create(2,0))).shaderValue.strokeStyle=s.strokeStyle,a.shaderValue.mainID=2,a.shaderValue.ALPHA=s.ALPHA,this._submits[this._submits._length++]=a),a._numEle+=6)},t.moveTo=function(t,e,i){void 0===i&&(i=!0);var r=this._getPath();i&&(t=this._curMat.a*(i=t)+this._curMat.c*e,e=this._curMat.b*i+this._curMat.d*e),r.addPoint(t,e)},t.lineTo=function(t,e,i){void 0===i&&(i=!0);var r=this._getPath();i&&(t=this._curMat.a*(i=t)+this._curMat.c*e,e=this._curMat.b*i+this._curMat.d*e),r.addPoint(t,e)},t.drawCurves=function(t,e,i){this.setPathId(-1),this.beginPath(),this.strokeStyle=i[3],this.lineWidth=i[4];var r=i[2];t+=i[0],e+=i[1],this.movePath(t,e),this.moveTo(r[0],r[1]);for(var s=2,n=r.length;s<n;)this.quadraticCurveTo(r[s++],r[s++],r[s++],r[s++]);this.stroke()},t.arcTo=function(t,e,i,r,s){if(-1==this.mId||!this.mHaveKey){var n=0,a=0,h=0,l=this._getPath();this._curMat.copyTo(S._tmpMatrix),S._tmpMatrix.tx=S._tmpMatrix.ty=0,S._tempPoint.setTo(l.getEndPointX(),l.getEndPointY()),S._tmpMatrix.invertTransformPoint(S._tempPoint);var o=S._tempPoint.x-t,u=S._tempPoint.y-e;if(!((p=Math.sqrt(o*o+u*u))<=1e-6)){var _=o/p,c=u/p,d=i-t,f=r-e,m=Math.sqrt(d*d+f*f);if(!(m<=1e-6)){o=d/m,u=f/m,i=_+o,r=c+u,d=Math.sqrt(i*i+r*r);if(!(d<=1e-6)){var p,f=i/d,m=r/d,i=Math.acos(f*_+m*c),r=Math.PI/2-i,d=(p=s/Math.tan(r))*_+t,i=p*c+e,s=Math.sqrt(p*p+s*s),g=t+f*s,x=e+m*s,v=0,b=0;b=(v=(r=0<=_*u-c*o?2*r/S.SEGNUM:2*-r/S.SEGNUM,Math.sin(r)),Math.cos(r)),a=this._curMat.a*d+this._curMat.c*i,h=this._curMat.b*d+this._curMat.d*i,a==this._path.getEndPointX()&&h==this._path.getEndPointY()||l.addPoint(a,h);for(var y=d-g,T=i-x,n=0;n<S.SEGNUM;n++){var A=y*b+T*v,E=-y*v+T*b;t=this._curMat.a*(a=A+g)+this._curMat.c*(h=E+x),h=e=this._curMat.b*a+this._curMat.d*h,(a=t)==this._path.getEndPointX()&&h==this._path.getEndPointY()||l.addPoint(a,h),y=A,T=E}}}}}},t.arc=function(t,e,i,r,s,n,a){if(void 0===n&&(n=!1),void 0===a&&(a=!0),-1!=this.mId){var h=F.getInstance().shapeDic[this.mId];if(h&&this.mHaveKey&&!h.needUpdate(this._curMat))return;e=t=0}var l,o,u=0,h=0,_=0,c=0,d=0,f=0,u=s-r;if(n)if(Math.abs(u)>=2*Math.PI)u=2*-Math.PI;else for(;0<u;)u-=2*Math.PI;else if(Math.abs(u)>=2*Math.PI)u=2*Math.PI;else for(;u<0;)u+=2*Math.PI;o=u/(f=i<101?Math.max(10,u*i/5):i<201?Math.max(10,u*i/20):Math.max(10,u*i/40))/2,h=Math.abs(4/3*(1-Math.cos(o))/Math.sin(o)),n&&(h=-h);for(var m=this._getPath(),p=NaN,g=NaN,d=0;d<=f;d++)l=r+u*(d/f),_=t+Math.cos(l)*i,c=e+Math.sin(l)*i,a&&(_=this._curMat.a*(p=_)+this._curMat.c*(g=c),c=this._curMat.b*p+this._curMat.d*g),_==this._path.getEndPointX()&&c==this._path.getEndPointY()||m.addPoint(_,c);_=t+Math.cos(s)*i,c=e+Math.sin(s)*i,a&&(_=this._curMat.a*(p=_)+this._curMat.c*(g=c),c=this._curMat.b*p+this._curMat.d*g),_==this._path.getEndPointX()&&c==this._path.getEndPointY()||m.addPoint(_,c)},t.quadraticCurveTo=function(t,e,i,r){var s=_.I,n=i,a=r;i=this._curMat.a*n+this._curMat.c*a,r=this._curMat.b*n+this._curMat.d*a,t=this._curMat.a*(n=t)+this._curMat.c*(a=e),e=this._curMat.b*n+this._curMat.d*a;for(var h=s.getBezierPoints([this._path.getEndPointX(),this._path.getEndPointY(),t,e,i,r],30,2),l=0,o=h.length/2;l<o;l++)this.lineTo(h[2*l],h[2*l+1],!1);this.lineTo(i,r,!1)},t.rect=function(t,e,i,r){this._other=this._other.make(),this._other.path||(this._other.path=new Y),this._other.path.rect(t,e,i,r)},t.strokeRect=function(t,e,i,r,s){var n=.5*s;this.line(t-n,e,t+i+n,e,s,this._curMat),this.line(t+i,e,t+i,e+r,s,this._curMat),this.line(t,e,t,e+r,s,this._curMat),this.line(t-n,e+r,t+i+n,e+r,s,this._curMat)},t.clip=function(){},t.drawPoly=function(t,e,i,r,s,n,a){void 0===a&&(a=!1),this._renderKey=0,this._shader2D.glTexture=null;var h=this._getPath();-1==this.mId?h.polygon(t,e,i,r,s||1,n):this.mHaveKey?((a=F.getInstance().shapeDic[this.mId]).setMatrix(this._curMat),a.rebuild(h.tempArray),h.setGeomtry(a)):(l=h.polygon(t,e,i,r,s||1,n),F.getInstance().addShape(this.mId,l),l.setMatrix(this._curMat)),h.update();var r=[this.mX,this.mY],l=ut.createShape(this,h.ib,h.vb,h.count,h.offset,Nt.create(4,0));l.shaderValue.ALPHA=this._shader2D.ALPHA,l.shaderValue.u_pos=r,l.shaderValue.u_mmat2=Rt.EMPTYMAT4_ARRAY,this._submits[this._submits._length++]=l,0<s&&(this.mHaveLineKey?((r=F.getInstance().shapeLineDic[this.mId]).rebuild(h.tempArray),h.setGeomtry(r)):F.getInstance().addShape(this.mId,h.drawLine(t,e,i,s,n)),h.update(),(l=ut.createShape(this,h.ib,h.vb,h.count,h.offset,Nt.create(4,0))).shaderValue.ALPHA=this._shader2D.ALPHA,l.shaderValue.u_mmat2=Rt.EMPTYMAT4_ARRAY,this._submits[this._submits._length++]=l)},t.drawParticle=function(t,e,i){i.x=t,i.y=e,this._submits[this._submits._length++]=i},t._getPath=function(){return this._path||(this._path=new Y)},a(0,t,"globalCompositeOperation",function(){return G.NAMES[this._nBlendType]},function(t){t=G.TOINT[t];null==t||this._nBlendType===t||(X.save(this,65536,this,!0),this._curSubmit=ut.RENDERBASE,this._renderKey=0,this._nBlendType=t)}),a(0,t,"strokeStyle",function(){return this._shader2D.strokeStyle},function(t){this._shader2D.strokeStyle.equal(t)||(X.save(this,512,this._shader2D,!1),this._shader2D.strokeStyle=W.create(t))}),a(0,t,"globalAlpha",function(){return this._shader2D.ALPHA},function(t){(t=Math.floor(1e3*t)/1e3)!=this._shader2D.ALPHA&&(X.save(this,1,this._shader2D,!0),this._shader2D.ALPHA=t)}),a(0,t,"asBitmap",null,function(t){if(t){if(this._targets||(this._targets=new $),this._targets.repaint=!0,!this._width||!this._height)throw Error("asBitmap no size!");this._targets.setSP(this.sprite),this._targets.size(this._width,this._height)}else this._targets=null}),a(0,t,"fillStyle",function(){return this._shader2D.fillStyle},function(t){this._shader2D.fillStyle.equal(t)||(X.save(this,2,this._shader2D,!1),this._shader2D.fillStyle=W.create(t))}),a(0,t,"textAlign",function(){return this._other.textAlign},function(t){this._other.textAlign===t||(this._other=this._other.make(),X.save(this,32768,this._other,!1),this._other.textAlign=t)}),a(0,t,"lineWidth",function(){return this._other.lineWidth},function(t){this._other.lineWidth===t||(this._other=this._other.make(),X.save(this,256,this._other,!1),this._other.lineWidth=t)}),a(0,t,"textBaseline",function(){return this._other.textBaseline},function(t){this._other.textBaseline===t||(this._other=this._other.make(),X.save(this,16384,this._other,!1),this._other.textBaseline=t)}),a(0,t,"font",null,function(t){t!=this._other.font.toString()&&(this._other=this._other.make(),X.save(this,8,this._other,!1),this._other.font===bt.EMPTY?this._other.font=new bt(t):this._other.font.setFont(t))}),S.__init__=function(){i.DEFAULT=new i},S._tempPoint=new T,S._SUBMITVBSIZE=32e3,S._MAXSIZE=99999999,S._RECTVBSIZE=16,S.MAXCLIPRECT=new A(0,0,99999999,99999999),S._COUNT=0,S._tmpMatrix=new y,S.SEGNUM=32,S._contextcount=0,e(S,["_fontTemp",function(){return this._fontTemp=new bt},"_drawStyleTemp",function(){return this._drawStyleTemp=new W(null)}]),S.__init$=function(){i=function(){function t(){this.lineWidth=1,this.path=null,this.textAlign=null,this.textBaseline=null,this.font=bt.EMPTY}l(t,"");var e=t.prototype;return e.clear=function(){this.lineWidth=1,this.path&&this.path.clear(),this.textAlign=this.textBaseline=null,this.font=bt.EMPTY},e.make=function(){return this===t.DEFAULT?new t:this},t.DEFAULT=null,t}()},S}(),Nt=function(){function r(t,e){this.size=[0,0],this.alpha=1,this.ALPHA=1,this.subID=0,this._cacheID=0,r.__super.call(this),this.defines=new kt,this.position=r._POSITION,this.mainID=t,this.subID=e,this.textureHost=null,this.texture=null,this.fillStyle=null,this.color=null,this.strokeStyle=null,this.colorAdd=null,this.glTexture=null,this.u_mmat2=null,this._cacheID=t|e,this._inClassCache=r._cache[this._cacheID],0<t&&!this._inClassCache&&(this._inClassCache=r._cache[this._cacheID]=[],this._inClassCache._length=0),this.clear()}l(r,"laya.webgl.shader.d2.value.Value2D",N);var t=r.prototype;return t.setValue=function(t){},t.refresh=function(){var t=this.size;return t[0]=Rt.width,t[1]=Rt.height,this.alpha=this.ALPHA*Rt.worldAlpha,this.mmat=Rt.worldMatrix4,this},t._ShaderWithCompile=function(){return ce.withCompile2D(0,this.mainID,this.defines.toNameDic(),this.mainID|this.defines._value,me.create)},t._withWorldShaderDefines=function(){var t=Rt.worldShaderDefines,e=ce.sharders[this.mainID|this.defines._value|t.getValue()];if(!e){var i,r={},s=this.defines.toNameDic();for(i in s)r[i]="";for(i in t.toNameDic())r[i]="";e=ce.withCompile2D(0,this.mainID,r,this.mainID|this.defines._value|t.getValue(),me.create)}var n=Rt.worldFilters;if(!n)return e;for(var a,h=n.length,l=0;l<h;l++)(a=n[l])&&a.action.setValue(this);return e},t.upload=function(){var t=Rt;this.alpha=this.ALPHA*t.worldAlpha,Rt.worldMatrix4!==Rt.TEMPMAT4_ARRAY&&this.defines.add(128),Ct.shaderHighPrecision&&this.defines.add(1024);var e,i=t.worldShaderDefines?this._withWorldShaderDefines():ce.sharders[this.mainID|this.defines._value]||this._ShaderWithCompile();this.size[0]=t.width,this.size[1]=t.height,this.mmat=t.worldMatrix4,Zt.activeShader!==i?i._shaderValueWidth!==t.width||i._shaderValueHeight!==t.height?(i._shaderValueWidth=t.width,i._shaderValueHeight=t.height):e=i._params2dQuick2||i._make2dQuick2():i._shaderValueWidth!==t.width||i._shaderValueHeight!==t.height?(i._shaderValueWidth=t.width,i._shaderValueHeight=t.height):e=i._params2dQuick1||i._make2dQuick1(),i.upload(this,e)},t.setFilters=function(t){if(this.filters=t)for(var e,i=t.length,r=0;r<i;r++)(e=t[r])&&(this.defines.add(e.type),e.action.setValue(this))},t.clear=function(){this.defines.setValue(this.subID)},t.release=function(){(this._inClassCache[this._inClassCache._length++]=this).fillStyle=null,this.strokeStyle=null,this.clear()},r._initone=function(t,e){r._typeClass[t]=e,r._cache[t]=[],r._cache[t]._length=0},r.__init__=function(){r._POSITION=[2,5126,!1,4*yt.BYTES_PE,0],r._TEXCOORD=[2,5126,!1,4*yt.BYTES_PE,2*yt.BYTES_PE],r._initone(2,ee),r._initone(4,ne),r._initone(256,re),r._initone(512,Jt),r._initone(1,se),r._initone(65,fe),r._initone(9,se)},r.create=function(t,e){var i=r._cache[t|e];return i._length?i[--i._length]:new r._typeClass[t|e](e)},r._POSITION=null,r._TEXCOORD=null,r._cache=[],r._typeClass=[],r.TEMPMAT4_ARRAY=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r}(),Ot=function(){function m(t,e){m.__super.call(this,t,e)}l(m,"laya.webgl.utils.RenderSprite3D",g);var t=m.prototype;return t.onCreate=function(t){switch(t){case 8:return void(this._fun=this._blend);case 4:return void(this._fun=this._transform)}},t._mask=function(t,e,i,r){var s,n,a,h,l,o,u,_,c,d=this._next,f=t.mask;f?(e.ctx.save(),a=e.ctx.globalCompositeOperation,(h=new A).copyFrom(f.getBounds()),h.width=Math.round(h.width),h.height=Math.round(h.height),h.x=Math.round(h.x),h.y=Math.round(h.y),0<h.width&&0<h.height&&(l=t._style._tf,(o=ct.create()).addValue("bounds",h),s=_t.create([o,e],laya.webgl.utils.RenderSprite3D.tmpTarget),e.addRenderObject(s),f.render(e,-h.x,-h.y),s=_t.create([o],laya.webgl.utils.RenderSprite3D.endTmpTarget),e.addRenderObject(s),e.ctx.save(),e.clipRect(i-l.translateX+h.x,r-l.translateY+h.y,h.width,h.height),d._fun.call(d,t,e,i,r),e.ctx.restore(),n=mt.create(6),a=e.ctx.globalCompositeOperation,n.blendMode="mask",e.addRenderObject(n),y.TEMP.identity(),u=Nt.create(1,0),_=P.INV_UV,c=h.width,f=h.height,(h.width<32||h.height<32)&&((_=m.tempUV)[0]=0,_[1]=0,_[2]=32<=h.width?1:h.width/32,_[3]=0,_[4]=32<=h.width?1:h.width/32,_[5]=32<=h.height?1:h.height/32,_[6]=0,_[7]=32<=h.height?1:h.height/32,h.width=32<=h.width?h.width:32,h.height=32<=h.height?h.height:32,_[1]*=-1,_[3]*=-1,_[5]*=-1,_[7]*=-1,_[1]+=1,_[3]+=1,_[5]+=1,_[7]+=1),e.ctx.drawTarget(o,i+h.x-l.translateX,r+h.y-l.translateY,c,f,y.TEMP,"tmpTarget",u,_,6),s=_t.create([o],laya.webgl.utils.RenderSprite3D.recycleTarget),e.addRenderObject(s),(n=mt.create(6)).blendMode=a,e.addRenderObject(n)),e.ctx.restore()):d._fun.call(d,t,e,i,r)},t._blend=function(t,e,i,r){var s=t._style,n=this._next;s.blendMode?(e.ctx.save(),e.ctx.globalCompositeOperation=s.blendMode,n._fun.call(n,t,e,i,r),e.ctx.restore()):n._fun.call(n,t,e,i,r)},t._transform=function(t,e,i,r){var s,n,a=t.transform,h=this._next;a&&h!=g.NORENDER?(n=e.ctx,t._style,a.tx=i,a.ty=r,n=(s=n._getTransformMatrix()).clone(),y.mul(a,s,s),s._checkTransform(),a.tx=a.ty=0,h._fun.call(h,t,e,0,0),n.copyTo(s),n.destroy()):h._fun.call(h,t,e,i,r)},m.tmpTarget=function(t,e){var i=t.getValue("bounds"),i=jt.create(i.width,i.height);i.start(),i.clear(0,0,0,0),t.addValue("tmpTarget",i)},m.endTmpTarget=function(t){t.getValue("tmpTarget").end()},m.recycleTarget=function(t){t.getValue("tmpTarget").recycle(),t.recycle()},e(m,["tempUV",function(){return this.tempUV=new Array(8)}]),m}(),Vt=function(){function t(){this.data=null,t.__super.call(this)}l(t,"laya.filters.webgl.ColorFilterActionGL",B);var e=t.prototype;return x.imps(e,{"laya.filters.IFilterActionGL":!0}),e.setValue=function(t){t.colorMat=this.data._mat,t.colorAlpha=this.data._alpha},e.apply3d=function(t,e,i,r,s){var n=t.getValue("bounds"),a=Nt.create(1,0);a.setFilters([this.data]);var h=y.TEMP;h.identity(),i.ctx.drawTarget(t,0,0,n.width,n.height,h,"src",a)},t}(),Ut=function(){function n(t,e,i,r,s){this._atlasCanvas=null,this._inAtlasTextureKey=null,this._inAtlasTextureBitmapValue=null,this._inAtlasTextureOriUVValue=null,this._InAtlasWebGLImagesKey=null,this._InAtlasWebGLImagesOffsetValue=null,n.__super.call(this,t,e,s),this._inAtlasTextureKey=[],this._inAtlasTextureBitmapValue=[],this._inAtlasTextureOriUVValue=[],this._InAtlasWebGLImagesKey={},this._InAtlasWebGLImagesOffsetValue=[],this._atlasCanvas=new he,(this._atlasCanvas._atlaser=this)._atlasCanvas.width=i,this._atlasCanvas.height=r,this._atlasCanvas.activeResource(),this._atlasCanvas.lock=!0}l(n,"laya.webgl.atlas.Atlaser",V);var t=n.prototype;return t.computeUVinAtlasTexture=function(t,e,i,r){var s=U.atlasTextureWidth,n=U.atlasTextureHeight,a=i/s,h=r/n,i=(i+t.bitmap.width)/s,r=(r+t.bitmap.height)/n,s=t.bitmap.width/s,n=t.bitmap.height/n;t.uv=[a+e[0]*s,h+e[1]*n,i-(1-e[2])*s,h+e[3]*n,i-(1-e[4])*s,r-(1-e[5])*n,a+e[6]*s,r-(1-e[7])*n]},t.findBitmapIsExist=function(t){if(t instanceof laya.webgl.resource.WebGLImage){var e=t.url,t=this._InAtlasWebGLImagesKey[e||t.id];if(t)return t.offsetInfoID}return-1},t.addToAtlasTexture=function(t,e,i){var r;t instanceof laya.webgl.resource.WebGLImage&&(r=t.url,this._InAtlasWebGLImagesKey[r||t.id]={bitmap:t,offsetInfoID:this._InAtlasWebGLImagesOffsetValue.length},this._InAtlasWebGLImagesOffsetValue.push([e,i])),this._atlasCanvas.texSubImage2D(e,i,t.atlasImgData||t.atlasSource),t.clearAtlasSource()},t.addToAtlas=function(t,e,i){t._atlasID=this._inAtlasTextureKey.length;var r=t.uv.slice(),s=t.bitmap;this._inAtlasTextureKey.push(t),this._inAtlasTextureOriUVValue.push(r),this._inAtlasTextureBitmapValue.push(s),this.computeUVinAtlasTexture(t,r,e,i),t.bitmap=this._atlasCanvas},t.clear=function(){for(var t=0,e=this._inAtlasTextureKey.length;t<e;t++)this._inAtlasTextureKey[t].bitmap=this._inAtlasTextureBitmapValue[t],this._inAtlasTextureKey[t].uv=this._inAtlasTextureOriUVValue[t],this._inAtlasTextureKey[t]._atlasID=-1,this._inAtlasTextureKey[t].bitmap.lock=!1,this._inAtlasTextureKey[t].bitmap.releaseResource();this._inAtlasTextureKey.length=0,this._inAtlasTextureBitmapValue.length=0,this._inAtlasTextureOriUVValue.length=0,this._InAtlasWebGLImagesKey=null,this._InAtlasWebGLImagesOffsetValue.length=0},t.dispose=function(){this.clear(),this._atlasCanvas.destroy()},a(0,t,"InAtlasWebGLImagesOffsetValue",function(){return this._InAtlasWebGLImagesOffsetValue}),a(0,t,"texture",function(){return this._atlasCanvas}),a(0,t,"inAtlasWebGLImagesKey",function(){return this._InAtlasWebGLImagesKey}),n}(),kt=(l(Ht,"laya.webgl.shader.d2.ShaderDefines2D",et),Ht.__init__=function(){Ht.reg("TEXTURE2D",1),Ht.reg("COLOR2D",2),Ht.reg("PRIMITIVE",4),Ht.reg("GLOW_FILTER",8),Ht.reg("BLUR_FILTER",16),Ht.reg("COLOR_FILTER",32),Ht.reg("COLOR_ADD",64),Ht.reg("WORLDMAT",128),Ht.reg("FILLTEXTURE",256),Ht.reg("FSHIGHPRECISION",1024)},Ht.reg=function(t,e){et._reg(t,e,Ht.__name2int,Ht.__int2name)},Ht.toText=function(t,e,i){return et._toText(t,e,i)},Ht.toInt=function(t){return et._toInt(t,Ht.__name2int)},Ht.TEXTURE2D=1,Ht.COLOR2D=2,Ht.PRIMITIVE=4,Ht.FILTERGLOW=8,Ht.FILTERBLUR=16,Ht.FILTERCOLOR=32,Ht.COLORADD=64,Ht.WORLDMAT=128,Ht.FILLTEXTURE=256,Ht.SKINMESH=512,Ht.SHADERDEFINE_FSHIGHPRECISION=1024,Ht.__name2int={},Ht.__int2name=[],Ht.__int2nameMap=[],Ht);function Ht(){Ht.__super.call(this,Ht.__name2int,Ht.__int2name,Ht.__int2nameMap)}l(Gt,"laya.webgl.shapes.Ellipse",st);function Gt(t,e,i,r,s,n,a){Gt.__super.call(this,t,e,i,r,40,s,n,a)}var zt=function(){function n(t,e,i,r,s){this._points=[],this.rebuild(i),n.__super.call(this,t,e,0,0,0,s,r,s,0)}l(n,"laya.webgl.shapes.Line",st);var t=n.prototype;return t.rebuild=function(t){var e=t.length;e!=this._points.length&&(this.mUint16Array=new Uint16Array(6*(e/2-1)),this.mFloat32Array=new Float32Array(5*e)),this._points.length=0;for(var i,r,s=-1,n=-1,a=t.length/2,h=0;h<a;h++)i=t[2*h],r=t[2*h+1],(.01<Math.abs(s-i)||.01<Math.abs(n-r))&&this._points.push(i,r),s=i,n=r},t.getData=function(t,e,i){var r=[],s=[];0<this.borderWidth&&this.createLine2(this._points,r,this.borderWidth,i,s,this._points.length/2),this.mUint16Array.set(r,0),this.mFloat32Array.set(s,0),t.append(this.mUint16Array),e.append(this.mFloat32Array)},n}(),Wt=function(){function _(t,e,i,r,s){this._points=[];for(var n=NaN,a=NaN,h=-1,l=-1,o=i.length/2-1,u=0;u<o;u++)n=i[2*u],a=i[2*u+1],(.01<Math.abs(h-n)||.01<Math.abs(l-a))&&this._points.push(n,a),h=n,l=a;n=i[2*o],a=i[2*o+1],h=this._points[0],l=this._points[1],(.01<Math.abs(h-n)||.01<Math.abs(l-a))&&this._points.push(n,a),_.__super.call(this,t,e,0,0,this._points.length/2,0,r,s)}l(_,"laya.webgl.shapes.LoopLine",st);var t=_.prototype;return t.getData=function(t,e,i){if(0<this.borderWidth){for(var r,s,n=this.color,a=(n>>16&255)/255,h=(n>>8&255)/255,l=(255&n)/255,o=[],n=[],u=Math.floor(this._points.length/2),_=0;_<u;_++)r=this._points[2*_],s=this._points[2*_+1],o.push(this.x+r,this.y+s,a,h,l);this.createLoopLine(o,n,this.borderWidth,i+o.length/5),t.append(new Uint16Array(n)),e.append(new Float32Array(o))}},t.createLoopLine=function(t,e,i,r,s,n){t.length;var a=t.concat(),h=s||t,l=this.borderColor,o=(l>>16&255)/255,u=(l>>8&255)/255,_=(255&l)/255,s=[a[0],a[1]],t=[a[a.length-5],a[a.length-4]],l=t[0]+.5*(s[0]-t[0]),t=t[1]+.5*(s[1]-t[1]);a.unshift(l,t,0,0,0),a.push(l,t,0,0,0);var c,d,f,m,p,g,x,v=a.length/5,b=r,y=i/2,T=a[0],A=a[1],E=a[5],S=a[6],w=-(A-S),R=T-E,I=Math.sqrt(w*w+R*R);h.push(T-(w=w/I*y),A-(R=R/I*y),o,u,_,T+w,A+R,o,u,_);for(var M=1;M<v-1;M++)T=a[5*(M-1)],A=a[5*(M-1)+1],E=a[5*M],S=a[5*M+1],m=a[5*(M+1)],d=a[5*(M+1)+1],R=T-E,x=E-m,f=(-(w=(w=-(A-S))/(I=Math.sqrt(w*w+R*R))*y)+T)*(-(R=R/I*y)+S)-(-w+E)*(-R+A),g=(-(p=(p=-(S-d))/(I=Math.sqrt(p*p+x*x))*y)+m)*(-(x=x/I*y)+S)-(-p+E)*(-x+d),x=(c=-R+A-(-R+S))*(p=-p+E-(-p+m))-(m=-x+d-(-x+S))*(d=-w+E-(-w+T)),Math.abs(x)<.1?(x+=10.1,h.push(E-w,S-R,o,u,_,E+w,S+R,o,u,_)):(p=(d*g-p*f)/x,x=(m*f-c*g)/x,h.push(p,x,o,u,_,E-(p-E),S-(x-S),o,u,_));n&&(e=n);for(var C=this.edges+1,M=1;M<C;M++)e.push(b+2*(M-1),b+2*(M-1)+1,b+2*M+1,b+2*M+1,b+2*M,b+2*(M-1));return e.push(b+2*(M-1),b+2*(M-1)+1,b+1,b+1,b,b+2*(M-1)),h},_}(),Yt=function(){function a(t,e,i,r,s,n){this._points=null,this._start=-1,this._repaint=!1,this.earcutTriangles=null,this._mat=y.create(),this._points=i.slice(0,i.length),a.__super.call(this,t,e,0,0,this._points.length/2,r,s,n)}l(a,"laya.webgl.shapes.Polygon",st);var t=a.prototype;return t.rebuild=function(t){this._repaint||(this._points.length=0,this._points=this._points.concat(t))},t.setMatrix=function(t){t.copyTo(this._mat)},t.needUpdate=function(t){return this._repaint=this._mat.a==t.a&&this._mat.b==t.b&&this._mat.c==t.c&&this._mat.d==t.d&&this._mat.tx==t.tx&&this._mat.ty==t.ty,!this._repaint},t.getData=function(t,e,i){var r=0,s=this._points,n=0;if(this.mUint16Array&&this.mFloat32Array&&this._repaint){if(this._start!=i){for(this._start=i,a=[],n=this.earcutTriangles.length,r=0;r<n;r++)a.push(this.earcutTriangles[r]+i);this.mUint16Array=new Uint16Array(a)}}else{this._start=i;for(var a=[],h=[],l=[],o=this.color,u=(o>>16&255)/255,_=(o>>8&255)/255,c=(255&o)/255,n=Math.floor(s.length/2),r=0;r<n;r++)h.push(this.x+s[2*r],this.y+s[2*r+1],u,_,c),l.push(this.x+s[2*r],this.y+s[2*r+1]);for(this.earcutTriangles=nt.earcut(l,null,2),n=this.earcutTriangles.length,r=0;r<n;r++)a.push(this.earcutTriangles[r]+i);this.mUint16Array=new Uint16Array(a),this.mFloat32Array=new Float32Array(h)}t.append(this.mUint16Array),e.append(this.mFloat32Array)},a}(),Xt=function(){function s(){this._matrix=new y,this._matrix4=yt.defaultMatrix4.concat(),s.__super.call(this,1e4),this.shaderValue=new Nt(0,0)}l(s,"laya.webgl.submit.SubmitCanvas",ut);var t=s.prototype;return t.renderSubmit=function(){if(this._ctx_src._targets)return this._ctx_src._targets.flush(this._ctx_src),1;var t=Rt.worldAlpha,e=Rt.worldMatrix4,i=Rt.worldMatrix,r=Rt.worldFilters,s=Rt.worldShaderDefines,n=this.shaderValue,a=this._matrix,h=this._matrix4,l=y.TEMP;return y.mul(a,i,l),h[0]=l.a,h[1]=l.b,h[4]=l.c,h[5]=l.d,h[12]=l.tx,h[13]=l.ty,Rt.worldMatrix=l.clone(),Rt.worldMatrix4=h,Rt.worldAlpha=Rt.worldAlpha*n.alpha,n.filters&&n.filters.length&&(Rt.worldFilters=n.filters,Rt.worldShaderDefines=n.defines),this._ctx_src.flush(),Rt.worldAlpha=t,Rt.worldMatrix4=e,Rt.worldMatrix.destroy(),Rt.worldMatrix=i,Rt.worldFilters=r,Rt.worldShaderDefines=s,1},t.releaseRender=function(){var t=s._cache;this._ctx_src=null,t[t._length++]=this},t.getRenderType=function(){return 10003},s.create=function(t,e,i){var r=s._cache._length?s._cache[--s._cache._length]:new s;r._ctx_src=t;t=r.shaderValue;return t.alpha=e,t.defines.setValue(0),i&&i.length&&t.setFilters(i),r},s._cache=(s._cache=[],s._cache._length=0,s._cache),s}(),Kt=function(){function o(t){this._preIsSameTextureShader=!1,this._isSameTexture=!0,this._texs=new Array,this._texsID=new Array,this._vbPos=new Array,o.__super.call(this,t=void 0===t?1e4:t)}l(o,"laya.webgl.submit.SubmitTexture",ut);var t=o.prototype;return t.releaseRender=function(){var t=o._cache;(t[t._length++]=this).shaderValue.release(),this._preIsSameTextureShader=!1,this._vb=null,this._texs.length=0,this._vbPos.length=0,this._isSameTexture=!0},t.addTexture=function(t,e){this._texsID[this._texs.length]=t._uvID,this._texs.push(t),this._vbPos.push(e)},t.checkTexture=function(){if(this._texs.length<1)this._isSameTexture=!0;else{var t=this.shaderValue.textureHost.bitmap;if(null!==t)for(var e=this._vb.getFloat32Array(),i=0,r=this._texs.length;i<r;i++){var s=this._texs[i];s.active();var n,a=s.uv;this._texsID[i]!==s._uvID&&(this._texsID[i]=s._uvID,e[(n=this._vbPos[i])+2]=a[0],e[n+3]=a[1],e[n+6]=a[2],e[n+7]=a[3],e[n+10]=a[4],e[n+11]=a[5],e[n+14]=a[6],e[n+15]=a[7],this._vb.setNeedUpload()),s.bitmap!==t&&(this._isSameTexture=!1)}}},t.renderSubmit=function(){if(0===this._numEle)return o._shaderSet=!1,1;var t=this.shaderValue.textureHost;if(t){var e=t.source;if(!t.bitmap||!e)return o._shaderSet=!1,1;this.shaderValue.texture=e}this._vb.bind_upload(this._ib);var i=Ct.mainContext;if(G.activeBlendFunction!==this._blendFn&&(i.enable(3042),this._blendFn(i),G.activeBlendFunction=this._blendFn),I.drawCall++,I.trianglesFaces+=this._numEle/3,this._preIsSameTextureShader&&Zt.activeShader&&o._shaderSet?Zt.activeShader.uploadTexture2D(this.shaderValue.texture):this.shaderValue.upload(),o._shaderSet=!0,1<this._texs.length&&!this._isSameTexture)for(var r=t.bitmap,s=0,n=Zt.activeShader,a=0,h=this._texs.length;a<h;a++){var l=this._texs[a];l.bitmap===r&&a+1!==h||(n.uploadTexture2D(l.source),i.drawElements(4,6*(a-s+1),5123,this._startIdx+6*s*yt.BYTES_PIDX),r=l.bitmap,s=a)}else i.drawElements(4,this._numEle,5123,this._startIdx);return 1},o.create=function(t,e,i,r,s){var n=o._cache._length?o._cache[--o._cache._length]:new o;null==i&&((i=n._selfVb||(n._selfVb=ge.create(-1))).clear(),r=0),n._ib=e,n._vb=i,n._startIdx=r*yt.BYTES_PIDX,n._numEle=0;r=t._nBlendType;n._blendFn=(t._targets?G.targetFns:G.fns)[r],n.shaderValue=s,n.shaderValue.setValue(t._shader2D);t=t._shader2D.filters;return t&&n.shaderValue.setFilters(t),n},o._cache=(o._cache=[],o._cache._length=0,o._cache),o._shaderSet=!0,o}(),Qt=function(){function g(){g.__super.call(this,laya.webgl.utils.MeshTexture.const_stride,0,0),this.canReuse=!0,this.setAttributes(laya.webgl.utils.MeshTexture._fixattriInfo)}l(g,"laya.webgl.utils.MeshTexture",wt);var t=g.prototype;return t.addData=function(t,e,i,r,s,n){for(var a=t.length/2,h=this._vb.needSize(a*g.const_stride)>>2,l=this._vb.getFloat32Array(),o=0,u=0;u<a;u++){var _=t[o],c=t[o+1],d=_*r.a+c*r.c+r.tx,c=_*r.b+c*r.d+r.ty;l[h++]=d,l[h++]=c,l[h++]=e[o],l[h++]=e[o+1],o+=2}this._vb.setNeedUpload();var f=this.vertNum;if(0<f){var m=i.length;m>g.tmpIdx.length&&(g.tmpIdx=new Uint16Array(m));for(var p=0;p<m;p++)g.tmpIdx[p]=i[p]+f;this._ib.appendU16Array(g.tmpIdx,i.length)}else this._ib.append(i);this._ib.setNeedUpload(),this.vertNum+=a,this.indexNum+=i.length},t.releaseMesh=function(){this._vb._byteLength=0,this._ib._byteLength=0,this.vertNum=0,this.indexNum=0,laya.webgl.utils.MeshTexture._POOL.push(this)},t.destroy=function(){this._ib.destroy(),this._vb.destroy()},g.getAMesh=function(){return laya.webgl.utils.MeshTexture._POOL.length?laya.webgl.utils.MeshTexture._POOL.pop():new g},g.const_stride=16,g._POOL=[],e(g,["_fixattriInfo",function(){return this._fixattriInfo=[5126,2,0,5126,2,8]},"tmpIdx",function(){return this.tmpIdx=new Uint16Array(4)}]),g}(),Zt=(l(qt,"laya.webgl.shader.BaseShader",E),qt.activeShader=null,qt.bindShader=null,qt);function qt(){qt.__super.call(this),this.lock=!0}var jt=function(e){function u(t,e,i,r,s,n,a,h,l){this._type=0,this._svWidth=NaN,this._svHeight=NaN,this._preRenderTarget=null,this._alreadyResolved=!1,this._looked=!1,this._surfaceFormat=0,this._surfaceType=0,this._depthStencilFormat=0,this._mipMap=!1,this._repeat=!1,this._minFifter=0,this._magFifter=0,this._destroy=!1,void 0===i&&(i=6408),void 0===r&&(r=5121),void 0===s&&(s=34041),void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===h&&(h=-1),void 0===l&&(l=-1),this._type=1,this._w=t,this._h=e,this._surfaceFormat=i,this._surfaceType=r,this._depthStencilFormat=s,p.isConchWebGL&&34041===this._depthStencilFormat&&(this._depthStencilFormat=33189),this._mipMap=n,this._repeat=a,this._minFifter=h,this._magFifter=l,this._createWebGLRenderTarget(),this.bitmap.lock=!0,u.__super.call(this,this.bitmap,P.INV_UV)}l(u,"laya.webgl.resource.RenderTarget2D",e);var t=u.prototype;return x.imps(t,{"laya.resource.IDispose":!0}),t.getType=function(){return this._type},t.getTexture=function(){return this},t.size=function(t,e){this._w==t&&this._h==e||(this._w=t,this._h=e,this.release(),0!=this._w&&0!=this._h&&this._createWebGLRenderTarget())},t.release=function(){this.destroy()},t.recycle=function(){u.POOL.push(this)},t.start=function(){var t=Ct.mainContext;return this._preRenderTarget=Rt.curRenderTarget,Rt.curRenderTarget=this,t.bindFramebuffer(36160,this.bitmap.frameBuffer),this._alreadyResolved=!1,1==this._type&&(t.viewport(0,0,this._w,this._h),this._svWidth=Rt.width,this._svHeight=Rt.height,Rt.width=this._w,Rt.height=this._h,Zt.activeShader=null),this},t.clear=function(t,e,i,r){var s=Ct.mainContext;s.clearColor(t=void 0===t?0:t,e=void 0===e?0:e,i=void 0===i?0:i,r=void 0===r?1:r);var n=16384;switch(this._depthStencilFormat){case 33189:n|=256;break;case 36168:n|=1024;break;case 34041:n|=256,n|=1024}s.clear(n)},t.end=function(){var t=Ct.mainContext;t.bindFramebuffer(36160,this._preRenderTarget?this._preRenderTarget.bitmap.frameBuffer:null),this._alreadyResolved=!0,Rt.curRenderTarget=this._preRenderTarget,1==this._type?(t.viewport(0,0,this._svWidth,this._svHeight),Rt.width=this._svWidth,Rt.height=this._svHeight,Zt.activeShader=null):t.viewport(0,0,x.stage.width,x.stage.height)},t.getData=function(t,e,i,r){var s=Ct.mainContext;if(s.bindFramebuffer(36160,this.bitmap.frameBuffer),!(36053===s.checkFramebufferStatus(36160)))return s.bindFramebuffer(36160,null),null;var n=new Uint8Array(this._w*this._h*4);return s.readPixels(t,e,i,r,this._surfaceFormat,this._surfaceType,n),s.bindFramebuffer(36160,null),n},t.destroy=function(t){void 0===t&&(t=!1),this._destroy||(this._loaded=!1,this.bitmap.offAll(),this.bitmap.disposeResource(),this.bitmap.dispose(),this.offAll(),this.bitmap=null,this._alreadyResolved=!1,this._destroy=!0,e.prototype.destroy.call(this))},t.dispose=function(){},t._createWebGLRenderTarget=function(){this.bitmap=new ue(this.width,this.height,this._surfaceFormat,this._surfaceType,this._depthStencilFormat,this._mipMap,this._repeat,this._minFifter,this._magFifter),this.bitmap.activeResource(),this._alreadyResolved=!0,this._destroy=!1,this._loaded=!0,this.bitmap.on("recovered",this,function(t){this.event("recovered")})},a(0,t,"surfaceFormat",function(){return this._surfaceFormat}),a(0,t,"magFifter",function(){return this._magFifter}),a(0,t,"surfaceType",function(){return this._surfaceType}),a(0,t,"mipMap",function(){return this._mipMap}),a(0,t,"depthStencilFormat",function(){return this._depthStencilFormat}),a(0,t,"minFifter",function(){return this._minFifter}),a(0,t,"source",function(){return this._alreadyResolved?x.superGet(P,this,"source"):null}),u.create=function(t,e,i,r,s,n,a,h,l){void 0===i&&(i=6408),void 0===r&&(r=5121),void 0===s&&(s=34041),void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===h&&(h=-1),void 0===l&&(l=-1);var o=u.POOL.pop();return(o=o||new u(t,e)).bitmap&&o._w==t&&o._h==e&&o._surfaceFormat==i&&o._surfaceType==r&&o._depthStencilFormat==s&&o._mipMap==n&&o._repeat==a&&o._minFifter==h&&o._magFifter==l||(o._w=t,o._h=e,o._surfaceFormat=i,o._surfaceType=r,o._depthStencilFormat=s,p.isConchWebGL&&34041===o._depthStencilFormat&&(o._depthStencilFormat=33189),o._mipMap=n,o._repeat=a,o._minFifter=h,o._magFifter=l,o.release(),o._createWebGLRenderTarget()),o},u.TYPE2D=1,u.TYPE3D=2,u.POOL=[],u}(P),$t=function(){function t(){this._glBuffer=null,this._buffer=null,this._bufferType=0,this._bufferUsage=0,this._byteLength=0,t.__super.call(this),t._gl=Ct.mainContext}l(t,"laya.webgl.utils.Buffer",E);var e=t.prototype;return e._bind=function(){this.activeResource(),t._bindActive[this._bufferType]!==this._glBuffer&&(34962===this._bufferType&&(t._bindVertexBuffer=this._glBuffer),t._gl.bindBuffer(this._bufferType,t._bindActive[this._bufferType]=this._glBuffer),Zt.activeShader=null)},e.recreateResource=function(){this._glBuffer||(this._glBuffer=t._gl.createBuffer()),this.completeCreate()},e.disposeResource=function(){this._glBuffer&&(Ct.mainContext.deleteBuffer(this._glBuffer),this._glBuffer=null),this.memorySize=0},a(0,e,"bufferUsage",function(){return this._bufferUsage}),t._gl=null,t._bindActive={},t._bindVertexBuffer=null,t._enableAtributes=[],t}(),Jt=(l(te,"laya.webgl.shader.d2.skinAnishader.SkinSV",Nt),te);function te(t){this.texcoord=null,this.offsetX=300,this.offsetY=0,te.__super.call(this,512,0);var e=8*yt.BYTES_PE;this.position=[2,5126,!1,e,0],this.texcoord=[2,5126,!1,e,2*yt.BYTES_PE],this.color=[4,5126,!1,e,4*yt.BYTES_PE]}var ee=(l(ie,"laya.webgl.shader.d2.value.Color2dSV",Nt),ie.prototype.setValue=function(t){t.fillStyle&&(this.color=t.fillStyle._color._color),t.strokeStyle&&(this.color=t.strokeStyle._color._color)},ie);function ie(t){ie.__super.call(this,2,0),this.color=[]}var re=function(){function e(t){this.u_colorMatrix=null,this.strength=0,this.colorMat=null,this.colorAlpha=null,this.u_TexRange=[0,1,0,1],this.u_offset=[0,0],this.texcoord=Nt._TEXCOORD,e.__super.call(this,256,0)}l(e,"laya.webgl.shader.d2.value.FillTextureSV",Nt);var t=e.prototype;return t.setValue=function(t){this.ALPHA=t.ALPHA,t.filters&&this.setFilters(t.filters)},t.clear=function(){this.texture=null,this.shader=null,this.defines.setValue(0)},e}(),se=function(){function e(t){this.u_colorMatrix=null,this.strength=0,this.blurInfo=null,this.colorMat=null,this.colorAlpha=null,this.texcoord=Nt._TEXCOORD,e.__super.call(this,1,t=void 0===t?0:t)}l(e,"laya.webgl.shader.d2.value.TextureSV",Nt);var t=e.prototype;return t.setValue=function(t){this.ALPHA=t.ALPHA,t.filters&&this.setFilters(t.filters)},t.clear=function(){this.texture=null,this.shader=null,this.defines.setValue(0)},e}(),ne=(l(ae,"laya.webgl.shader.d2.value.PrimitiveSV",Nt),ae);function ae(t){this.a_color=null,this.u_pos=[0,0],ae.__super.call(this,4,0),this.position=[2,5126,!1,5*yt.BYTES_PE,0],this.a_color=[3,5126,!1,5*yt.BYTES_PE,2*yt.BYTES_PE]}var he=function(t){function e(){this._atlaser=null,this._flashCacheImage=null,this._flashCacheImageNeedFlush=!1,e.__super.call(this)}l(e,"laya.webgl.atlas.AtlasWebGLCanvas",t);var i=e.prototype;return i.recreateResource=function(){var t=Ct.mainContext,e=this._source=t.createTexture(),i=Pt.curBindTexTarget,r=Pt.curBindTexValue;Pt.bindTexture(t,3553,e),t.texImage2D(3553,0,6408,this._w,this._h,0,6408,5121,null),t.texParameteri(3553,10241,9729),t.texParameteri(3553,10240,9729),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071),i&&r&&Pt.bindTexture(t,i,r),this.memorySize=this._w*this._h*4,this.completeCreate()},i.disposeResource=function(){this._source&&(Ct.mainContext.deleteTexture(this._source),this._source=null,this.memorySize=0)},i.texSubImage2D=function(t,e,i){var r,s,n;p.isFlash?(this._flashCacheImage||(this._flashCacheImage=f.create(""),this._flashCacheImage._image.createCanvas(this._w,this._h)),n=i.bitmapdata,this._flashCacheImage._image.copyPixels(n,0,0,n.width,n.height,t,e),this._flashCacheImageNeedFlush||(this._flashCacheImageNeedFlush=!0)):(r=Ct.mainContext,s=Pt.curBindTexTarget,n=Pt.curBindTexValue,Pt.bindTexture(r,3553,this._source),p.isConchWebGL?(i!==ConchTextCanvas&&(0<=t-1&&r.texSubImage2DEx(!0,3553,0,t-1,e,6408,5121,i),t+1<=this._w&&r.texSubImage2DEx(!0,3553,0,t+1,e,6408,5121,i),0<=e-1&&r.texSubImage2DEx(!0,3553,0,t,e-1,6408,5121,i),e+1<=this._h&&r.texSubImage2DEx(!0,3553,0,t,e+1,6408,5121,i)),r.texSubImage2DEx(!0,3553,0,t,e,6408,5121,i)):(r.pixelStorei(37441,!0),0<=t-1&&r.texSubImage2D(3553,0,t-1,e,6408,5121,i),t+1<=this._w&&r.texSubImage2D(3553,0,t+1,e,6408,5121,i),0<=e-1&&r.texSubImage2D(3553,0,t,e-1,6408,5121,i),e+1<=this._h&&r.texSubImage2D(3553,0,t,e+1,6408,5121,i),r.texSubImage2D(3553,0,t,e,6408,5121,i),r.pixelStorei(37441,!1)),s&&n&&Pt.bindTexture(r,s,n))},i.texSubImage2DPixel=function(t,e,i,r,s){var n=Ct.mainContext,a=Pt.curBindTexTarget,h=Pt.curBindTexValue;Pt.bindTexture(n,3553,this._source);s=new Uint8Array(s.data);p.isConchWebGL?n.texSubImage2DEx(!0,3553,0,t,e,i,r,6408,5121,s):(n.pixelStorei(37441,!0),n.texSubImage2D(3553,0,t,e,i,r,6408,5121,s),n.pixelStorei(37441,!1)),a&&h&&Pt.bindTexture(n,a,h)},a(0,i,"width",t.prototype._$get_width,function(t){this._w=t}),a(0,i,"height",t.prototype._$get_height,function(t){this._h=t}),e}(i),le=function(){function s(){this.flipY=!0,this.alwaysChange=!1,s.__super.call(this)}l(s,"laya.webgl.resource.WebGLCanvas",i);var t=s.prototype;return t.getCanvas=function(){return this._canvas},t.clear=function(){this._ctx&&this._ctx.clear()},t.destroy=function(){this._ctx&&this._ctx.destroy(),this._ctx=null,laya.resource.Resource.prototype.destroy.call(this)},t._setContext=function(t){this._ctx=t},t.getContext=function(t,e){return this._ctx||(this._ctx=s._createContext(this))},t.size=function(t,e){this._w==t&&this._h==e||(this._w=t,this._h=e,this._ctx&&this._ctx.size(t,e),this._canvas&&(this._canvas.height=e,this._canvas.width=t))},t.activeResource=function(t){void 0===t&&(t=!1),this._source||this.recreateResource()},t.recreateResource=function(){this.createWebGlTexture(),this.completeCreate()},t.disposeResource=function(){this._source&&!this.iscpuSource&&(Ct.mainContext.deleteTexture(this._source),this._source=null,this.memorySize=0)},t.createWebGlTexture=function(){var t=Ct.mainContext;this._canvas;var e=this._source=t.createTexture();this.iscpuSource=!1;var i=Pt.curBindTexTarget,r=Pt.curBindTexValue;Pt.bindTexture(t,3553,e),t.pixelStorei(37440,this.flipY?1:0),p.isConchWebGL?t.texImage2DEx(s.premulAlpha,3553,0,6408,6408,5121,this._imgData):(s.premulAlpha&&t.pixelStorei(37441,!0),t.texImage2D(3553,0,6408,6408,5121,this._imgData),s.premulAlpha&&t.pixelStorei(37441,!1)),t.texParameteri(3553,10240,9729),t.texParameteri(3553,10241,9729),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071),t.pixelStorei(37440,0),this.memorySize=this._w*this._h*4,i&&r&&Pt.bindTexture(t,i,r)},t.reloadCanvasData=function(){var t=Ct.mainContext;if(!this._source)throw"reloadCanvasData error, gl texture not created!";var e=Pt.curBindTexTarget,i=Pt.curBindTexValue;Pt.bindTexture(t,3553,this._source),p.isConchWebGL?t.texImage2DEx(s.premulAlpha,3553,0,6408,6408,5121,this._imgData):(s.premulAlpha&&t.pixelStorei(37441,!0),t.texImage2D(3553,0,6408,6408,5121,this._imgData),s.premulAlpha&&t.pixelStorei(37441,!1)),t.pixelStorei(37440,0),e&&i&&Pt.bindTexture(t,e,i)},t.texSubImage2D=function(t,e,i){var r=Ct.mainContext,s=Pt.curBindTexTarget,n=Pt.curBindTexValue;Pt.bindTexture(r,3553,this._source),p.isConchWebGL?r.texSubImage2DEx(!0,3553,0,e,i,6408,5121,t._source):(r.pixelStorei(37441,!0),r.texSubImage2D(3553,0,e,i,6408,5121,t._source),r.pixelStorei(37441,!1)),s&&n&&Pt.bindTexture(r,s,n)},t.toBase64=function(t,e,i){var r=null;this._canvas&&(r=this._canvas.toDataURL(t,e)),i.call(this,r)},a(0,t,"context",function(){return this._ctx}),a(0,t,"source",function(){return this.alwaysChange&&this.reloadCanvasData(),this._source}),a(0,t,"asBitmap",null,function(t){this._ctx&&(this._ctx.asBitmap=t)}),s._createContext=null,s.premulAlpha=!1,s}(),oe=function(){function r(t,e){r.__super.call(this),this.char=t,this.isSpace=" "===t,this.xs=e.scaleX,this.ys=e.scaleY,this.font=e.font.toString(),this.fontSize=e.font.size,this.fillColor=e.fillColor,this.borderColor=e.borderColor,this.lineWidth=e.lineWidth,this.underLine=e.underLine;e=p.isConchApp;e?((i=ConchTextCanvas)._source=ConchTextCanvas,i._source.canvas=ConchTextCanvas):i=o.canvas.source,this.canvas=i,this._enableMerageInAtlas=!0,this._ctx=e?i:this.canvas.getContext("2d",void 0);var i=D.measureText(this.char,this.font);this.cw=i.width*this.xs,this.ch=(i.height||this.fontSize)*this.ys,this.onresize(this.cw+2*v.CborderSize,this.ch+2*v.CborderSize),this.texture=new P(this)}l(r,"laya.webgl.resource.WebGLCharImage",i);var t=r.prototype;return x.imps(t,{"laya.webgl.resource.IMergeAtlasBitmap":!0}),t.active=function(){this.texture.active()},t.recreateResource=function(){var t,e=p.isConchApp;this.onresize(this.cw+2*v.CborderSize,this.ch+2*v.CborderSize),this.canvas&&(this.canvas.height=this._h,this.canvas.width=this._w),e?(e=this.fontSize,1==this.xs&&1==this.ys||(e=parseInt(e*(this.xs>this.ys?this.xs:this.ys)+"")),t=(t="normal 100 "+this.font).replace(r._fontSizeReg,e),this.borderColor&&(t+=" 1 "+this.borderColor),this._ctx.font=t,this._ctx.textBaseline="top",this._ctx.fillStyle=this.fillColor,this._ctx.fillText(this.char,v.CborderSize,v.CborderSize,null,null,null)):(this._ctx.save(),this._ctx.lineJoin="round",this._ctx.clearRect(0,0,this.cw+2*v.CborderSize,this.ch+2*v.CborderSize),this._ctx.font=this.font,L.RightToLeft&&(this._ctx.textAlign="end"),this._ctx.textBaseline="top",1!=this.xs||1!=this.ys?this._ctx.setTransform(this.xs,0,0,this.ys,v.CborderSize,v.CborderSize):this._ctx.setTransform(1,0,0,1,v.CborderSize,v.CborderSize),this.fillColor&&this.borderColor?(this._ctx.strokeStyle=this.borderColor,this._ctx.lineWidth=this.lineWidth,this._ctx.strokeText(this.char,0,0,null,null,0,null),this._ctx.fillStyle=this.fillColor,this._ctx.fillText(this.char,0,0)):-1===this.lineWidth?(this._ctx.fillStyle=this.fillColor||"white",this._ctx.fillText(this.char,0,0)):(this._ctx.strokeStyle=this.borderColor||"white",this._ctx.lineWidth=this.lineWidth,this._ctx.strokeText(this.char,0,0,null,null,0,null)),this.underLine&&(this._ctx.lineWidth=1,this._ctx.strokeStyle=this.fillColor,this._ctx.beginPath(),this._ctx.moveTo(0,this.fontSize+1),t=this._ctx.measureText(this.char).width+1,this._ctx.lineTo(t,this.fontSize+1),this._ctx.stroke()),this._ctx.restore()),this.borderSize=v.CborderSize,this.completeCreate()},t.onresize=function(t,e){this._w=t,this._h=e,this._allowMerageInAtlas=!0},t.clearAtlasSource=function(){},a(0,t,"allowMerageInAtlas",function(){return this._allowMerageInAtlas}),a(0,t,"atlasSource",function(){return this.canvas}),a(0,t,"atlasImgData",function(){return!r.canUseCanvas&&this._ctx.getImageData?this._ctx.getImageData(0,0,this._w,this._h):null}),a(0,t,"enableMerageInAtlas",function(){return this._enableMerageInAtlas},function(t){this._enableMerageInAtlas=t}),r.createOneChar=function(t,e){return new r(t,e)},r.canUseCanvas=!0,r._fontSizeReg=new RegExp("\\d+(?=px)","g"),r}(),ue=function(){function o(t,e,i,r,s,n,a,h,l){void 0===i&&(i=6408),void 0===r&&(r=5121),void 0===s&&(s=34041),void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===h&&(h=-1),void 0===l&&(l=1),o.__super.call(this),this._w=t,this._h=e,this._surfaceFormat=i,this._surfaceType=r,this._depthStencilFormat=s,p.isConchWebGL&&34041===this._depthStencilFormat&&(this._depthStencilFormat=33189),this._mipMap=n,this._repeat=a,this._minFifter=h,this._magFifter=l}l(o,"laya.webgl.resource.WebGLRenderTarget",i);var t=o.prototype;return t.recreateResource=function(){var t=Ct.mainContext;this._frameBuffer||(this._frameBuffer=t.createFramebuffer()),this._source||(this._source=t.createTexture());var e=Pt.curBindTexTarget,i=Pt.curBindTexValue;Pt.bindTexture(t,3553,this._source),t.texImage2D(3553,0,6408,this._w,this._h,0,this._surfaceFormat,this._surfaceType,null);var r=this._minFifter,s=this._magFifter,n=this._repeat?10497:33071,a=u.isPOT(this._w,this._h);if(a?(this._mipMap?-1!==r||(r=9987):-1!==r||(r=9729),-1!==s||(s=9729),t.texParameteri(3553,10241,r),t.texParameteri(3553,10240,s),t.texParameteri(3553,10242,n),t.texParameteri(3553,10243,n),this._mipMap&&t.generateMipmap(3553)):(-1!==s||(s=9729),t.texParameteri(3553,10241,r=-1===r?9729:r),t.texParameteri(3553,10240,s),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071)),t.bindFramebuffer(36160,this._frameBuffer),t.framebufferTexture2D(36160,36064,3553,this._source,0),this._depthStencilFormat)switch(this._depthStencilBuffer||(this._depthStencilBuffer=t.createRenderbuffer()),t.bindRenderbuffer(36161,this._depthStencilBuffer),t.renderbufferStorage(36161,this._depthStencilFormat,this._w,this._h),this._depthStencilFormat){case 33189:t.framebufferRenderbuffer(36160,36096,36161,this._depthStencilBuffer);break;case 36168:t.framebufferRenderbuffer(36160,36128,36161,this._depthStencilBuffer);break;case 34041:t.framebufferRenderbuffer(36160,33306,36161,this._depthStencilBuffer)}t.bindFramebuffer(36160,null),e&&i&&Pt.bindTexture(t,e,i),t.bindRenderbuffer(36161,null),a&&this._mipMap?this.memorySize=this._w*this._h*4*(1+1/3):this.memorySize=this._w*this._h*4,this.completeCreate()},t.disposeResource=function(){this._frameBuffer&&(Ct.mainContext.deleteTexture(this._source),Ct.mainContext.deleteFramebuffer(this._frameBuffer),Ct.mainContext.deleteRenderbuffer(this._depthStencilBuffer),this._source=null,this._frameBuffer=null,this._depthStencilBuffer=null,this.memorySize=0)},a(0,t,"depthStencilBuffer",function(){return this._depthStencilBuffer}),a(0,t,"frameBuffer",function(){return this._frameBuffer}),o}(),_e=function(){function h(t,e,i,r,s,n,a){this.offsetX=0,this.offsetY=0,h.__super.call(this),this.repeat=!0,this.mipmap=!1,this.minFifter=-1,this.magFifter=-1,this.atlasImage=n,this.canvas=t,this._ctx=t.getContext("2d",void 0),this._w=r,this._h=s,this.offsetX=e,this.offsetY=i,this.src=a,this._enableMerageInAtlas=!0,U.enabled&&this._w<U.atlasLimitWidth&&this._h<U.atlasLimitHeight?this._allowMerageInAtlas=!0:this._allowMerageInAtlas=!1}l(h,"laya.webgl.resource.WebGLSubImage",i);var t=h.prototype;return x.imps(t,{"laya.webgl.resource.IMergeAtlasBitmap":!0}),t.size=function(t,e){this._w=t,this._h=e,this._ctx&&this._ctx.size(t,e),this.canvas&&(this.canvas.height=e,this.canvas.width=t)},t.recreateResource=function(){this.size(this._w,this._h),this._ctx.drawImage(this.atlasImage,this.offsetX,this.offsetY,this._w,this._h,0,0,this._w,this._h),this._allowMerageInAtlas&&this._enableMerageInAtlas?this.memorySize=0:this.createWebGlTexture(),this.completeCreate()},t.createWebGlTexture=function(){var t=Ct.mainContext;if(!this.canvas)throw"create GLTextur err:no data:"+this.canvas;var e=this._source=t.createTexture(),i=Pt.curBindTexTarget,r=Pt.curBindTexValue;Pt.bindTexture(t,3553,e),p.isConchWebGL?t.texImage2DEx(!0,3553,0,6408,6408,5121,this.canvas):(t.pixelStorei(37441,!0),t.texImage2D(3553,0,6408,6408,5121,this.canvas),t.pixelStorei(37441,!1));var s=this.minFifter,n=this.magFifter,a=this.repeat?10497:33071,e=u.isPOT(this.width,this.height);e?(this.mipmap?-1!==s||(s=9987):-1!==s||(s=9729),t.texParameteri(3553,10240,n=-1===n?9729:n),t.texParameteri(3553,10241,s),t.texParameteri(3553,10242,a),t.texParameteri(3553,10243,a),this.mipmap&&t.generateMipmap(3553)):(-1!==n||(n=9729),t.texParameteri(3553,10241,s=-1===s?9729:s),t.texParameteri(3553,10240,n),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071)),i&&r&&Pt.bindTexture(t,i,r),this.canvas=null,e&&this.mipmap?this.memorySize=this._w*this._h*4*(1+1/3):this.memorySize=this._w*this._h*4},t.disposeResource=function(){U.enabled&&this._allowMerageInAtlas||!this._source||(Ct.mainContext.deleteTexture(this._source),this._source=null,this.memorySize=0)},t.clearAtlasSource=function(){},a(0,t,"allowMerageInAtlas",function(){return this._allowMerageInAtlas}),a(0,t,"atlasSource",function(){return this.canvas}),a(0,t,"enableMerageInAtlas",function(){return this._allowMerageInAtlas},function(t){this._allowMerageInAtlas=t}),h}(),ce=function(){function o(t,e,i,r){if(this._curActTexIndex=0,this.tag={},this._program=null,this._params=null,this._paramsMap={},this._offset=0,o.__super.call(this),!t||!e)throw"Shader Error";this._id=++o._count,this._vs=t,this._ps=e,this._nameMap=r||{},null!=i&&(o.sharders[i]=this)}l(o,"laya.webgl.shader.Shader",Zt);var t=o.prototype;return t.recreateResource=function(){this._compile(),this.completeCreate(),this.memorySize=0},t.disposeResource=function(){Ct.mainContext.deleteShader(this._vshader),Ct.mainContext.deleteShader(this._pshader),Ct.mainContext.deleteProgram(this._program),this._vshader=this._pshader=this._program=null,this._params=null,this._paramsMap={},this.memorySize=0,this._curActTexIndex=0},t._compile=function(){if(this._vs&&this._ps&&!this._params){this._reCompile=!0,this._params=[];var t=[this._vs,this._ps],e=Ct.mainContext;if(this._program=e.createProgram(),this._vshader=o._createShader(e,t[0],35633),this._pshader=o._createShader(e,t[1],35632),e.attachShader(this._program,this._vshader),e.attachShader(this._program,this._pshader),e.linkProgram(this._program),!p.isConchApp&&!e.getProgramParameter(this._program,35714))throw e.getProgramInfoLog(this._program);for(var i,r=0,s=0,s=p.isConchApp?e.getProgramParameterEx(this._vs,this._ps,"",35721):e.getProgramParameter(this._program,35721),r=0;r<s;r++){var n=null,a={vartype:"attribute",glfun:null,ivartype:0,attrib:n=p.isConchApp?e.getActiveAttribEx(this._vs,this._ps,"",r):e.getActiveAttrib(this._program,r),location:e.getAttribLocation(this._program,n.name),name:n.name,type:n.type,isArray:!1,isSame:!1,preValue:null,indexOfParams:0};this._params.push(a)}var h=0,h=p.isConchApp?e.getProgramParameterEx(this._vs,this._ps,"",35718):e.getProgramParameter(this._program,35718);for(r=0;r<h;r++){var l=null,l=p.isConchApp?e.getActiveUniformEx(this._vs,this._ps,"",r):e.getActiveUniform(this._program,r);0<(a={vartype:"uniform",glfun:null,ivartype:1,attrib:n,location:e.getUniformLocation(this._program,l.name),name:l.name,type:l.type,isArray:!1,isSame:!1,preValue:null,indexOfParams:0}).name.indexOf("[0]")&&(a.name=a.name.substr(0,a.name.length-3),a.isArray=!0,a.location=e.getUniformLocation(this._program,a.name)),this._params.push(a)}for(r=0,i=this._params.length;r<i;r++)if((a=this._params[r]).indexOfParams=r,a.index=1,a.value=[a.location,null],a.codename=a.name,a.name=this._nameMap[a.codename]||a.codename,(this._paramsMap[a.name]=a)._this=this,a.uploadedValue=[],"attribute"!==a.vartype)switch(a.type){case 5124:a.fun=a.isArray?this._uniform1iv:this._uniform1i;break;case 5126:a.fun=a.isArray?this._uniform1fv:this._uniform1f;break;case 35664:a.fun=a.isArray?this._uniform_vec2v:this._uniform_vec2;break;case 35665:a.fun=a.isArray?this._uniform_vec3v:this._uniform_vec3;break;case 35666:a.fun=a.isArray?this._uniform_vec4v:this._uniform_vec4;break;case 35678:a.fun=this._uniform_sampler2D;break;case 35680:a.fun=this._uniform_samplerCube;break;case 35676:a.glfun=e.uniformMatrix4fv,a.fun=this._uniformMatrix4fv;break;case 35670:a.fun=this._uniform1i;break;case 35674:case 35675:default:throw new Error("compile shader err!")}else a.fun=this._attribute}},t.getUniform=function(t){return this._paramsMap[t]},t._attribute=function(t,e){var i=Ct.mainContext,r=$t._enableAtributes,t=t.location;return r[t]||i.enableVertexAttribArray(t),i.vertexAttribPointer(t,e[0],e[1],e[2],e[3],e[4]+this._offset),r[t]=$t._bindVertexBuffer,1},t._uniform1f=function(t,e){var i=t.uploadedValue;return i[0]!==e?(Ct.mainContext.uniform1f(t.location,i[0]=e),1):0},t._uniform1fv=function(t,e){if(e.length<4){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]||i[3]!==e[3]?(Ct.mainContext.uniform1fv(t.location,e),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],1):0}return Ct.mainContext.uniform1fv(t.location,e),1},t._uniform_vec2=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]?(Ct.mainContext.uniform2f(t.location,i[0]=e[0],i[1]=e[1]),1):0},t._uniform_vec2v=function(t,e){if(e.length<2){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]||i[3]!==e[3]?(Ct.mainContext.uniform2fv(t.location,e),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],1):0}return Ct.mainContext.uniform2fv(t.location,e),1},t._uniform_vec3=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]?(Ct.mainContext.uniform3f(t.location,i[0]=e[0],i[1]=e[1],i[2]=e[2]),1):0},t._uniform_vec3v=function(t,e){return Ct.mainContext.uniform3fv(t.location,e),1},t._uniform_vec4=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]||i[3]!==e[3]?(Ct.mainContext.uniform4f(t.location,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]),1):0},t._uniform_vec4v=function(t,e){return Ct.mainContext.uniform4fv(t.location,e),1},t._uniformMatrix2fv=function(t,e){return Ct.mainContext.uniformMatrix2fv(t.location,!1,e),1},t._uniformMatrix3fv=function(t,e){return Ct.mainContext.uniformMatrix3fv(t.location,!1,e),1},t._uniformMatrix4fv=function(t,e){return Ct.mainContext.uniformMatrix4fv(t.location,!1,e),1},t._uniform1i=function(t,e){var i=t.uploadedValue;return i[0]!==e?(Ct.mainContext.uniform1i(t.location,i[0]=e),1):0},t._uniform1iv=function(t,e){return Ct.mainContext.uniform1iv(t.location,e),1},t._uniform_ivec2=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]?(Ct.mainContext.uniform2i(t.location,i[0]=e[0],i[1]=e[1]),1):0},t._uniform_ivec2v=function(t,e){return Ct.mainContext.uniform2iv(t.location,e),1},t._uniform_vec3i=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]?(Ct.mainContext.uniform3i(t.location,i[0]=e[0],i[1]=e[1],i[2]=e[2]),1):0},t._uniform_vec3vi=function(t,e){return Ct.mainContext.uniform3iv(t.location,e),1},t._uniform_vec4i=function(t,e){var i=t.uploadedValue;return i[0]!==e[0]||i[1]!==e[1]||i[2]!==e[2]||i[3]!==e[3]?(Ct.mainContext.uniform4i(t.location,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]),1):0},t._uniform_vec4vi=function(t,e){return Ct.mainContext.uniform4iv(t.location,e),1},t._uniform_sampler2D=function(t,e){var i=Ct.mainContext,r=t.uploadedValue;return null==r[0]?(r[0]=this._curActTexIndex,i.uniform1i(t.location,this._curActTexIndex),i.activeTexture(o._TEXTURES[this._curActTexIndex]),Pt.bindTexture(i,3553,e),this._curActTexIndex++,1):(i.activeTexture(o._TEXTURES[r[0]]),Pt.bindTexture(i,3553,e),0)},t._uniform_samplerCube=function(t,e){var i=Ct.mainContext,r=t.uploadedValue;return null==r[0]?(r[0]=this._curActTexIndex,i.uniform1i(t.location,this._curActTexIndex),i.activeTexture(o._TEXTURES[this._curActTexIndex]),Pt.bindTexture(i,34067,e),this._curActTexIndex++,1):(i.activeTexture(o._TEXTURES[r[0]]),Pt.bindTexture(i,34067,e),0)},t._noSetValue=function(t){console.log("no....:"+t.name)},t.uploadOne=function(t,e){this.activeResource(),Pt.UseProgram(this._program);t=this._paramsMap[t];t.fun.call(this,t,e)},t.uploadTexture2D=function(t){I.shaderCall++;var e=Ct.mainContext;e.activeTexture(33984),Pt.bindTexture(e,3553,t)},t.upload=function(t,e){(Zt.activeShader=Zt.bindShader=this)._lastUseFrameCount===I.loopCount||this.activeResource(),Pt.UseProgram(this._program),this._reCompile?(e=this._params,this._reCompile=!1):e=e||this._params;Ct.mainContext;for(var i,r,s=e.length,n=0,a=0;a<s;a++)null!==(r=t[(i=e[a]).name])&&(n+=i.fun.call(this,i,r));I.shaderCall+=n},t.uploadArray=function(t,e,i){Zt.activeShader=this,(Zt.bindShader=this).activeResource(),Pt.UseProgram(this._program);this._params;for(var r,s,n=0,a=e-2;0<=a;a-=2)(s=this._paramsMap[t[a]])&&null!=(r=t[a+1])&&(i&&i[s.name]&&i[s.name].bind(),n+=s.fun.call(this,s,r));I.shaderCall+=n},t.getParams=function(){return this._params},o.getShader=function(t){return o.sharders[t]},o.create=function(t,e,i,r){return new o(t,e,i,r)},o.withCompile=function(t,e,i,r){if(i&&o.sharders[i])return o.sharders[i];var s=o._preCompileShader[2e-4*t];if(!s)throw new Error("withCompile shader err!"+t);return s.createShader(e,i,r)},o.withCompile2D=function(t,e,i,r,s){if(r&&o.sharders[r])return o.sharders[r];var n=o._preCompileShader[2e-4*t+e];if(!n)throw new Error("withCompile shader err!"+t+" "+e);return n.createShader(i,r,s)},o.addInclude=function(t,e){Mt.addInclude(t,e)},o.preCompile=function(t,e,i,r){t*=2e-4;o._preCompileShader[t]=new Mt(t,e,i,r)},o.preCompile2D=function(t,e,i,r,s){e=2e-4*t+e;o._preCompileShader[e]=new Mt(e,i,r,s)},o._createShader=function(t,e,i){i=t.createShader(i);return t.shaderSource(i,e),t.compileShader(i),i},o._TEXTURES=[33984,33985,33986,33987,33988,33989,33990,,33991,33992],o._count=0,o._preCompileShader={},o.SHADERNAME2ID=2e-4,o.sharders=(o.sharders=[],o.sharders.length=32,o.sharders),e(o,["nameKey",function(){return this.nameKey=new M}]),o}(),de=function(t){function e(){this._maxsize=0,this._upload=!0,this._uploadSize=0,e.__super.call(this),this.lock=!0}l(e,"laya.webgl.utils.Buffer2D",t);var i=e.prototype;return i.needSize=function(t){var e=this._byteLength;return t&&((t=this._byteLength+t)<=this._buffer.byteLength||this._resizeBuffer(t<<1,!0),this._byteLength=t),e},i._bufferData=function(){this._maxsize=Math.max(this._maxsize,this._byteLength),I.loopCount%30==0&&(this._buffer.byteLength>this._maxsize+64&&(this.memorySize=this._buffer.byteLength,this._buffer=this._buffer.slice(0,this._maxsize+64),this._checkArrayUse()),this._maxsize=this._byteLength),this._uploadSize<this._buffer.byteLength&&(this._uploadSize=this._buffer.byteLength,$t._gl.bufferData(this._bufferType,this._uploadSize,this._bufferUsage),this.memorySize=this._uploadSize),$t._gl.bufferSubData(this._bufferType,0,this._buffer)},i._bufferSubData=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this._maxsize=Math.max(this._maxsize,this._byteLength),I.loopCount%30==0&&(this._buffer.byteLength>this._maxsize+64&&(this.memorySize=this._buffer.byteLength,this._buffer=this._buffer.slice(0,this._maxsize+64),this._checkArrayUse()),this._maxsize=this._byteLength),this._uploadSize<this._buffer.byteLength&&(this._uploadSize=this._buffer.byteLength,$t._gl.bufferData(this._bufferType,this._uploadSize,this._bufferUsage),this.memorySize=this._uploadSize),e||i?(i=this._buffer.slice(e,i),$t._gl.bufferSubData(this._bufferType,t,i)):$t._gl.bufferSubData(this._bufferType,t,this._buffer)},i._checkArrayUse=function(){},i._bind_upload=function(){return!!this._upload&&(this._upload=!1,this._bind(),this._bufferData(),!0)},i._bind_subUpload=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),!!this._upload&&(this._upload=!1,this._bind(),this._bufferSubData(t,e,i),!0)},i._resizeBuffer=function(t,e){return t<this._buffer.byteLength||(this.memorySize=t,e&&this._buffer&&0<this._buffer.byteLength?(e=new ArrayBuffer(t),new Uint8Array(e).set(new Uint8Array(this._buffer),0),this._buffer=e):this._buffer=new ArrayBuffer(t),this._checkArrayUse(),this._upload=!0),this},i.append=function(t){this._upload=!0;var e,i=t.byteLength;t instanceof Uint8Array?(this._resizeBuffer(this._byteLength+i,!0),e=new Uint8Array(this._buffer,this._byteLength)):t instanceof Uint16Array?(this._resizeBuffer(this._byteLength+i,!0),e=new Uint16Array(this._buffer,this._byteLength)):t instanceof Float32Array&&(this._resizeBuffer(this._byteLength+i,!0),e=new Float32Array(this._buffer,this._byteLength)),e.set(t,0),this._byteLength+=i,this._checkArrayUse()},i.appendU16Array=function(t,e){this._resizeBuffer(this._byteLength+2*e,!0);for(var i=new Uint16Array(this._buffer,this._byteLength,e),r=0;r<e;r++)i[r]=t[r];this._byteLength+=2*e,this._checkArrayUse()},i.appendEx=function(t,e){this._upload=!0;var i=t.byteLength;this._resizeBuffer(this._byteLength+i,!0),new e(this._buffer,this._byteLength).set(t,0),this._byteLength+=i,this._checkArrayUse()},i.appendEx2=function(t,e,i,r){void 0===r&&(r=1),this._upload=!0;var s=0;this._resizeBuffer(this._byteLength+(s=i*r),!0);for(var n=new e(this._buffer,this._byteLength),a=0,a=0;a<i;a++)n[a]=t[a];this._byteLength+=s,this._checkArrayUse()},i.getBuffer=function(){return this._buffer},i.setNeedUpload=function(){this._upload=!0},i.getNeedUpload=function(){return this._upload},i.upload=function(){var t=this._bind_upload();return $t._gl.bindBuffer(this._bufferType,null),$t._bindActive[this._bufferType]=null,Zt.activeShader=null,t},i.subUpload=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0);i=this._bind_subUpload();return $t._gl.bindBuffer(this._bufferType,null),$t._bindActive[this._bufferType]=null,Zt.activeShader=null,i},i.disposeResource=function(){t.prototype.disposeResource.call(this),this._upload=!0,this._uploadSize=0},i.clear=function(){this._byteLength=0,this._upload=!0},a(0,i,"bufferLength",function(){return this._buffer.byteLength}),a(0,i,"byteLength",null,function(t){this._byteLength!==t&&(t<=this._buffer.byteLength||this._resizeBuffer(2*t+256,!0),this._byteLength=t)}),e.__int__=function(t){pe.QuadrangleIB=pe.create(35044),At.fillIBQuadrangle(pe.QuadrangleIB,16)},e.FLOAT32=4,e.SHORT=2,e}($t),fe=(function(e){function i(t){this.u_blurX=!1,this.u_color=null,this.u_offset=null,this.u_strength=NaN,this.u_texW=0,this.u_texH=0,i.__super.call(this,9)}l(i,"laya.webgl.shader.d2.value.GlowSV",e);var t=i.prototype;t.setValue=function(t){e.prototype.setValue.call(this,t)},t.clear=function(){e.prototype.clear.call(this)}}(se),function(t){function e(t){e.__super.call(this,64),this.defines.add(64)}l(e,"laya.webgl.shader.d2.value.TextSV",t);var i=e.prototype;return i.release=function(){(e.pool[e._length++]=this).clear()},i.clear=function(){t.prototype.clear.call(this)},e.create=function(){return e._length?e.pool[--e._length]:new e(null)},e.pool=[],e._length=0,e}(se)),me=function(t){function s(t,e,i,r){this._params2dQuick1=null,this._params2dQuick2=null,this._shaderValueWidth=NaN,this._shaderValueHeight=NaN,s.__super.call(this,t,e,i,r)}l(s,"laya.webgl.shader.d2.Shader2X",t);var e=s.prototype;return e.upload2dQuick1=function(t){this.upload(t,this._params2dQuick1||this._make2dQuick1())},e._make2dQuick1=function(){if(!this._params2dQuick1){this.activeResource(),this._params2dQuick1=[];for(var t,e=this._params,i=0,r=e.length;i<r;i++)t=e[i],(p.isFlash||"size"!==t.name&&"position"!==t.name&&"texcoord"!==t.name)&&this._params2dQuick1.push(t)}return this._params2dQuick1},e.disposeResource=function(){t.prototype.disposeResource.call(this),this._params2dQuick1=null,this._params2dQuick2=null},e.upload2dQuick2=function(t){this.upload(t,this._params2dQuick2||this._make2dQuick2())},e._make2dQuick2=function(){if(!this._params2dQuick2){this.activeResource(),this._params2dQuick2=[];for(var t,e=this._params,i=0,r=e.length;i<r;i++)t=e[i],!p.isFlash&&"size"===t.name||this._params2dQuick2.push(t)}return this._params2dQuick2},s.create=function(t,e,i,r){return new s(t,e,i,r)},s}(ce),pe=function(){function e(t){this._uint8Array=null,this._uint16Array=null,void 0===t&&(t=35044),e.__super.call(this),this._bufferUsage=t,this._bufferType=34963,p.isFlash||(this._buffer=new ArrayBuffer(8))}l(e,"laya.webgl.utils.IndexBuffer2D",de);var t=e.prototype;return t._checkArrayUse=function(){this._uint8Array&&(this._uint8Array=new Uint8Array(this._buffer)),this._uint16Array&&(this._uint16Array=new Uint16Array(this._buffer))},t.getUint8Array=function(){return this._uint8Array||(this._uint8Array=new Uint8Array(this._buffer))},t.getUint16Array=function(){return this._uint16Array||(this._uint16Array=new Uint16Array(this._buffer))},t.destory=function(){this._uint16Array=null,this._uint8Array=null,this._buffer=null},e.QuadrangleIB=null,e.create=function(t){return new e(t=void 0===t?35044:t)},e}(),ge=function(t){function i(t,e){this._floatArray32=null,this._vertexStride=0,i.__super.call(this),this._vertexStride=t,this._bufferUsage=e,this._bufferType=34962,p.isFlash||(this._buffer=new ArrayBuffer(8)),this.getFloat32Array()}l(i,"laya.webgl.utils.VertexBuffer2D",t);var e=i.prototype;return e.getFloat32Array=function(){return this._floatArray32||(this._floatArray32=new Float32Array(this._buffer))},e.bind=function(t){t&&t._bind(),this._bind()},e.insertData=function(t,e){this.getFloat32Array().set(t,e),this._upload=!0},e.bind_upload=function(t){t._bind_upload()||t._bind(),this._bind_upload()||this._bind()},e._checkArrayUse=function(){this._floatArray32&&(this._floatArray32=new Float32Array(this._buffer))},e.disposeResource=function(){t.prototype.disposeResource.call(this)},e.destory=function(){this._byteLength=0,this._upload=!0,this._buffer=null,this._floatArray32=null},a(0,e,"vertexStride",function(){return this._vertexStride}),i.create=function(t,e){return new i(t,e=void 0===e?35048:e)},i}(de),xe=function(){function s(t,e,i,r){this._format=0,this._mipmap=!1,this._allowMerageInAtlas=!1,this._enableMerageInAtlas=!1,this.repeat=!1,this._image=null,this.minFifter=0,void(this.magFifter=0)===i&&(i=6408),void 0===r&&(r=!0),s.__super.call(this,t,e),this._format=i,this._mipmap=r,this.repeat=!1,this.minFifter=-1,this.magFifter=-1,"string"==typeof t?(this._url=t,this._src=t,this._image=new o.window.Image,e&&(e.onload&&(this.onload=e.onload),e.onerror&&(this.onerror=e.onerror),e.onCreate&&e.onCreate(this)),this._image.crossOrigin=t&&0==t.indexOf("data:")?null:"",t&&(this._image.src=t)):t instanceof ArrayBuffer?(this._src=e,this._url=this._src,(r=new h(t)).readUTFBytes(4),r.readUTFBytes(2),r.getInt16(),r.endian="bigEndian",this._w=r.getInt16(),this._h=r.getInt16(),r.getInt16(),r.getInt16(),this._image=new Uint8Array(t,r.pos),this._format=Ct.compressEtc1.COMPRESSED_RGB_ETC1_WEBGL,U.enabled&&this._w<U.atlasLimitWidth&&this._h<U.atlasLimitHeight?this._allowMerageInAtlas=!0:this._allowMerageInAtlas=!1):(this._src=e,this._url=this._src,this._image=t.source||t,this.onresize()),this._$5__enableMerageInAtlas=!0}l(s,"laya.webgl.resource.WebGLImage",f);var t=s.prototype;return x.imps(t,{"laya.webgl.resource.IMergeAtlasBitmap":!0}),t._init_=function(t,e){},t._createWebGlTexture=function(){if(!this._image)throw"create GLTextur err:no data:"+this._image;var t=Ct.mainContext,e=this._source=t.createTexture(),i=Pt.curBindTexTarget,r=Pt.curBindTexValue;if(Pt.bindTexture(t,3553,e),p.isConchWebGL)switch(this._format){case 6408:t.texImage2DEx(!0,3553,0,this._format,6408,5121,this._image);break;case Ct.compressEtc1.COMPRESSED_RGB_ETC1_WEBGL:t.compressedTexImage2D(3553,0,this._format,this._w,this._h,0,this._image)}else{switch(t.pixelStorei(37441,!0),this._format){case 6408:t.texImage2D(3553,0,this._format,6408,5121,this._image);break;case Ct.compressEtc1.COMPRESSED_RGB_ETC1_WEBGL:t.compressedTexImage2D(3553,0,this._format,this._w,this._h,0,this._image)}t.pixelStorei(37441,!1)}var s=this.minFifter,n=this.magFifter,a=this.repeat?10497:33071,e=u.isPOT(this._w,this._h);e?(this.mipmap?-1!==s||(s=9987):-1!==s||(s=9729),-1!==n||(n=9729),t.texParameteri(3553,10241,s),t.texParameteri(3553,10240,n),t.texParameteri(3553,10242,a),t.texParameteri(3553,10243,a),this.mipmap&&t.generateMipmap(3553)):(-1!==n||(n=9729),t.texParameteri(3553,10241,s=-1===s?9729:s),t.texParameteri(3553,10240,n),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071)),i&&r&&Pt.bindTexture(t,i,r),this._image.onload=null,this._image=null,e&&this.mipmap?this.memorySize=this._w*this._h*4*(1+1/3):this.memorySize=this._w*this._h*4,this._recreateLock=!1},t.recreateResource=function(){var t,e=this;null!=this._src&&""!==this._src&&(this._needReleaseAgain=!1,this._image?this._recreateLock||(this._allowMerageInAtlas&&this._$5__enableMerageInAtlas?(this.memorySize=0,this._recreateLock=!1):this._createWebGlTexture(),this.completeCreate()):(this._recreateLock=!0,(t=this)._image=new o.window.Image,this._image.crossOrigin=0==this._src.indexOf("data:")?null:"",this._image.onload=function(){if(t._needReleaseAgain)return t._needReleaseAgain=!1,t._image.onload=null,void(t._image=null);t._allowMerageInAtlas&&t._enableMerageInAtlas?(e.memorySize=0,e._recreateLock=!1):t._createWebGlTexture(),t.completeCreate()},this._image.src=this._src))},t.disposeResource=function(){this._recreateLock&&(this._needReleaseAgain=!0),this._source&&(Ct.mainContext.deleteTexture(this._source),this._source=null,this._image=null,this.memorySize=0)},t.onresize=function(){this._w=this._image.width,this._h=this._image.height,U.enabled&&this._w<U.atlasLimitWidth&&this._h<U.atlasLimitHeight?this._allowMerageInAtlas=!0:this._allowMerageInAtlas=!1},t.clearAtlasSource=function(){this._image=null},a(0,t,"format",function(){return this._format}),a(0,t,"enableMerageInAtlas",function(){return this._$5__enableMerageInAtlas},function(t){this._$5__enableMerageInAtlas=t}),a(0,t,"mipmap",function(){return this._mipmap}),a(0,t,"allowMerageInAtlas",function(){return this._allowMerageInAtlas}),a(0,t,"atlasSource",function(){return this._image}),a(0,t,"onload",null,function(t){var e=this;this._onload=t,this._image&&(this._image.onload=null!=this._onload?function(){e.onresize(),e._onload()}:null)}),a(0,t,"onerror",null,function(t){var e=this;this._onerror=t,this._image&&(this._image.onerror=null!=this._onerror?function(){e._onerror()}:null)}),s}();x.__init([xt,V,Bt,Mt])}((window,document,Laya)),"function"==typeof define&&define.amd&&define("laya.core",["require","exports"],function(t,e){"use strict";for(var i in Object.defineProperty(e,"__esModule",{value:!0}),Laya){var r=Laya[i];r&&r.__isclass&&(e[i]=r)}});