layaair-js
Version:
An open source HTML5 engine. Edition JavaScript.
2 lines • 295 kB
JavaScript
!function(e,t,n){var i=(n.un,n.uns,n["static"]),r=n["class"],a=n.getset,s=(n.__newvec,laya.ani.AnimationPlayer),o=(laya.ani.AnimationState,laya.maths.Arith),h=(laya.resource.Bitmap,laya.utils.Browser),l=laya.webgl.utils.Buffer,u=(laya.webgl.utils.Buffer2D,laya.utils.Byte),_=laya.utils.ClassUtils,c=n.Config,d=laya.particle.emitter.EmitterBase,m=(laya.events.Event,laya.events.EventDispatcher),f=laya.utils.Handler,p=laya.webgl.utils.IndexBuffer2D,v=laya.ani.KeyframesAniTemplet,g=laya.net.Loader,x=laya.display.Node,T=(laya.particle.ParticleSetting,laya.particle.shader.ParticleShader),C=laya.particle.ParticleTemplateWebGL,b=(laya.maths.Rectangle,laya.renders.Render),I=(laya.renders.RenderContext,laya.renders.RenderSprite,laya.webgl.utils.RenderState2D),E=laya.resource.Resource,D=laya.utils.RunDriver,y=laya.webgl.shader.Shader,M=laya.webgl.shader.ShaderDefines,V=laya.display.Sprite,w=laya.utils.Stat,P=laya.net.URL,A=laya.webgl.utils.ValusArray,S=laya.webgl.utils.VertexBuffer2D,R=laya.webgl.WebGL,O=laya.webgl.WebGLContext;laya.webgl.canvas.WebGLContext2D,laya.webgl.resource.WebGLImage;n["interface"]("laya.d3.graphics.IVertex"),n["interface"]("laya.d3.core.render.IUpdate"),n["interface"]("laya.d3.core.render.IRenderable");var N=(function(){function e(){this.texturePath=null,this.lifeTime=.5,this.minSegmentDistance=.1,this.minInterpDistance=.6,this.maxSlerpCount=128,this.maxSegments=200,this.color=new ye(1,1,1,1)}return r(e,"laya.d3.core.glitter.GlitterSetting"),e}(),function(){function e(){this._tempVector30=new De,this._tempVector31=new De,this._tempVector32=new De,this._a=new De,this._b=new De,this._c=new De,this._d=new De}r(e,"laya.d3.core.glitter.SplineCurvePositionVelocity");var t=e.prototype;return t.Init=function(e,t,n,i){e.cloneTo(this._d),t.cloneTo(this._c),De.scale(e,2,this._a),De.scale(n,2,this._tempVector30),De.subtract(this._a,this._tempVector30,this._a),De.add(this._a,t,this._a),De.add(this._a,i,this._a),De.scale(n,3,this._b),De.scale(e,3,this._tempVector30),De.subtract(this._b,this._tempVector30,this._b),De.subtract(this._b,i,this._b),De.scale(t,2,this._tempVector30),De.subtract(this._b,this._tempVector30,this._b)},t.Slerp=function(e,t){De.scale(this._a,e*e*e,this._tempVector30),De.scale(this._b,e*e,this._tempVector31),De.scale(this._c,e,this._tempVector32),De.add(this._tempVector30,this._tempVector31,t),De.add(t,this._tempVector32,t),De.add(t,this._d,t)},e}()),L=function(){function e(e,t,n,i){this._datas=null,this._w=0,this._h=0,this._minHeight=NaN,this._maxHeight=NaN,this._datas=[],this._w=e,this._h=t,this._minHeight=n,this._maxHeight=i}r(e,"laya.d3.core.HeightMap");var t=e.prototype;return t._inBounds=function(e,t){return e>=0&&e<this._h&&t>=0&&t<this._w},t.getHeight=function(e,t){return this._inBounds(e,t)?this._datas[e][t]:NaN},a(0,t,"width",function(){return this._w}),a(0,t,"height",function(){return this._h}),a(0,t,"maxHeight",function(){return this._maxHeight}),a(0,t,"minHeight",function(){return this._minHeight}),e.creatFromMesh=function(t,n,i,r){for(var a=[],s=[],o=t.getSubMeshCount(),h=0;o>h;h++){for(var l=t.getSubMesh(h),u=l._getVertexBuffer(),_=u.getData(),c=[],d=0;d<_.length;d+=u.vertexDeclaration.vertexStride/4){var m=new De(_[d+0],_[d+1],_[d+2]);c.push(m)}a.push(c);var f=l._getIndexBuffer();s.push(f.getData())}var p=t.boundingBox,v=p.min.x,g=p.min.z,x=p.max.x,T=p.max.z,C=p.min.y,b=p.max.y,I=x-v,E=T-g,D=r.elements[0]=I/(n-1),y=r.elements[1]=E/(i-1),M=new e(n,i,C,b),V=e._tempRay,w=V.direction.elements;w[0]=0,w[1]=-1,w[2]=0;var P=.1,A=b+P;V.origin.elements[1]=A;for(var S=0;n>S;S++){var R=g+S*y;M._datas[S]=[];for(var O=0;i>O;O++){var N=v+O*D,L=V.origin.elements;L[0]=N,L[2]=R;var B=e._getPosition(V,a,s);M._datas[S][O]=B===Number.MAX_VALUE?NaN:A-B}}return M},e.createFromImage=function(t,n,i){var r=t.width,a=t.height,s=new e(r,a,n,i),o=(i-n)/254;h.canvas.size(r,a),h.context.drawImage(t._image,0,0,r,a);for(var l=h.context.getImageData(0,0,r,a).data,u=0,_=0;r>_;_++)for(var c=s._datas[_]=[],d=0;a>d;d++){var m=l[u++],f=l[u++],p=l[u++],v=l[u++];255==m&&255==f&&255==p&&255==v?c[d]=NaN:c[d]=(m+f+p)/3*o+n}return s},e._getPosition=function(e,t,n){for(var i=Number.MAX_VALUE,r=0;r<t.length;r++)for(var a=t[r],s=n[r],o=0;o<s.length;o+=3){var h=a[s[o+0]],l=a[s[o+1]],u=a[s[o+2]],_=we.rayIntersectsTriangle(e,h,l,u);!isNaN(_)&&i>_&&(i=_)}return i},i(e,["_tempRay",function(){return this._tempRay=new Ie(new De,new De)}]),e}(),B=function(){function e(){if(this._id=0,this._number=0,this._mask=0,this._active=!0,this._visible=!0,this.name=null,this._id=e._uniqueIDCounter,e._uniqueIDCounter++,this._id>32)throw new Error("不允许创建Layer,请参考函数getLayerByNumber、getLayerByMask、getLayerByName!")}r(e,"laya.d3.core.Layer");var t=e.prototype;return a(0,t,"number",function(){return this._number}),a(0,t,"visible",function(){return this._visible},function(t){29!==this._number&&30!=this._number&&(this._visible=t,t?e._visibleLayers=e._visibleLayers|this.mask:e._visibleLayers=e._visibleLayers&~this.mask)}),a(0,t,"mask",function(){return this._mask}),a(0,t,"active",function(){return this._active},function(t){29!==this._number&&30!=this._number&&(this._active=t,t?e._activeLayers=e._activeLayers|this.mask:e._activeLayers=e._activeLayers&~this.mask)}),a(1,e,"activeLayers",function(){return e._activeLayers},function(t){e._activeLayers=t|e.getLayerByNumber(29).mask|e.getLayerByNumber(30).mask;for(var n=0;n<e._layerList.length;n++){var i=e._layerList[n];i._active=0!==(i._mask&e._activeLayers)}}),a(1,e,"visibleLayers",function(){return e._visibleLayers},function(t){e._visibleLayers=t|e.getLayerByNumber(29).mask|e.getLayerByNumber(30).mask;for(var n=0;n<e._layerList.length;n++){var i=e._layerList[n];i._visible=0!==(i._mask&e._visibleLayers)}}),e.__init__=function(){e._layerList.length=31;for(var t=0;31>t;t++){var n=new e;e._layerList[t]=n,0===t?n.name="Default Layer":29===t?n.name="Reserved Layer0":30===t?n.name="Reserved Layer1":n.name="Layer-"+t,n._number=t,n._mask=Math.pow(2,t)}e._activeLayers=2147483647,e._visibleLayers=2147483647,e._currentCameraCullingMask=2147483647,e.currentCreationLayer=e._layerList[0]},e.getLayerByNumber=function(t){if(0>t||t>30)throw new Error("无法返回指定Layer,该number超出范围!");return e._layerList[t]},e.getLayerByMask=function(t){for(var n=0;31>n;n++)if(e._layerList[n].mask===t)return e._layerList[n];throw new Error("无法返回指定Layer,该mask不存在")},e.getLayerByName=function(t){for(var n=0;31>n;n++)if(e._layerList[n].name===t)return e._layerList[n];throw new Error("无法返回指定Layer,该name不存在")},e.isActive=function(t){return 0!=(t&e._activeLayers)},e.isVisible=function(t){return 0!=(t&e._currentCameraCullingMask&e._visibleLayers)},e._uniqueIDCounter=1,e._layerCount=31,e._layerList=[],e._activeLayers=0,e._visibleLayers=0,e._currentCameraCullingMask=0,e.currentCreationLayer=null,e}(),F=(function(){function e(){this._tempInt0=0,this._tempInt1=0,this._tempUint0=0,this._tempUint1=0,this._tempUint2=0,this._tempUint3=0,this._tempUint4=0,this._tempUint5=0,this._tempUint6=0,this._tempUint7=0,this._tempNumver0=NaN,this._tempNumver1=NaN,this._tempNumver2=NaN,this._tempNumver3=NaN,this._floatSizePerVer=7,this._defaultBufferSize=600*this._floatSizePerVer,this._vb=null,this._posInVBData=0,this._ib=null,this._posInIBData=0,this._primitiveType=NaN,this._hasBegun=!1,this._numVertsPerPrimitive=0,this._renderState=null,this._sharderNameID=0,this._shader=null,this._posShaderValue=[3,5126,!1,28,0],this._colorShaderValue=[4,5126,!1,28,12],this._albedo=new ye(1,1,1,1),this._vbData=new Float32Array(this._defaultBufferSize),this._ibData=new Uint16Array(this._defaultBufferSize),this._wvpMatrix=new Te,this._vb=new S(-1,35048),this._ib=new p,this._sharderNameID=y.nameKey.get("SIMPLE")}r(e,"laya.d3.core.PhasorSpriter3D");var t=e.prototype;return t.line=function(e,t,n,i,r,a,s,o,h,l,u,_,c,d){return this._hasBegun&&1===this._primitiveType||this.drawLinesException(),(this._posInVBData+2*this._floatSizePerVer>this._vbData.length||this._posInIBData+2>this._ibData.length)&&this.flush(),this._tempUint0=this._posInVBData/this._floatSizePerVer,this.addVertex(e,t,n,i,r,a,s),this.addVertex(o,h,l,u,_,c,d),this.addIndexes(this._tempUint0,this._tempUint0+1),this},t.circle=function(e,t,n,i,r,a){for(this._hasBegun&&1===this._primitiveType||this.drawLinesException(),this._tempUint0=2*t,(this._posInVBData+this._tempUint0*this._floatSizePerVer>this._vbData.length||this._posInIBData+2*this._tempUint0>this._ibData.length)&&this.flush(),this._tempUint1=this._posInVBData/this._floatSizePerVer,this._tempNumver0=0,this._tempInt0=0;this._tempNumver0<6.2832;this._tempNumver0=this._tempNumver0+3.1416/t,this._tempInt0++)this.addVertex(Math.sin(this._tempNumver0)*e,Math.cos(this._tempNumver0)*e,0,n,i,r,a),0===this._tempInt0?this.addIndexes(this._tempUint1):this._tempInt0===this._tempUint0-1?(this._tempUint2=this._tempUint1+this._tempInt0,this.addIndexes(this._tempUint2,this._tempUint2,this._tempUint1)):(this._tempUint2=this._tempUint1+this._tempInt0,this.addIndexes(this._tempUint2,this._tempUint2));return this},t.plane=function(e,t,n,i,r,a,s,o,h){return this._hasBegun&&4===this._primitiveType||this.drawTrianglesException(),(this._posInVBData+4*this._floatSizePerVer>this._vbData.length||this._posInIBData+6>this._ibData.length)&&this.flush(),this._tempNumver0=i/2,this._tempNumver1=r/2,this._tempUint0=this._posInVBData/this._floatSizePerVer,this.addVertex(e-this._tempNumver0,t+this._tempNumver1,n,a,s,o,h),this.addVertex(e+this._tempNumver0,t+this._tempNumver1,n,a,s,o,h),this.addVertex(e-this._tempNumver0,t-this._tempNumver1,n,a,s,o,h),this.addVertex(e+this._tempNumver0,t-this._tempNumver1,n,a,s,o,h),this._tempUint1=this._tempUint0+1,this._tempUint2=this._tempUint0+2,this.addIndexes(this._tempUint0,this._tempUint1,this._tempUint2,this._tempUint2,this._tempUint1,this._tempUint0+3),this},t.box=function(e,t,n,i,r,a,s,o,h,l){return this._hasBegun&&4===this._primitiveType||this.drawTrianglesException(),(this._posInVBData+8*this._floatSizePerVer>this._vbData.length||this._posInIBData+36>this._ibData.length)&&this.flush(),this._tempNumver0=i/2,this._tempNumver1=r/2,this._tempNumver2=a/2,this._tempUint0=this._posInVBData/this._floatSizePerVer,this.addVertex(e-this._tempNumver0,t+this._tempNumver1,n+this._tempNumver2,s,o,h,l),this.addVertex(e+this._tempNumver0,t+this._tempNumver1,n+this._tempNumver2,s,o,h,l),this.addVertex(e-this._tempNumver0,t-this._tempNumver1,n+this._tempNumver2,s,o,h,l),this.addVertex(e+this._tempNumver0,t-this._tempNumver1,n+this._tempNumver2,s,o,h,l),this.addVertex(e+this._tempNumver0,t+this._tempNumver1,n-this._tempNumver2,s,o,h,l),this.addVertex(e-this._tempNumver0,t+this._tempNumver1,n-this._tempNumver2,s,o,h,l),this.addVertex(e+this._tempNumver0,t-this._tempNumver1,n-this._tempNumver2,s,o,h,l),this.addVertex(e-this._tempNumver0,t-this._tempNumver1,n-this._tempNumver2,s,o,h,l),this._tempUint1=this._tempUint0+1,this._tempUint2=this._tempUint0+2,this._tempUint3=this._tempUint0+3,this._tempUint4=this._tempUint0+4,this._tempUint5=this._tempUint0+5,this._tempUint6=this._tempUint0+6,this._tempUint7=this._tempUint0+7,this.addIndexes(this._tempUint0,this._tempUint1,this._tempUint2,this._tempUint2,this._tempUint1,this._tempUint3,this._tempUint4,this._tempUint5,this._tempUint6,this._tempUint6,this._tempUint5,this._tempUint7,this._tempUint5,this._tempUint0,this._tempUint7,this._tempUint7,this._tempUint0,this._tempUint2,this._tempUint1,this._tempUint4,this._tempUint3,this._tempUint3,this._tempUint4,this._tempUint6,this._tempUint5,this._tempUint4,this._tempUint0,this._tempUint0,this._tempUint4,this._tempUint1,this._tempUint2,this._tempUint3,this._tempUint7,this._tempUint7,this._tempUint3,this._tempUint6),this},t.cone=function(e,t,n,i,r,a,s){for(this._hasBegun&&4===this._primitiveType||this.drawTrianglesException(),(this._posInVBData+(2*n+2)*this._floatSizePerVer>this._vbData.length||this._posInIBData+6*n>this._ibData.length)&&this.flush(),this._tempUint0=this._posInVBData,this._tempUint1=this._posInVBData/this._floatSizePerVer,this._tempNumver0=2*Math.PI/n,this.addVertexIndex(0,t,0,i,r,a,s,this._tempUint0),this.addVertexIndex(0,0,0,i,r,a,s,this._tempUint0+this._floatSizePerVer),this._tempInt0=2,this._tempNumver1=0,this._tempInt1=0;this._tempInt1<n;this._tempInt1++)this._tempNumver2=Math.cos(this._tempNumver1),this._tempNumver3=Math.sin(this._tempNumver1),this.addVertexIndex(e*this._tempNumver2,0,e*this._tempNumver3,i,r,a,s,this._tempUint0+this._tempInt0*this._floatSizePerVer),this.addIndexes(this._tempUint1,this._tempUint1+this._tempInt0),this._tempInt1==n-1?this.addIndexes(this._tempUint1+2):this.addIndexes(this._tempUint1+this._tempInt0+1),this.addVertexIndex(e*this._tempNumver2,0,e*this._tempNumver3,i,r,a,s,this._tempUint0+(this._tempInt0+n)*this._floatSizePerVer),this.addIndexes(this._tempUint1+1),this._tempInt1==n-1?this.addIndexes(this._tempUint1+n+2):this.addIndexes(this._tempUint1+this._tempInt0+n+1),this.addIndexes(this._tempUint1+this._tempInt0+n),this._tempInt0++,this._tempNumver1+=this._tempNumver0;return this},t.boundingBoxLine=function(e,t,n,i,r,a,s,o,h,l){return this._hasBegun&&1===this._primitiveType||this.drawLinesException(),(this._posInVBData+8*this._floatSizePerVer>this._vbData.length||this._posInIBData+48>this._ibData.length)&&this.flush(),this._tempUint0=this._posInVBData/this._floatSizePerVer,this.addVertex(e,r,a,s,o,h,l),this.addVertex(i,r,a,s,o,h,l),this.addVertex(e,t,a,s,o,h,l),this.addVertex(i,t,a,s,o,h,l),this.addVertex(i,r,n,s,o,h,l),this.addVertex(e,r,n,s,o,h,l),this.addVertex(i,t,n,s,o,h,l),this.addVertex(e,t,n,s,o,h,l),this._tempUint1=this._tempUint0+1,this._tempUint2=this._tempUint0+2,this._tempUint3=this._tempUint0+3,this._tempUint4=this._tempUint0+4,this._tempUint5=this._tempUint0+5,this._tempUint6=this._tempUint0+6,this._tempUint7=this._tempUint0+7,this.addIndexes(this._tempUint0,this._tempUint1,this._tempUint1,this._tempUint3,this._tempUint3,this._tempUint2,this._tempUint2,this._tempUint0,this._tempUint4,this._tempUint5,this._tempUint5,this._tempUint7,this._tempUint7,this._tempUint6,this._tempUint6,this._tempUint4,this._tempUint5,this._tempUint0,this._tempUint0,this._tempUint2,this._tempUint2,this._tempUint7,this._tempUint7,this._tempUint5,this._tempUint1,this._tempUint4,this._tempUint4,this._tempUint6,this._tempUint6,this._tempUint3,this._tempUint3,this._tempUint1,this._tempUint5,this._tempUint4,this._tempUint4,this._tempUint1,this._tempUint1,this._tempUint0,this._tempUint0,this._tempUint5,this._tempUint2,this._tempUint3,this._tempUint3,this._tempUint6,this._tempUint6,this._tempUint7,this._tempUint7,this._tempUint2),this},t.addVertex=function(e,t,n,i,r,a,s){return this._hasBegun||this.addVertexIndexException(),this._vbData[this._posInVBData]=e,this._vbData[this._posInVBData+1]=t,this._vbData[this._posInVBData+2]=n,this._vbData[this._posInVBData+3]=i,this._vbData[this._posInVBData+4]=r,this._vbData[this._posInVBData+5]=a,this._vbData[this._posInVBData+6]=s,this._posInVBData+=this._floatSizePerVer,this},t.addVertexIndex=function(e,t,n,i,r,a,s,o){return this._hasBegun||this.addVertexIndexException(),this._vbData[o]=e,this._vbData[o+1]=t,this._vbData[o+2]=n,this._vbData[o+3]=i,this._vbData[o+4]=r,this._vbData[o+5]=a,this._vbData[o+6]=s,o+=this._floatSizePerVer,o>this._posInVBData&&(this._posInVBData=o),this},t.addIndexes=function(e){var t=arguments;this._hasBegun||this.addVertexIndexException();for(var n=0;n<t.length;n++)this._ibData[this._posInIBData]=t[n],this._posInIBData++;return this},t.begin=function(e,t,n){return this._hasBegun&&this.beginException0(),1!==e&&4!==e&&this.beginException1(),this._primitiveType=e,this._wvpMatrix=t,this._renderState=n,this._hasBegun=!0,this},t.end=function(){return this._hasBegun||this.endException(),this.flush(),this._hasBegun=!1,this},t.flush=function(){if(0!==this._posInVBData){this._ib.clear(),this._ib.append(this._ibData),this._vb.clear(),this._vb.append(this._vbData),this._vb.bind_upload(this._ib);var e=this._renderState.shaderValue.length,t=this._renderState.shaderDefs.getValue();this._shader=this.getShader(this._renderState),this._renderState.shaderValue.pushValue("POSITION",this._posShaderValue),this._renderState.shaderValue.pushValue("COLOR",this._colorShaderValue),this._renderState.shaderValue.pushValue("MVPMATRIX",this._wvpMatrix.elements),this._renderState.shaderValue.pushValue("ALBEDO",this._albedo.elements),this._shader.uploadArray(this._renderState.shaderValue.data,this._renderState.shaderValue.length,null),this._renderState.shaderDefs.setValue(t),this._renderState.shaderValue.length=e,w.drawCall++,R.mainContext.drawElements(this._primitiveType,this._posInIBData,5123,0),this._posInIBData=0,this._posInVBData=0}},t.getShader=function(e){var t=e.shaderDefs._value;e.shaderDefs._value=-449&t,e.shaderDefs.add(32);var n=e.shaderDefs.getValue()+2e-4*this._sharderNameID,i=this._shader?this._shader:y.getShader(n);return i||(i=y.withCompile(this._sharderNameID,e.shaderDefs.toNameDic(),n,null))},t.addVertexIndexException=function(){throw new Error("请先调用begin()函数")},t.beginException0=function(){throw new Error("调用begin()前请确保已成功调用end()!")},t.beginException1=function(){throw new Error("只支持“LINES”和“TRIANGLES”两种基元!")},t.endException=function(){throw new Error("调用end()前请确保已成功调用begin()!")},t.drawLinesException=function(){throw new Error("您必须确保在此之前已调用begin()且使用“LINES”基元!")},t.drawTrianglesException=function(){throw new Error("您必须确保在此之前已调用begin()且使用“TRIANGLES”基元!")},e}(),function(){function e(){this.depthTest=!0,this.depthMask=1,this.blend=!1,this.cullFace=!0,this.sFactor=1,this.dFactor=0,this.frontFace=2304}return r(e,"laya.d3.core.render.RenderConfig"),e}()),U=function(){function e(){this._type=0,this._mainSortID=0,this._renderObject=null,this._sprite3D=null,this._material=null,this._renderObj=null,this._staticBatch=null,this._batchIndexStart=0,this._batchIndexEnd=0}r(e,"laya.d3.core.render.RenderElement");var t=e.prototype;return t.getStaticBatchBakedVertexs=function(t){var n=4,i=this._renderObj._getVertexBuffer(t),r=i.getData().slice(),a=i.vertexDeclaration,s=a.getVertexElementByUsage("POSITION").offset/n,o=a.getVertexElementByUsage("NORMAL").offset/n,h=this._staticBatch._rootSprite.transform.worldMatrix,l=this._sprite3D.transform.worldMatrix,u=e._tempMatrix4x40,_=e._tempMatrix4x41;h.invert(u),Te.multiply(u,l,_);var c=e._tempQuaternion0;_.decompose(e._tempVector30,c,e._tempVector31);for(var d=a.vertexStride/n,m=0,f=r.length;f>m;m+=d){var p=m+s;Se.transformVector3ArrayToVector3ArrayCoordinate(r,p,_,r,p),Se.transformVector3ArrayByQuat(r,o,c,r,o)}return r},t.getDynamicBatchBakedVertexs=function(e){for(var t=4,n=this._renderObj._getVertexBuffer(e),i=n.getData().slice(),r=n.vertexDeclaration,a=r.getVertexElementByUsage("POSITION").offset/t,s=r.getVertexElementByUsage("NORMAL").offset/t,o=this._sprite3D.transform,h=o.worldMatrix,l=o.rotation,u=r.vertexStride/t,_=0,c=i.length;c>_;_+=u){var d=_+a;Se.transformVector3ArrayToVector3ArrayCoordinate(i,d,h,i,d),Se.transformVector3ArrayByQuat(i,s,l,i,s)}return i},t.getBakedIndices=function(){return this._renderObj._getIndexBuffer().getData()},a(0,t,"renderObj",function(){return this._renderObj},function(e){this._renderObj!==e&&(this._renderObj=e)}),i(e,["_tempVector30",function(){return this._tempVector30=new De},"_tempVector31",function(){return this._tempVector31=new De},"_tempQuaternion0",function(){return this._tempQuaternion0=new be},"_tempMatrix4x40",function(){return this._tempMatrix4x40=new Te},"_tempMatrix4x41",function(){return this._tempMatrix4x41=new Te}]),e}(),G=function(){function e(t,n){this._id=0,this._needSort=!1,this._renderElements=null,this._staticBatches=null,this._renderableRenderObjects=null,this._renderConfig=null,this._staticBatchCombineRenderElements=null,this._dynamicBatchCombineRenderElements=null,this._finalElements=null,this._scene=null,this._id=++e._uniqueIDCounter,this._needSort=!1,this._renderConfig=t,this._scene=n,this._renderElements=[],this._renderableRenderObjects=[],this._staticBatchCombineRenderElements=[],this._dynamicBatchCombineRenderElements=[],this._staticBatches=[]}r(e,"laya.d3.core.render.RenderQueue");var t=e.prototype;return t._sortAlphaFunc=function(t,n){return t._renderObject&&n._renderObject?De.distance(n._renderObject._boundingSphere.center,e._cameraPosition)-De.distance(t._renderObject._boundingSphere.center,e._cameraPosition):0},t._begainRenderElement=function(e,t,n){return t._beforeRender(e)?(e.shaderValue.pushArray(t._getVertexBuffer(0).vertexDeclaration.shaderValues),!0):!1},t._endRenderElement=function(e,t,n){n._upload(e,t._getVertexBuffer(0).vertexDeclaration,null),t._render(e)},t._preRenderUpdateComponents=function(e,t){for(var n=0;n<e.componentsCount;n++){var i=e.getComponentByIndex(n);!i.started&&(i._start(t),i.started=!0),i.isActive&&i._preRenderUpdate(t)}},t._postRenderUpdateComponents=function(e,t){for(var n=0;n<e.componentsCount;n++){var i=e.getComponentByIndex(n);!i.started&&(i._start(t),i.started=!0),i.isActive&&i._postRenderUpdate(t)}},t._sortAlpha=function(t){e._cameraPosition=t,this._finalElements.sort(this._sortAlphaFunc)},t._setState=function(e,t){O.setDepthTest(e,this._renderConfig.depthTest),O.setDepthMask(e,this._renderConfig.depthMask),O.setBlend(e,this._renderConfig.blend),O.setBlendFunc(e,this._renderConfig.sFactor,this._renderConfig.dFactor),O.setCullFace(e,this._renderConfig.cullFace),t.camera.renderTarget?O.setFrontFaceCCW(e,2304===this._renderConfig.frontFace?2305:2304):O.setFrontFaceCCW(e,this._renderConfig.frontFace)},t._preRender=function(e){this._staticBatchCombineRenderElements.length=0;for(var t=0,n=this._staticBatches.length;n>t;t++)this._staticBatches[t]._getRenderElement(this._staticBatchCombineRenderElements);this._finalElements=this._renderElements.concat(this._staticBatchCombineRenderElements,this._dynamicBatchCombineRenderElements)},t._render=function(e){for(var t=e.shaderValue.length,n=e.shaderDefs.getValue(),i=0,r=this._finalElements.length;r>i;i++){var a,s,o=this._finalElements[i];if(0===o._type){var h=o._sprite3D;e.owner=h,e.renderElement=o,this._preRenderUpdateComponents(h,e),a=o.renderObj,s=o._material,this._begainRenderElement(e,a,s)&&(s._setLoopShaderParams(e,e.projectionViewMatrix,h.transform.worldMatrix,o.renderObj,s),this._endRenderElement(e,a,s)),this._postRenderUpdateComponents(h,e)}else if(1===o._type){var l=o.renderObj;e.owner=null,e.renderElement=o,e._batchIndexStart=o._batchIndexStart,e._batchIndexEnd=o._batchIndexEnd,a=o.renderObj,s=o._material,this._begainRenderElement(e,a,s)&&(o._material._setLoopShaderParams(e,e.projectionViewMatrix,l._rootSprite.transform.worldMatrix,o.renderObj,o._material),this._endRenderElement(e,a,s))}else if(2===o._type){o.renderObj;e.owner=null,e.renderElement=o,e._batchIndexStart=o._batchIndexStart,e._batchIndexEnd=o._batchIndexEnd,a=o.renderObj,s=o._material,this._begainRenderElement(e,a,s)&&(o._material._setLoopShaderParams(e,e.projectionViewMatrix,Te.DEFAULT,o.renderObj,o._material),this._endRenderElement(e,a,s))}e.shaderDefs.setValue(n),e.shaderValue.length=t}},t._clearRenderElements=function(){this._staticBatches.length=0,this._dynamicBatchCombineRenderElements.length=0,this._renderElements.length=0,this._needSort=!0},t._addRenderElement=function(e){this._renderElements.push(e),this._needSort=!0},t._addStaticBatch=function(e){this._staticBatches.push(e)},t._addDynamicBatchElement=function(e){this._dynamicBatchCombineRenderElements.push(e)},a(0,t,"id",function(){return this._id}),e._uniqueIDCounter=0,e.OPAQUE=1,e.OPAQUE_DOUBLEFACE=2,e.ALPHA_BLEND=3,e.ALPHA_BLEND_DOUBLEFACE=4,e.ALPHA_ADDTIVE_BLEND=5,e.ALPHA_ADDTIVE_BLEND_DOUBLEFACE=6,e.DEPTHREAD_ALPHA_BLEND=7,e.DEPTHREAD_ALPHA_BLEND_DOUBLEFACE=8,e.DEPTHREAD_ALPHA_ADDTIVE_BLEND=9,e.DEPTHREAD_ALPHA_ADDTIVE_BLEND_DOUBLEFACE=10,e.NONDEPTH_ALPHA_BLEND=11,e.NONDEPTH_ALPHA_BLEND_DOUBLEFACE=12,e.NONDEPTH_ALPHA_ADDTIVE_BLEND=13,e.NONDEPTH_ALPHA_ADDTIVE_BLEND_DOUBLEFACE=14,e._cameraPosition=null,e}(),H=function(){function e(){this.elapsedTime=NaN,this.loopCount=0,this.context=null,this.scene=null,this.owner=null,this.renderElement=null,this._staticBatch=null,this._batchIndexStart=0,this._batchIndexEnd=0,this.camera=null,this.viewMatrix=null,this.projectionMatrix=null,this.projectionViewMatrix=null,this.cameraBoundingFrustum=null,this.viewport=null,this.worldShaderValue=new A,this.shaderValue=new A,this.shaderDefs=new Ue,this.reset()}r(e,"laya.d3.core.render.RenderState");var t=e.prototype;return t.reset=function(){this.worldShaderValue.length=0,this.shaderValue.length=0,this.shaderDefs.setValue(0),R.frameShaderHighPrecision&&this.shaderDefs.setValue(1048576)},e.VERTEXSHADERING=4,e.PIXELSHADERING=8,e.clientWidth=0,e.clientHeight=0,e}(),j=function(){function e(e){this._vertexDeclaration=null,this._vertexDatas=null,this._indexDatas=null,this._vertexBuffer=null,this._indexBuffer=null,this._currentCombineVertexCount=0,this._currentCombineIndexCount=0,this._combineRenderElements=null,this._materials=null,this._materialToRenderElementsOffsets=null,this._merageElements=null,this._combineRenderElementPool=null,this._combineRenderElementPoolIndex=0,this._currentCombineVertexCount=0,this._currentCombineIndexCount=0,this._combineRenderElements=[],this._materialToRenderElementsOffsets=[],this._materials=[],this._merageElements=[],this._combineRenderElementPool=[],this._combineRenderElementPoolIndex=0,this._vertexDeclaration=e}r(e,"laya.d3.graphics.DynamicBatch");var t=e.prototype;return n.imps(t,{"laya.d3.core.render.IRenderable":!0}),t._getVertexBuffer=function(e){return void 0===e&&(e=0),0===e?this._vertexBuffer:null},t._getIndexBuffer=function(){return this._indexBuffer},t._testTangent=function(e){},t._getCombineRenderElementFromPool=function(){var e=this._combineRenderElementPool[this._combineRenderElementPoolIndex++];return e||(this._combineRenderElementPool[this._combineRenderElementPoolIndex-1]=new U)},t._getRenderElement=function(){this._vertexDatas||(this._vertexDatas=new Float32Array(this._vertexDeclaration.vertexStride/4*e.maxVertexCount),this._indexDatas=new Uint16Array(e.maxIndexCount),this._vertexBuffer=it.create(this._vertexDeclaration,e.maxVertexCount,35048),this._indexBuffer=nt.create("ushort",e.maxIndexCount,35048)),this._merageElements.length=0;for(var t=0,n=0,i=0,r=this._combineRenderElements.length;r>i;i++){var a=this._combineRenderElements[i],s=a.getDynamicBatchBakedVertexs(0),o=a.getBakedIndices(),h=t/(this._vertexDeclaration.vertexStride/4),l=n,u=l+o.length;a._batchIndexStart=l,a._batchIndexEnd=u,this._indexDatas.set(o,n);for(var _=l;u>_;_++)this._indexDatas[_]=h+this._indexDatas[_];n+=o.length,this._vertexDatas.set(s,t),t+=s.length}for(this._vertexBuffer.setData(this._vertexDatas),this._indexBuffer.setData(this._indexDatas),this._combineRenderElementPoolIndex=0,i=0,r=this._materials.length;r>i;i++){var c=this._getCombineRenderElementFromPool();c._type=2,c._staticBatch=null,c.renderObj=this;var d=this._combineRenderElements[this._materialToRenderElementsOffsets[i]]._batchIndexStart,m=i+1===this._materialToRenderElementsOffsets.length?n:this._combineRenderElements[this._materialToRenderElementsOffsets[i+1]]._batchIndexStart;c._batchIndexStart=d,c._batchIndexEnd=m,c._material=this._materials[i],this._merageElements.push(c)}},t._addCombineRenderObjTest=function(t){var n=t.renderObj,i=this._currentCombineIndexCount+n._getIndexBuffer().indexCount,r=this._currentCombineVertexCount+n._getVertexBuffer().vertexCount;return!(r>e.maxVertexCount||i>e.maxIndexCount)},t._addCombineRenderObj=function(e){var t=e.renderObj;this._combineRenderElements.push(e),this._currentCombineIndexCount=this._currentCombineIndexCount+t._getIndexBuffer().indexCount,this._currentCombineVertexCount=this._currentCombineVertexCount+t._getVertexBuffer().vertexCount},t._addCombineMaterial=function(e){this._materials.push(e)},t._addMaterialToRenderElementOffset=function(e){this._materialToRenderElementsOffsets.push(e)},t._clearRenderElements=function(){this._combineRenderElements.length=0,this._materials.length=0,this._materialToRenderElementsOffsets.length=0,this._currentCombineVertexCount=0,this._currentCombineIndexCount=0},t._addToRenderQueue=function(e){this._getRenderElement();for(var t=0,n=this._materials.length;n>t;t++)e.getRenderQueue(this._materials[t].renderQueue)._addDynamicBatchElement(this._merageElements[t])},t._beforeRender=function(e){return this._vertexBuffer._bind(),this._indexBuffer._bind(),!0},t._render=function(e){var t=e._batchIndexEnd-e._batchIndexStart;e.context.drawElements(4,t,5123,2*e._batchIndexStart),w.drawCall++,w.trianglesFaces+=t/3},a(0,t,"indexOfHost",function(){return 0}),a(0,t,"_vertexBufferCount",function(){return 1}),a(0,t,"triangleCount",function(){return this._indexBuffer.indexCount/3}),a(0,t,"combineRenderElementsCount",function(){return this._combineRenderElements.length}),e.maxVertexCount=2e4,e.maxIndexCount=4e4,e.maxCombineTriangleCount=50,e}(),k=function(){function e(){this._dynamicBatches=null,this._prepareDynamicBatchCombineElements=null,this._dynamicBatches={},this._prepareDynamicBatchCombineElements=[]}r(e,"laya.d3.graphics.DynamicBatchManager");var t=e.prototype;return t.getDynamicBatch=function(e,t){var n,i=e.id.toString()+t;return this._dynamicBatches[i]?n=this._dynamicBatches[i]:this._dynamicBatches[i]=n=new j(e),n},t._garbageCollection=function(){for(var e in this._dynamicBatches)0===this._dynamicBatches[e].combineRenderElementsCount&&delete this._dynamicBatches[e]},t._addPrepareRenderElement=function(e){this._prepareDynamicBatchCombineElements.push(e)},t._finishCombineDynamicBatch=function(t){this._prepareDynamicBatchCombineElements.sort(e._sortPrepareDynamicBatch);for(var n,i,r,a,s,o,h,l,u=-1,_=!0,c=0,d=-1,m=0,f=this._prepareDynamicBatchCombineElements.length;f>m;m++){s=this._prepareDynamicBatchCombineElements[m];var p=s.renderObj._getVertexBuffer(0).vertexDeclaration,v=i!==p;v&&(c=0,i=p);var g=c!==u;if(g&&(u=c),(v||g)&&(o=this.getDynamicBatch(p,c),n=null),_)if(o._addCombineRenderObjTest(s)){if(a=s._material,n!==a)h&&(t.getRenderQueue(l._material.renderQueue)._addRenderElement(l),h=null,l=null,d=-1),h=a,d=o.combineRenderElementsCount,l=s,n=a;else if(h){var x=l.renderObj,T=s.renderObj;x._getVertexBuffer().vertexCount+T._getVertexBuffer().vertexCount>j.maxVertexCount||x._getIndexBuffer().indexCount+T._getIndexBuffer().indexCount>j.maxIndexCount?(t.getRenderQueue(l._material.renderQueue)._addRenderElement(l),h=a,d=o.combineRenderElementsCount,l=s):(o._addCombineMaterial(h),o._addMaterialToRenderElementOffset(d),o._addCombineRenderObj(l),h=null,l=null,d=-1,o._addCombineRenderObj(s))}else o._addCombineRenderObj(s);_=!0}else h&&(t.getRenderQueue(l._material.renderQueue)._addRenderElement(l),h=null,l=null,d=-1),c++,_=!1;else r=this._prepareDynamicBatchCombineElements[m-1],o._addMaterialToRenderElementOffset(o.combineRenderElementsCount),n=r._material,o._addCombineMaterial(n),o._addCombineRenderObj(r),_=!0,a=s._material,n!==a?(h=a,d=o.combineRenderElementsCount,l=s):o._addCombineRenderObj(s),n=a}h&&(t.getRenderQueue(l._material.renderQueue)._addRenderElement(l),h=null,l=null,d=-1),this._prepareDynamicBatchCombineElements.length=0},t._clearRenderElements=function(){for(var e in this._dynamicBatches)this._dynamicBatches[e]._clearRenderElements()},t._addToRenderQueue=function(e){for(var t in this._dynamicBatches){var n=this._dynamicBatches[t];n.combineRenderElementsCount>0&&n._addToRenderQueue(e)}},t.dispose=function(){this._dynamicBatches=null},e._sortPrepareDynamicBatch=function(e,t){return e._mainSortID-t._mainSortID},e}(),z=function(){function e(){}return r(e,"laya.d3.graphics.FrustumCulling"),e.RenderObjectCulling=function(e,t){var n,i,r=0,a=0,s=0,o=0,h=t._quenes,l=t._staticBatchManager,u=t._dynamicBatchManager,_=t._frustumCullingObjects;for(r=0,a=h.length;a>r;r++)h[r]&&h[r]._clearRenderElements();for(l._clearRenderElements(),u._clearRenderElements(),r=0,a=_.length;a>r;r++)if(n=_[r],B.isVisible(n._layerMask)&&n._ownerEnable&&n._enable&&0!==e.ContainsBoundSphere(n._boundingSphere))for(s=0,o=n._renderElements.length;o>s;s++){i=n._renderElements[s];var c=i._staticBatch;
if(c&&c._material===i._material)c._addRenderElement(i);else{var d=i.renderObj;d.triangleCount<50&&1===d._vertexBufferCount&&d._getIndexBuffer()&&i._material.renderQueue<3?u._addPrepareRenderElement(i):t.getRenderQueue(i._material.renderQueue)._addRenderElement(i)}}l._addToRenderQueue(t),u._finishCombineDynamicBatch(t),u._addToRenderQueue(t)},e}(),W=function(){function e(){this._render=null,this._renderElements=null,this._layerMask=0,this._ownerEnable=!1,this._enable=!1,this._renderElements=[]}r(e,"laya.d3.graphics.RenderObject");var t=e.prototype;return a(0,t,"_boundingSphere",function(){return this._render.boundingSphere}),e}(),X=function(){function e(e,t,n){this._vertexBuffer=null,this._indexBuffer=null,this._renderElements=null,this._combineRenderElementPool=null,this._combineRenderElementPoolIndex=0,this._combineRenderElements=null,this._currentCombineVertexCount=0,this._currentCombineIndexCount=0,this._needFinishCombine=!1,this._rootSprite=null,this._vertexDeclaration=null,this._material=null,this._currentCombineVertexCount=0,this._currentCombineIndexCount=0,this._needFinishCombine=!1,this._renderElements=[],this._combineRenderElements=[],this._combineRenderElementPool=[],this._combineRenderElementPoolIndex=0,this._rootSprite=e,this._vertexDeclaration=t,this._material=n}r(e,"laya.d3.graphics.StaticBatch");var t=e.prototype;return n.imps(t,{"laya.d3.core.render.IRenderable":!0}),t._testTangent=function(e){},t._getVertexBuffer=function(e){return void 0===e&&(e=0),0===e?this._vertexBuffer:null},t._getIndexBuffer=function(){return this._indexBuffer},t._getCombineRenderElementFromPool=function(){var e=this._combineRenderElementPool[this._combineRenderElementPoolIndex++];return e||(this._combineRenderElementPool[this._combineRenderElementPoolIndex-1]=new U)},t._addCombineRenderObjTest=function(t){var n=t.renderObj,i=this._currentCombineVertexCount+n._getVertexBuffer().vertexCount;return!(i>e.maxVertexCount)},t._addCombineRenderObj=function(e){var t=e.renderObj;this._combineRenderElements.push(e),e._staticBatch=this,this._currentCombineIndexCount=this._currentCombineIndexCount+t._getIndexBuffer().indexCount,this._currentCombineVertexCount=this._currentCombineVertexCount+t._getVertexBuffer().vertexCount,this._needFinishCombine=!0},t._deleteCombineRenderObj=function(e){var t=e.renderObj,n=this._combineRenderElements.indexOf(e);-1!==n&&(this._combineRenderElements.splice(n,1),e._staticBatch=null,this._currentCombineIndexCount=this._currentCombineIndexCount-t._getIndexBuffer().indexCount,this._currentCombineVertexCount=this._currentCombineVertexCount-t._getVertexBuffer().vertexCount,this._needFinishCombine=!0)},t._finshCombine=function(){if(this._needFinishCombine){var e=0,t=0,n=new Float32Array(this._vertexDeclaration.vertexStride/4*this._currentCombineVertexCount),i=new Uint16Array(this._currentCombineIndexCount);this._vertexBuffer&&(this._vertexBuffer.dispose(),this._indexBuffer.dispose()),this._vertexBuffer=it.create(this._vertexDeclaration,this._currentCombineVertexCount,35044),this._indexBuffer=nt.create("ushort",this._currentCombineIndexCount,35044);for(var r=0,a=this._combineRenderElements.length;a>r;r++){var s=this._combineRenderElements[r],o=s.getStaticBatchBakedVertexs(0),h=s.getBakedIndices(),l=e/(this._vertexDeclaration.vertexStride/4),u=t,_=u+h.length;s._batchIndexStart=u,s._batchIndexEnd=_,i.set(h,t);for(var c=u;_>c;c++)i[c]=l+i[c];t+=h.length,n.set(o,e),e+=o.length}this._vertexBuffer.setData(n),this._indexBuffer.setData(i),this._needFinishCombine=!1}},t._clearRenderElements=function(){this._renderElements.length=0},t._addRenderElement=function(e){for(var t=0,n=this._renderElements.length;n>t;t++)if(this._renderElements[t]._batchIndexStart>e._batchIndexStart)return void this._renderElements.splice(t,0,e);this._renderElements.push(e)},t._getRenderElement=function(e){this._combineRenderElementPoolIndex=0;var t=this._renderElements.length,n=this._getCombineRenderElementFromPool();if(n._type=1,n._staticBatch=null,n.renderObj=this,n._batchIndexStart=this._renderElements[0]._batchIndexStart,n._batchIndexEnd=this._renderElements[0]._batchIndexEnd,n._material=this._material,n._material=this._material,e.push(n),t>1)for(var i=1;t>i;i++){var r=this._renderElements[i];this._renderElements[i-1]._batchIndexEnd!==r._batchIndexStart?(n=this._getCombineRenderElementFromPool(),n._type=1,n._staticBatch=null,n.renderObj=this,n._batchIndexStart=r._batchIndexStart,n._batchIndexEnd=r._batchIndexEnd,n._material=this._material,e.push(n)):n._batchIndexEnd=r._batchIndexEnd}},t._addToRenderQueue=function(e){this._renderElements.length>0&&e.getRenderQueue(this._material.renderQueue)._addStaticBatch(this)},t._beforeRender=function(e){return this._vertexBuffer._bind(),this._indexBuffer._bind(),!0},t._render=function(e){var t=e._batchIndexEnd-e._batchIndexStart;e.context.drawElements(4,t,5123,2*e._batchIndexStart),w.drawCall++,w.trianglesFaces+=t/3},a(0,t,"_vertexBufferCount",function(){return 1}),a(0,t,"indexOfHost",function(){return 0}),a(0,t,"triangleCount",function(){return this._indexBuffer.indexCount/3}),e._addToRenderQueueStaticBatch=function(t,n){var i=0,r=0;if(n instanceof laya.d3.core.MeshSprite3D&&n.isStatic){var a=n.meshRender.renderCullingObject._renderElements;for(i=0,r=a.length;r>i;i++){var s=a[i];1===s.renderObj._vertexBufferCount&&t._staticBatchManager._addPrepareRenderElement(s)}}for(i=0,r=n.numChildren;r>i;i++)e._addToRenderQueueStaticBatch(t,n._childs[i])},e.combine=function(t){var n=t.scene;if(!n)throw new Error("BaseScene: staticBatchRoot is not a part of scene.");e._addToRenderQueueStaticBatch(n,t),n._staticBatchManager._finishCombineStaticBatch(t)},e.maxVertexCount=65535,e}(),q=function(){function e(){this._staticBatches=null,this._prepareStaticBatchCombineElements=null,this._staticBatches={},this._prepareStaticBatchCombineElements=[]}r(e,"laya.d3.graphics.StaticBatchManager");var t=e.prototype;return t._finshCombine=function(){for(var e in this._staticBatches)this._staticBatches[e]._finshCombine()},t.getStaticBatch=function(e,t,n,i){var r,a=e.id.toString()+n.id.toString()+t.id.toString()+i;return this._staticBatches[a]?r=this._staticBatches[a]:this._staticBatches[a]=r=new X(e,t,n),r},t._garbageCollection=function(){for(var e in this._staticBatches)0===this._staticBatches[e].combineRenderElementsCount&&delete this._staticBatches[e]},t._addPrepareRenderElement=function(e){this._prepareStaticBatchCombineElements.push(e)},t._finishCombineStaticBatch=function(t){this._prepareStaticBatchCombineElements.sort(e._sortPrepareStaticBatch);for(var n,i,r,a,s,o,h,l=!1,u=0,_=0,c=this._prepareStaticBatchCombineElements.length;c>_;_++){if(a=this._prepareStaticBatchCombineElements[_],o=a.renderObj._getVertexBuffer(0),i===o.vertexDeclaration&&n===a._material)if(l)r._addCombineRenderObjTest(a)?(h=a._staticBatch,h&&h!==r&&h._deleteCombineRenderObj(a),r._addCombineRenderObj(a)):(l=!1,u++);else{s=this._prepareStaticBatchCombineElements[_-1];var d=s.renderObj,m=a.renderObj;d._getVertexBuffer().vertexCount+m._getVertexBuffer().vertexCount>X.maxVertexCount?l=!1:(r=this.getStaticBatch(t,i,n,u),h=s._staticBatch,h&&h!==r&&h._deleteCombineRenderObj(s),r._addCombineRenderObj(s),h=a._staticBatch,h&&h!==r&&h._deleteCombineRenderObj(a),r._addCombineRenderObj(a),l=!0)}else l=!1,u=0;n=a._material,i=o.vertexDeclaration}this._garbageCollection(),this._finshCombine(),this._prepareStaticBatchCombineElements.length=0},t._clearRenderElements=function(){for(var e in this._staticBatches)this._staticBatches[e]._clearRenderElements()},t._addToRenderQueue=function(e){for(var t in this._staticBatches)this._staticBatches[t]._addToRenderQueue(e)},t.dispose=function(){this._staticBatches=null},e._sortPrepareStaticBatch=function(e,t){var n=e._mainSortID-t._mainSortID;return 0===n?e.renderObj.triangleCount-t.renderObj.triangleCount:n},e}(),Q=function(){function e(t,n){if(this._id=0,this._shaderValues=null,this._shaderDefine=0,this._vertexStride=0,this._vertexElements=null,this._vertexElementsDic=null,this._id=++e._uniqueIDCounter,this._id>e.maxVertexDeclaration)throw new Error("VertexDeclaration: VertexDeclaration count should not large than ",e.maxVertexDeclaration);this._shaderValues=new A,this._vertexElementsDic={},this._vertexStride=t,this._vertexElements=n;for(var i=0;i<n.length;i++){var r=n[i],a=r.elementUsage;this._vertexElementsDic[a]=r;var s=[e._getTypeSize(r.elementFormat)/4,5126,!1,this._vertexStride,r.offset];switch(this._shaderValues.pushValue(a,s),a){case"UV":this._shaderDefine|=2097152;break;case"COLOR":this._shaderDefine|=32}}}r(e,"laya.d3.graphics.VertexDeclaration");var t=e.prototype;return t.getVertexElements=function(){return this._vertexElements.slice()},t.getVertexElementByUsage=function(e){return this._vertexElementsDic[e]},t.unBinding=function(){},a(0,t,"id",function(){return this._id}),a(0,t,"vertexStride",function(){return this._vertexStride}),a(0,t,"shaderValues",function(){return this._shaderValues}),a(0,t,"shaderDefine",function(){return this._shaderDefine}),e._getTypeSize=function(e){switch(e){case"single":return 4;case"vector2":return 8;case"vector3":return 12;case"vector4":return 16;case"volor":return 4;case"byte4":return 4;case"short2":return 4;case"short4":return 8;case"normalizedshort2":return 4;case"normalizedshort4":return 8;case"halfvector2":return 4;case"halfvector4":return 8}return 0},e.getVertexStride=function(t){for(var n=0,i=0;i<t.Length;i++){var r=t[i],a=r.offset+e._getTypeSize(r.elementFormat);a>n&&(n=a)}return n},e._maxVertexDeclarationBit=1e3,e._uniqueIDCounter=1,i(e,["maxVertexDeclaration",function(){return this.maxVertexDeclaration=2147483647-1e3*Math.floor(2147483.647)}]),e}(),Y=function(){function e(e,t,n){this.offset=0,this.elementFormat=null,this.elementUsage=null,this.offset=e,this.elementFormat=t,this.elementUsage=n}return r(e,"laya.d3.graphics.VertexElement"),e}(),Z=(function(){function e(){}return r(e,"laya.d3.graphics.VertexElementFormat"),e.Single="single",e.Vector2="vector2",e.Vector3="vector3",e.Vector4="vector4",e.Color="volor",e.Byte4="byte4",e.Short2="short2",e.Short4="short4",e.NormalizedShort2="normalizedshort2",e.NormalizedShort4="normalizedshort4",e.HalfVector2="halfvector2",e.HalfVector4="halfvector4",e}(),function(){function e(){}return r(e,"laya.d3.graphics.VertexElementUsage"),e.POSITION0="POSITION",e.COLOR0="COLOR",e.TEXTURECOORDINATE0="UV",e.NORMAL0="NORMAL",e.BINORMAL0="BINORMAL",e.TANGENT0="TANGENT0",e.BLENDINDICES0="BLENDINDICES",e.BLENDWEIGHT0="BLENDWEIGHT",e.DEPTH0="DEPTH",e.FOG0="FOG",e.POINTSIZE0="POINTSIZE",e.SAMPLE0="SAMPLE",e.TESSELLATEFACTOR0="TESSELLATEFACTOR",e.COLOR1="COLOR1",e.NEXTTEXTURECOORDINATE0="NEXTUV",e.TEXTURECOORDINATE1="UV1",e.NEXTTEXTURECOORDINATE1="NEXTUV1",e.CORNERTEXTURECOORDINATE0="CORNERTEXTURECOORDINATE",e.VELOCITY0="VELOCITY",e.STARTCOLOR0="STARTCOLOR",e.ENDCOLOR0="ENDCOLOR",e.SIZEROTATION0="SIZEROTATION",e.RADIUS0="RADIUS",e.RADIAN0="RADIAN",e.AGEADDSCALE0="AGEADDSCALE",e.TIME0="TIME",e}(),function(){function e(e,t,n){this._position=null,this._textureCoordinate0=null,this._time=NaN,this._position=e,this._textureCoordinate0=t,this._time=n}r(e,"laya.d3.graphics.VertexGlitter");var t=e.prototype;return n.imps(t,{"laya.d3.graphics.IVertex":!0}),a(0,t,"textureCoordinate",function(){return this._textureCoordinate0}),a(0,t,"position",function(){return this._position}),a(0,t,"time",function(){return this._time}),a(0,t,"vertexDeclaration",function(){return e._vertexDeclaration}),a(1,e,"vertexDeclaration",function(){return e._vertexDeclaration}),i(e,["_vertexDeclaration",function(){return this._vertexDeclaration=new Q(24,[new Y(0,"vector3","POSITION"),new Y(12,"vector2","UV"),new Y(20,"single","TIME")])}]),e}()),K=function(){function e(e,t,n,i,r,a,s,o,h,l){this._cornerTextureCoordinate=null,this._position=null,this._velocity=null,this._startColor=null,this._endColor=null,this._sizeRotation=null,this._radius=null,this._radian=null,this._ageAddScale=NaN,this._time=NaN,this._cornerTextureCoordinate=e,this._position=t,this._velocity=n,this._startColor=i,this._endColor=r,this._sizeRotation=a,this._radius=s,this._radian=o,this._ageAddScale=h,this._time=l}r(e,"laya.d3.graphics.VertexParticle");var t=e.prototype;return n.imps(t,{"laya.d3.graphics.IVertex":!0}),a(0,t,"endColor",function(){return this._endColor}),a(0,t,"cornerTextureCoordinate",function(){return this._cornerTextureCoordinate}),a(0,t,"sizeRotation",function(){return this._sizeRotation}),a(0,t,"velocity",function(){return this._velocity}),a(0,t,"position",function(){return this._position}),a(0,t,"startColor",function(){return this._startColor}),a(0,t,"radius",function(){return this._radius}),a(0,t,"radian",function(){return this._radian}),a(0,t,"ageAddScale",function(){return this._ageAddScale}),a(0,t,"time",function(){return this._time}),a(0,t,"vertexDeclaration",function(){return e._vertexDeclaration}),a(1,e,"vertexDeclaration",function(){return e._vertexDeclaration}),i(e,["_vertexDeclaration",function(){return this._vertexDeclaration=new Q(116,[new Y(0,"vector4","CORNERTEXTURECOORDINATE"),new Y(16,"vector3","POSITION"),new Y(28,"vector3","VELOCITY"),new Y(40,"vector4","STARTCOLOR"),new Y(56,"vector4","ENDCOLOR"),new Y(72,"vector3","SIZEROTATION"),new Y(84,"vector2","RADIUS"),new Y(92,"vector4","RADIAN"),new Y(108,"single","AGEADDSCALE"),new Y(112,"single","TIME")])}]),e}(),$=function(){function e(e,t,n){this._position=null,this._normal=null,this._color=null,this._position=e,this._normal=t,this._color=n}r(e,"laya.d3.graphics.VertexPositionNormalColor");var t=e.prototype;return n.imps(t,{"laya.d3.graphics.IVertex":!0}),a(0,t,"normal",function(){return this._normal}),a(0,t,"position",function(){return this._position}),a(0,t,"color",function(){return this._color}),a(0,t,"vertexDeclaration",function(){return e._vertexDeclaration}),a(1,e,"vertexDeclaration",function(){return e._vertexDeclaration}),i(e,["_vertexDeclaration",function(){return this._vertexDeclaration=new Q(40,[new Y(0,"vector3","POSITION"),new Y(12,"vector3","NORMAL"),new Y(24,"vector4","COLOR")])}]),e}(),J=function(){function e(e,t,n,i,r){this._position=null,this._normal=null,this._color=null,this._blendIndex=null,this._blendWeight=null,this._position=e,this._normal=t,this._color=n,this._blendIndex=i,this._blendWeight=r}r(e,"laya.d3.graphics.VertexPositionNormalColorSkin");var t=e.prototype;return n.imps(t,{"laya.d3.graphics.IVertex":!0}),a(0,t,"normal",function(){return this._normal}),a(0,t,"position",function(){return this._position}),a(0,t,"blendWeight",function(){return this._blendWeight}),a(0,t,"color",function(){return this._color}),a(0,t,"blendIndex",function(){return this._blendIndex}),a(0,t,"vertexDeclaration",function(){return e._vertexDeclaration}),a(1,e,"vertexDeclaration",function(){return e._vertexDeclaration}),i(e,["_vertexDeclaration",function(){return this._vertexDeclaration=new Q(72,[new Y(0,"vector3","POSITION"),new Y(12,"vector3","NORMAL"),new Y(24,"vector4","COLOR"),new Y(40,"vector4","BLENDWEIGHT"),new Y(56,"vector4","BLENDINDICES")])}]),e}(),ee=function(){function e(e,t,n,i,r,a){this._position=null,this._normal=null,this._color=null,this._blendIndex=null,this._blendWeight=null,this._tangent=null,this._position=e,this._normal=t,this._color=n,this._tangent=i,this._blendIndex=r,this._blendWeight=a}r(e,"laya.d3.graphics.VertexPositionNormalColorSkinTangent");var t=e.prototype;return n.imps(t,{"laya.d3.graphics.IVertex":!0}),a(0,t,"tangent",function(){return this._tangent}),a(0,t,"normal",function(){return this._normal}),a(0,t,"position",function(){return this._position}),a(0,t,"blendWeight",function(){return this._blendWeight}),a(0,t,"color",function(){return this._color}),a(0,t,"blendIndex",function(){return this._blendIndex}),a(0,t,"vertexDeclaration",function(){return e._vertexDeclaration}),a(1,e,"vertexDeclaration",function(){return e._vertexDeclaration}),i(e,["_vertexDeclaration",function(){return this._vertexDeclaration=new Q(84,[new Y(0,"vector3","POSITION"),new Y(12,"vector3","NORMAL"),new Y(24,"vector4","COLOR"),new Y(40,"vector4","BLENDWEIGHT"),new Y(56,"vector4","BLENDINDICES"),new Y(72,"vector3","TANGENT0")])}]),e}(),te=function(){function e(e,t,n,i){this._position=null,this._normal=null,this._color=null,this._tangent=null,this._position=e,this._normal=t,this._color=n,this._tangent=i}r(e,"laya.d3.graphics.VertexPositionNormalColorTangent");var t=e.prototype;return n.imps(t,{"laya.d3.graphics.IVertex":!0}),a(0,t,"tangent",function(){return this._tangent}),a(0,t,"normal",function(){return this._normal}),a(0,t,"position",function(){return this._position}),a(0,t,"color",function(){return this._color}),a(0,t,"vertexDeclaration",function(){return e._vertexDeclaration}),a(1,e,"vertexDeclaration",function(){return e._vertexDeclaration}),i(e,["_vertexDeclaration",function(){return this._vertexDeclaration=new Q(52,[new Y(0,"vector3","POSITION"),new Y(12,"vector3","NORMAL"),new Y(24,"vector4","COLOR"),new Y(40,"vector3","TANGENT0")])}]),e}(),ne=function(){function e(e,t,n,i){this._position=null,this._normal=null,this._color=null,this._textureCoordinate=null,this._position=e,this._normal=t,this._color=n,this._textureCoordinate=i}r(e,"laya.d3.graphics.VertexPositionNormalColorTexture");var t=e.prototype;return n.imps(t,{"laya.d3.graphics.IVertex":!0}),a(0,t,"textureCoordinate",function(){return this._textureCoordinate}),a(0,t,"normal",function(){return this._normal}),a(0,t,"position",function(){return this._position}),a(0,t,"color",function(){return this._color}),a(0,t,"vertexDeclaration",function(){return e._vertexDeclaration}),a(1,e,"vertexDeclaration",function(){return e._vertexDeclaration}),i(e,["_vertexDeclaration",function(){return this._vertexDeclaration=new Q(48,[new Y(0,"vector3","POSITION"),new Y(12,"vector3","NORMAL"),new Y(24,"vector4","COLOR"),new Y(40,"vector2","UV")])}]),e}(),ie=function(){function e(e,t,n,i,r){this._position=null,this._normal=null,this._color=null,this._textureCoordinate0=null,this._textureCoordinate1=null,this._position=e,this._norm