!function(e,t){"use strict";class r{constructor(){}static isZero(e){return Math.abs(e)0&&(a=1/Math.sqrt(a),t.x=r*a,t.y=i*a)}static scalarLength(e){var t=e.x,r=e.y;return Math.sqrt(t*t+r*r)}clone(){var e=new i;return this.cloneTo(e),e}forNativeElement(e=null){e?(this.elements=e,this.elements[0]=this.x,this.elements[1]=this.y):this.elements=new Float32Array([this.x,this.y]),i.rewriteNumProperty(this,"x",0),i.rewriteNumProperty(this,"y",1)}static rewriteNumProperty(e,t,r){Object.defineProperty(e,t,{get:function(){return this.elements[r]},set:function(e){this.elements[r]=e}})}}i.ZERO=new i(0,0),i.ONE=new i(1,1);class a{constructor(e=0,t=0,r=0,i=0){this.x=e,this.y=t,this.z=r,this.w=i}setValue(e,t,r,i){this.x=e,this.y=t,this.z=r,this.w=i}fromArray(e,t=0){this.x=e[t+0],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3]}cloneTo(e){var t=e;t.x=this.x,t.y=this.y,t.z=this.z,t.w=this.w}clone(){var e=new a;return this.cloneTo(e),e}static lerp(e,t,r,i){var a=e.x,n=e.y,s=e.z,o=e.w;i.x=a+r*(t.x-a),i.y=n+r*(t.y-n),i.z=s+r*(t.z-s),i.w=o+r*(t.w-o)}static transformByM4x4(e,t,r){var i=e.x,a=e.y,n=e.z,s=e.w,o=t.elements;r.x=i*o[0]+a*o[4]+n*o[8]+s*o[12],r.y=i*o[1]+a*o[5]+n*o[9]+s*o[13],r.z=i*o[2]+a*o[6]+n*o[10]+s*o[14],r.w=i*o[3]+a*o[7]+n*o[11]+s*o[15]}static equals(e,t){return r.nearEqual(Math.abs(e.x),Math.abs(t.x))&&r.nearEqual(Math.abs(e.y),Math.abs(t.y))&&r.nearEqual(Math.abs(e.z),Math.abs(t.z))&&r.nearEqual(Math.abs(e.w),Math.abs(t.w))}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}static normalize(e,t){var r=e.length();r>0&&(t.x=e.x*r,t.y=e.y*r,t.z=e.z*r,t.w=e.w*r)}static add(e,t,r){r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w}static subtract(e,t,r){r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z,r.w=e.w-t.w}static multiply(e,t,r){r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z,r.w=e.w*t.w}static scale(e,t,r){r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w*t}static Clamp(e,t,r,i){var a=e.x,n=e.y,s=e.z,o=e.w,l=t.x,_=t.y,h=t.z,c=t.w,d=r.x,u=r.y,f=r.z,m=r.w;a=(a=a>d?d:a)u?u:n)<_?_:n,s=(s=s>f?f:s)m?m:o)0&&(n=1/Math.sqrt(n),t.x=r*n,t.y=i*n,t.z=a*n)}static multiply(e,t,r){r.x=e.x*t.x,r.y=e.y*t.y,r.z=e.z*t.z}static scale(e,t,r){r.x=e.x*t,r.y=e.y*t,r.z=e.z*t}static lerp(e,t,r,i){var a=e.x,n=e.y,s=e.z;i.x=a+r*(t.x-a),i.y=n+r*(t.y-n),i.z=s+r*(t.z-s)}static transformV3ToV3(e,t,r){var i=n._tempVector4;n.transformV3ToV4(e,t,i),r.x=i.x,r.y=i.y,r.z=i.z}static transformV3ToV4(e,t,r){var i=e.x,a=e.y,n=e.z,s=t.elements;r.x=i*s[0]+a*s[4]+n*s[8]+s[12],r.y=i*s[1]+a*s[5]+n*s[9]+s[13],r.z=i*s[2]+a*s[6]+n*s[10]+s[14],r.w=i*s[3]+a*s[7]+n*s[11]+s[15]}static TransformNormal(e,t,r){var i=e.x,a=e.y,n=e.z,s=t.elements;r.x=i*s[0]+a*s[4]+n*s[8],r.y=i*s[1]+a*s[5]+n*s[9],r.z=i*s[2]+a*s[6]+n*s[10]}static transformCoordinate(e,t,r){var i=e.x,a=e.y,n=e.z,s=t.elements,o=i*s[3]+a*s[7]+n*s[11]+s[15];r.x=i*s[0]+a*s[4]+n*s[8]+s[12]/o,r.y=i*s[1]+a*s[5]+n*s[9]+s[13]/o,r.z=i*s[2]+a*s[6]+n*s[10]+s[14]/o}static Clamp(e,t,r,i){var a=e.x,n=e.y,s=e.z,o=t.x,l=t.y,_=t.z,h=r.x,c=r.y,d=r.z;a=(a=a>h?h:a)c?c:n)d?d:s)<_?_:s,i.x=a,i.y=n,i.z=s}static add(e,t,r){r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z}static subtract(e,t,r){r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z}static cross(e,t,r){var i=e.x,a=e.y,n=e.z,s=t.x,o=t.y,l=t.z;r.x=a*l-n*o,r.y=n*s-i*l,r.z=i*o-a*s}static dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}static equals(e,t){return r.nearEqual(e.x,t.x)&&r.nearEqual(e.y,t.y)&&r.nearEqual(e.z,t.z)}setValue(e,t,r){this.x=e,this.y=t,this.z=r}fromArray(e,t=0){this.x=e[t+0],this.y=e[t+1],this.z=e[t+2]}cloneTo(e){var t=e;t.x=this.x,t.y=this.y,t.z=this.z}clone(){var e=new n;return this.cloneTo(e),e}toDefault(){this.x=0,this.y=0,this.z=0}forNativeElement(e=null){e?(this.elements=e,this.elements[0]=this.x,this.elements[1]=this.y,this.elements[2]=this.z):this.elements=new Float32Array([this.x,this.y,this.z]),i.rewriteNumProperty(this,"x",0),i.rewriteNumProperty(this,"y",1),i.rewriteNumProperty(this,"z",2)}}n._tempVector4=new a,n._ZERO=new n(0,0,0),n._ONE=new n(1,1,1),n._NegativeUnitX=new n(-1,0,0),n._UnitX=new n(1,0,0),n._UnitY=new n(0,1,0),n._UnitZ=new n(0,0,1),n._ForwardRH=new n(0,0,-1),n._ForwardLH=new n(0,0,1),n._Up=new n(0,1,0);class s{constructor(){this._defaultPhysicsMemory=16,this._maxLightCount=32,this._lightClusterCount=new n(12,12,12),this._editerEnvironment=!1,this.isAntialias=!0,this.isAlpha=!1,this.premultipliedAlpha=!0,this.isStencil=!0,this.enbaleMultiLight=!0,this.octreeCulling=!1,this.octreeInitialSize=64,this.octreeInitialCenter=new n(0,0,0),this.octreeMinNodeSize=2,this.octreeLooseness=1.25,this.debugFrustumCulling=!1,this._maxAreaLightCountPerClusterAverage=Math.min(4*Math.floor(2048/this._lightClusterCount.z-1),this._maxLightCount)}get defaultPhysicsMemory(){return this._defaultPhysicsMemory}set defaultPhysicsMemory(e){if(e<16)throw"defaultPhysicsMemory must large than 16M";this._defaultPhysicsMemory=e}get maxLightCount(){return this._maxLightCount}set maxLightCount(e){e>2048?(this._maxLightCount=2048,console.warn("Config3D: maxLightCount must less equal 2048.")):this._maxLightCount=e}get lightClusterCount(){return this._lightClusterCount}set lightClusterCount(e){e.x>128||e.y>128||e.z>128?(this._lightClusterCount.setValue(Math.min(e.x,128),Math.min(e.y,128),Math.min(e.z,128)),console.warn("Config3D: lightClusterCount X and Y、Z must less equal 128.")):e.cloneTo(this._lightClusterCount);var t=4*Math.floor(2048/this._lightClusterCount.z-1);t0?Math.atan(t/e):e<0?t>0?Math.atan(t/e)+Math.PI:Math.atan(t/e)-Math.PI:0}static angleTo(e,t,r){n.subtract(t,e,u.TEMPVector30),n.normalize(u.TEMPVector30,u.TEMPVector30),r.x=Math.asin(u.TEMPVector30.y),r.y=u.arcTanAngle(-u.TEMPVector30.z,-u.TEMPVector30.x)}static createFromAxisAngle(e,t,r){t*=.5;var i=Math.sin(t);r.x=i*e.x,r.y=i*e.y,r.z=i*e.z,r.w=Math.cos(t)}static createFromMatrix4x4(e,t){var r,i,a=e.elements,n=a[0]+a[5]+a[10];n>0?(r=Math.sqrt(n+1),t.w=.5*r,r=.5/r,t.x=(a[6]-a[9])*r,t.y=(a[8]-a[2])*r,t.z=(a[1]-a[4])*r):a[0]>=a[5]&&a[0]>=a[10]?(i=.5/(r=Math.sqrt(1+a[0]-a[5]-a[10])),t.x=.5*r,t.y=(a[1]+a[4])*i,t.z=(a[2]+a[8])*i,t.w=(a[6]-a[9])*i):a[5]>a[10]?(i=.5/(r=Math.sqrt(1+a[5]-a[0]-a[10])),t.x=(a[4]+a[1])*i,t.y=.5*r,t.z=(a[9]+a[6])*i,t.w=(a[8]-a[2])*i):(i=.5/(r=Math.sqrt(1+a[10]-a[0]-a[5])),t.x=(a[8]+a[2])*i,t.y=(a[9]+a[6])*i,t.z=.5*r,t.w=(a[1]-a[4])*i)}static slerp(e,t,r,i){var a,n,s,o,l,_=e.x,h=e.y,c=e.z,d=e.w,u=t.x,f=t.y,m=t.z,E=t.w;return(n=_*u+h*f+c*m+d*E)<0&&(n=-n,u=-u,f=-f,m=-m,E=-E),1-n>1e-6?(a=Math.acos(n),s=Math.sin(a),o=Math.sin((1-r)*a)/s,l=Math.sin(r*a)/s):(o=1-r,l=r),i.x=o*_+l*u,i.y=o*h+l*f,i.z=o*c+l*m,i.w=o*d+l*E,i}static lerp(e,t,r,i){var a=1-r;u.dot(e,t)>=0?(i.x=a*e.x+r*t.x,i.y=a*e.y+r*t.y,i.z=a*e.z+r*t.z,i.w=a*e.w+r*t.w):(i.x=a*e.x-r*t.x,i.y=a*e.y-r*t.y,i.z=a*e.z-r*t.z,i.w=a*e.w-r*t.w),i.normalize(i)}static add(e,t,r){r.x=e.x+t.x,r.y=e.y+t.y,r.z=e.z+t.z,r.w=e.w+t.w}static dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}scaling(e,t){t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e}normalize(e){var t=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w;t>0&&(t=1/Math.sqrt(t),e.x=this.x*t,e.y=this.y*t,e.z=this.z*t,e.w=this.w*t)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}rotateX(e,t){e*=.5;var r=Math.sin(e),i=Math.cos(e);t.x=this.x*i+this.w*r,t.y=this.y*i+this.z*r,t.z=this.z*i-this.y*r,t.w=this.w*i-this.x*r}rotateY(e,t){e*=.5;var r=Math.sin(e),i=Math.cos(e);t.x=this.x*i-this.z*r,t.y=this.y*i+this.w*r,t.z=this.z*i+this.x*r,t.w=this.w*i-this.y*r}rotateZ(e,t){e*=.5;var r=Math.sin(e),i=Math.cos(e);t.x=this.x*i+this.y*r,t.y=this.y*i-this.x*r,t.z=this.z*i+this.w*r,t.w=this.w*i-this.z*r}getYawPitchRoll(e){n.transformQuat(n._ForwardRH,this,u.TEMPVector31),n.transformQuat(n._Up,this,u.TEMPVector32);var t=u.TEMPVector32;u.angleTo(n._ZERO,u.TEMPVector31,u.TEMPVector33);var r=u.TEMPVector33;r.x==Math.PI/2?(r.y=u.arcTanAngle(t.z,t.x),r.z=0):r.x==-Math.PI/2?(r.y=u.arcTanAngle(-t.z,-t.x),r.z=0):(o.Matrix4x4.createRotationY(-r.y,o.Matrix4x4.TEMPMatrix0),o.Matrix4x4.createRotationX(-r.x,o.Matrix4x4.TEMPMatrix1),n.transformCoordinate(u.TEMPVector32,o.Matrix4x4.TEMPMatrix0,u.TEMPVector32),n.transformCoordinate(u.TEMPVector32,o.Matrix4x4.TEMPMatrix1,u.TEMPVector32),r.z=u.arcTanAngle(t.y,-t.x)),r.y<=-Math.PI&&(r.y=Math.PI),r.z<=-Math.PI&&(r.z=Math.PI),r.y>=Math.PI&&r.z>=Math.PI&&(r.y=0,r.z=0,r.x=Math.PI-r.x);var i=e;i.x=r.y,i.y=r.x,i.z=r.z}invert(e){var t=this.x,r=this.y,i=this.z,a=this.w,n=t*t+r*r+i*i+a*a,s=n?1/n:0;e.x=-t*s,e.y=-r*s,e.z=-i*s,e.w=a*s}identity(){this.x=0,this.y=0,this.z=0,this.w=1}fromArray(e,t=0){this.x=e[t+0],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3]}cloneTo(e){this!==e&&(e.x=this.x,e.y=this.y,e.z=this.z,e.w=this.w)}clone(){var e=new u;return this.cloneTo(e),e}equals(e){return r.nearEqual(this.x,e.x)&&r.nearEqual(this.y,e.y)&&r.nearEqual(this.z,e.z)&&r.nearEqual(this.w,e.w)}static rotationLookAt(e,t,r){u.lookAt(n._ZERO,e,t,r)}static lookAt(e,t,r,i){d.lookAt(e,t,r,u._tempMatrix3x3),u.rotationMatrix(u._tempMatrix3x3,i)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}static invert(e,t){var i=e.lengthSquared();r.isZero(i)||(i=1/i,t.x=-e.x*i,t.y=-e.y*i,t.z=-e.z*i,t.w=e.w*i)}static rotationMatrix(e,t){var r,i,a=e.elements,n=a[0],s=a[1],o=a[2],l=a[3],_=a[4],h=a[5],c=a[6],d=a[7],u=a[8],f=n+_+u;f>0?(r=Math.sqrt(f+1),t.w=.5*r,r=.5/r,t.x=(h-d)*r,t.y=(c-o)*r,t.z=(s-l)*r):n>=_&&n>=u?(i=.5/(r=Math.sqrt(1+n-_-u)),t.x=.5*r,t.y=(s+l)*i,t.z=(o+c)*i,t.w=(h-d)*i):_>u?(i=.5/(r=Math.sqrt(1+_-n-u)),t.x=(l+s)*i,t.y=.5*r,t.z=(d+h)*i,t.w=(c-o)*i):(i=.5/(r=Math.sqrt(1+u-n-_)),t.x=(c+o)*i,t.y=(d+h)*i,t.z=.5*r,t.w=(s-l)*i)}forNativeElement(e=null){e?(this.elements=e,this.elements[0]=this.x,this.elements[1]=this.y,this.elements[2]=this.z,this.elements[3]=this.w):this.elements=new Float32Array([this.x,this.y,this.z,this.w]),i.rewriteNumProperty(this,"x",0),i.rewriteNumProperty(this,"y",1),i.rewriteNumProperty(this,"z",2),i.rewriteNumProperty(this,"w",3)}}u.TEMPVector30=new n,u.TEMPVector31=new n,u.TEMPVector32=new n,u.TEMPVector33=new n,u._tempMatrix3x3=new d,u.DEFAULT=new u,u.NAN=new u(NaN,NaN,NaN,NaN);class f extends h{constructor(){super(),this.inTangent=new a,this.outTangent=new a,this.value=new u}cloneTo(e){super.cloneTo(e);var t=e;this.inTangent.cloneTo(t.inTangent),this.outTangent.cloneTo(t.outTangent),this.value.cloneTo(t.value)}}window.conch&&window.conchFloatArrayKeyframe&&(f=window.conchFloatArrayKeyframe),window.qq&&window.qq.webglPlus&&(f=window.qq.webglPlus.conchFloatArrayKeyframe);class m extends h{constructor(){super(),this.inTangent=new n,this.outTangent=new n,this.value=new n}cloneTo(e){super.cloneTo(e);var t=e;this.inTangent.cloneTo(t.inTangent),this.outTangent.cloneTo(t.outTangent),this.value.cloneTo(t.value)}}window.conch&&window.conchFloatArrayKeyframe&&(m=window.conchFloatArrayKeyframe),window.qq&&window.qq.webglPlus&&(m=window.qq.webglPlus.conchFloatArrayKeyframe);class E{constructor(e=0,t=0,r=0,i=0){var a=this.elements=new Float32Array(4);a[0]=e,a[1]=t,a[2]=r,a[3]=i}get x(){return this.elements[0]}set x(e){this.elements[0]=e}get y(){return this.elements[1]}set y(e){this.elements[1]=e}get z(){return this.elements[2]}set z(e){this.elements[2]=e}get w(){return this.elements[3]}set w(e){this.elements[3]=e}fromArray(e,t=0){this.elements[0]=e[t+0],this.elements[1]=e[t+1],this.elements[2]=e[t+2],this.elements[3]=e[t+3]}cloneTo(e){var t=e.elements,r=this.elements;t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3]}clone(){var e=new E;return this.cloneTo(e),e}static lerp(e,t,r,i){var a=i.elements,n=e.elements,s=t.elements,o=n[0],l=n[1],_=n[2],h=n[3];a[0]=o+r*(s[0]-o),a[1]=l+r*(s[1]-l),a[2]=_+r*(s[2]-_),a[3]=h+r*(s[3]-h)}static transformByM4x4(e,t,r){var i=e.elements,a=i[0],n=i[1],s=i[2],o=i[3],l=t.elements,_=r.elements;_[0]=a*l[0]+n*l[4]+s*l[8]+o*l[12],_[1]=a*l[1]+n*l[5]+s*l[9]+o*l[13],_[2]=a*l[2]+n*l[6]+s*l[10]+o*l[14],_[3]=a*l[3]+n*l[7]+s*l[11]+o*l[15]}static equals(e,t){var i=e.elements,a=t.elements;return r.nearEqual(Math.abs(i[0]),Math.abs(a[0]))&&r.nearEqual(Math.abs(i[1]),Math.abs(a[1]))&&r.nearEqual(Math.abs(i[2]),Math.abs(a[2]))&&r.nearEqual(Math.abs(i[3]),Math.abs(a[3]))}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}static normalize(e,t){var r=e.elements,i=t.elements,a=e.length();a>0&&(i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i[3]=r[3]*a)}static add(e,t,r){var i=r.elements,a=e.elements,n=t.elements;i[0]=a[0]+n[0],i[1]=a[1]+n[1],i[2]=a[2]+n[2],i[3]=a[3]+n[3]}static subtract(e,t,r){var i=r.elements,a=e.elements,n=t.elements;i[0]=a[0]-n[0],i[1]=a[1]-n[1],i[2]=a[2]-n[2],i[3]=a[3]-n[3]}static multiply(e,t,r){var i=r.elements,a=e.elements,n=t.elements;i[0]=a[0]*n[0],i[1]=a[1]*n[1],i[2]=a[2]*n[2],i[3]=a[3]*n[3]}static scale(e,t,r){var i=r.elements,a=e.elements;i[0]=a[0]*t,i[1]=a[1]*t,i[2]=a[2]*t,i[3]=a[3]*t}static Clamp(e,t,r,i){var a=e.elements,n=a[0],s=a[1],o=a[2],l=a[3],_=t.elements,h=_[0],c=_[1],d=_[2],u=_[3],f=r.elements,m=f[0],E=f[1],T=f[2],p=f[3],g=i.elements;n=(n=n>m?m:n)E?E:s)T?T:o)p?p:l)0&&(o=1/Math.sqrt(o),i[0]=r[0]*o,i[1]=r[1]*o,i[2]=r[2]*o)}static multiply(e,t,r){var i=r.elements,a=e.elements,n=t.elements;i[0]=a[0]*n[0],i[1]=a[1]*n[1],i[2]=a[2]*n[2]}static scale(e,t,r){var i=r.elements,a=e.elements;i[0]=a[0]*t,i[1]=a[1]*t,i[2]=a[2]*t}static lerp(e,t,r,i){var a=i.elements,n=e.elements,s=t.elements,o=n[0],l=n[1],_=n[2];a[0]=o+r*(s[0]-o),a[1]=l+r*(s[1]-l),a[2]=_+r*(s[2]-_)}static transformV3ToV3(e,t,r){var i=T._tempVector4;T.transformV3ToV4(e,t,i);var a=i.elements,n=r.elements;n[0]=a[0],n[1]=a[1],n[2]=a[2]}static transformV3ToV4(e,t,r){var i=e.elements,a=i[0],n=i[1],s=i[2],o=t.elements,l=r.elements;l[0]=a*o[0]+n*o[4]+s*o[8]+o[12],l[1]=a*o[1]+n*o[5]+s*o[9]+o[13],l[2]=a*o[2]+n*o[6]+s*o[10]+o[14],l[3]=a*o[3]+n*o[7]+s*o[11]+o[15]}static TransformNormal(e,t,r){var i=e.elements,a=i[0],n=i[1],s=i[2],o=t.elements,l=r.elements;l[0]=a*o[0]+n*o[4]+s*o[8],l[1]=a*o[1]+n*o[5]+s*o[9],l[2]=a*o[2]+n*o[6]+s*o[10]}static transformCoordinate(e,t,r){var i=e.elements,a=i[0],n=i[1],s=i[2],o=t.elements,l=a*o[3]+n*o[7]+s*o[11]+o[15],_=r.elements;_[0]=a*o[0]+n*o[4]+s*o[8]+o[12]/l,_[1]=a*o[1]+n*o[5]+s*o[9]+o[13]/l,_[2]=a*o[2]+n*o[6]+s*o[10]+o[14]/l}static Clamp(e,t,r,i){var a=e.elements,n=a[0],s=a[1],o=a[2],l=t.elements,_=l[0],h=l[1],c=l[2],d=r.elements,u=d[0],f=d[1],m=d[2],E=i.elements;n=(n=n>u?u:n)<_?_:n,s=(s=s>f?f:s)m?m:o)3)throw new Error("row Rows and columns for matrices run from 0 to 3, inclusive.");if(t<0||t>3)throw new Error("column Rows and columns for matrices run from 0 to 3, inclusive.");return this.elements[4*e+t]}setElementByRowColumn(e,t,r){if(e<0||e>3)throw new Error("row Rows and columns for matrices run from 0 to 3, inclusive.");if(t<0||t>3)throw new Error("column Rows and columns for matrices run from 0 to 3, inclusive.");this.elements[4*e+t]=r}equalsOtherMatrix(e){var t=this.elements,i=e.elements;return r.nearEqual(t[0],i[0])&&r.nearEqual(t[1],i[1])&&r.nearEqual(t[2],i[2])&&r.nearEqual(t[3],i[3])&&r.nearEqual(t[4],i[4])&&r.nearEqual(t[5],i[5])&&r.nearEqual(t[6],i[6])&&r.nearEqual(t[7],i[7])&&r.nearEqual(t[8],i[8])&&r.nearEqual(t[9],i[9])&&r.nearEqual(t[10],i[10])&&r.nearEqual(t[11],i[11])&&r.nearEqual(t[12],i[12])&&r.nearEqual(t[13],i[13])&&r.nearEqual(t[14],i[14])&&r.nearEqual(t[15],i[15])}decomposeTransRotScale(e,t,r){var i=p._tempMatrix4x4;return this.decomposeTransRotMatScale(e,i,r)?(u.createFromMatrix4x4(i,t),!0):(t.identity(),!1)}decomposeTransRotMatScale(e,t,i){var a=this.elements,s=e,o=t.elements,l=i;s.x=a[12],s.y=a[13],s.z=a[14];var _=a[0],h=a[1],c=a[2],d=a[4],u=a[5],f=a[6],m=a[8],E=a[9],T=a[10],g=l.x=Math.sqrt(_*_+h*h+c*c),S=l.y=Math.sqrt(d*d+u*u+f*f),v=l.z=Math.sqrt(m*m+E*E+T*T);if(r.isZero(g)||r.isZero(S)||r.isZero(v))return o[1]=o[2]=o[3]=o[4]=o[6]=o[7]=o[8]=o[9]=o[11]=o[12]=o[13]=o[14]=0,o[0]=o[5]=o[10]=o[15]=1,!1;var R=p._tempVector0;R.x=m/v,R.y=E/v,R.z=T/v;var I=p._tempVector1;I.x=_/g,I.y=h/g,I.z=c/g;var x=p._tempVector2;n.cross(R,I,x);var A=p._tempVector1;return n.cross(x,R,A),o[3]=o[7]=o[11]=o[12]=o[13]=o[14]=0,o[15]=1,o[0]=A.x,o[1]=A.y,o[2]=A.z,o[4]=x.x,o[5]=x.y,o[6]=x.z,o[8]=R.x,o[9]=R.y,o[10]=R.z,o[0]*_+o[1]*h+o[2]*c<0&&(l.x=-g),o[4]*d+o[5]*u+o[6]*f<0&&(l.y=-S),o[8]*m+o[9]*E+o[10]*T<0&&(l.z=-v),!0}decomposeYawPitchRoll(e){var t=Math.asin(-this.elements[9]);e.y=t,Math.cos(t)>r.zeroTolerance?(e.z=Math.atan2(this.elements[1],this.elements[5]),e.x=Math.atan2(this.elements[8],this.elements[10])):(e.z=Math.atan2(-this.elements[4],this.elements[0]),e.x=0)}normalize(){var e=this.elements,t=e[0],r=e[1],i=e[2],a=Math.sqrt(t*t+r*r+i*i);if(!a)return e[0]=0,e[1]=0,void(e[2]=0);1!=a&&(a=1/a,e[0]=t*a,e[1]=r*a,e[2]=i*a)}transpose(){var e,t;return t=(e=this.elements)[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}invert(e){var t=this.elements,r=e.elements,i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],_=t[6],h=t[7],c=t[8],d=t[9],u=t[10],f=t[11],m=t[12],E=t[13],T=t[14],p=t[15],g=i*l-a*o,S=i*_-n*o,v=i*h-s*o,R=a*_-n*l,I=a*h-s*l,x=n*h-s*_,A=c*E-d*m,D=c*T-u*m,M=c*p-f*m,L=d*T-u*E,C=d*p-f*E,y=u*p-f*T,O=g*y-S*C+v*L+R*M-I*D+x*A;0!==Math.abs(O)&&(O=1/O,r[0]=(l*y-_*C+h*L)*O,r[1]=(n*C-a*y-s*L)*O,r[2]=(E*x-T*I+p*R)*O,r[3]=(u*I-d*x-f*R)*O,r[4]=(_*M-o*y-h*D)*O,r[5]=(i*y-n*M+s*D)*O,r[6]=(T*v-m*x-p*S)*O,r[7]=(c*x-u*v+f*S)*O,r[8]=(o*C-l*M+h*A)*O,r[9]=(a*M-i*C-s*A)*O,r[10]=(m*I-E*v+p*g)*O,r[11]=(d*v-c*I-f*g)*O,r[12]=(l*D-o*L-_*A)*O,r[13]=(i*L-a*D+n*A)*O,r[14]=(E*S-m*R-T*g)*O,r[15]=(c*R-d*S+u*g)*O)}static billboard(e,t,i,a,s,o){n.subtract(e,t,p._tempVector0);var l=n.scalarLengthSquared(p._tempVector0);r.isZero(l)?(n.scale(s,-1,p._tempVector1),p._tempVector1.cloneTo(p._tempVector0)):n.scale(p._tempVector0,1/Math.sqrt(l),p._tempVector0),n.cross(a,p._tempVector0,p._tempVector2),n.normalize(p._tempVector2,p._tempVector2),n.cross(p._tempVector0,p._tempVector2,p._tempVector3);var _=p._tempVector2,h=p._tempVector3,c=p._tempVector0,d=e,u=o.elements;u[0]=_.x,u[1]=_.y,u[2]=_.z,u[3]=0,u[4]=h.x,u[5]=h.y,u[6]=h.z,u[7]=0,u[8]=c.x,u[9]=c.y,u[10]=c.z,u[11]=0,u[12]=d.x,u[13]=d.y,u[14]=d.z,u[15]=1}identity(){var e=this.elements;e[1]=e[2]=e[3]=e[4]=e[6]=e[7]=e[8]=e[9]=e[11]=e[12]=e[13]=e[14]=0,e[0]=e[5]=e[10]=e[15]=1}cloneTo(e){var t,r,i;if((r=this.elements)!==(i=e.elements))for(t=0;t<16;++t)i[t]=r[t]}clone(){var e=new p;return this.cloneTo(e),e}static translation(e,t){var r=t.elements;r[0]=r[5]=r[10]=r[15]=1,r[12]=e.x,r[13]=e.y,r[14]=e.z}getTranslationVector(e){var t=this.elements;e.x=t[12],e.y=t[13],e.z=t[14]}setTranslationVector(e){var t=this.elements,r=e;t[12]=r.x,t[13]=r.y,t[14]=r.z}getForward(e){var t=this.elements;e.x=-t[8],e.y=-t[9],e.z=-t[10]}setForward(e){var t=this.elements;t[8]=-e.x,t[9]=-e.y,t[10]=-e.z}}p._tempMatrix4x4=new p,p.TEMPMatrix0=new p,p.TEMPMatrix1=new p,p._tempVector0=new n,p._tempVector1=new n,p._tempVector2=new n,p._tempVector3=new n,p._tempQuaternion=new u,p.DEFAULT=new p,p.ZERO=new p(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);class g{constructor(e=0,t=0,r=0,i=1,a=null){var n;(n=a||new Float32Array(4))[0]=e,n[1]=t,n[2]=r,n[3]=i,this.elements=n}static _dotArray(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static _normalizeArray(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=r*r+i*i+a*a+n*n;s>0&&(s=1/Math.sqrt(s),t[0]=r*s,t[1]=i*s,t[2]=a*s,t[3]=n*s)}static _lerpArray(e,t,r,i){var a=1-r;g._dotArray(e,t)>=0?(i[0]=a*e[0]+r*t[0],i[1]=a*e[1]+r*t[1],i[2]=a*e[2]+r*t[2],i[3]=a*e[3]+r*t[3]):(i[0]=a*e[0]-r*t[0],i[1]=a*e[1]-r*t[1],i[2]=a*e[2]-r*t[2],i[3]=a*e[3]-r*t[3]),g._normalizeArray(i,i)}static createFromYawPitchRoll(e,t,r,i){var a=.5*r,n=.5*t,s=.5*e,o=Math.sin(a),l=Math.cos(a),_=Math.sin(n),h=Math.cos(n),c=Math.sin(s),d=Math.cos(s),u=i.elements;u[0]=d*_*l+c*h*o,u[1]=c*h*l-d*_*o,u[2]=d*h*o-c*_*l,u[3]=d*h*l+c*_*o}static multiply(e,t,r){var i=e.elements,a=t.elements,n=r.elements,s=i[0],o=i[1],l=i[2],_=i[3],h=a[0],c=a[1],d=a[2],u=a[3],f=o*d-l*c,m=l*h-s*d,E=s*c-o*h,T=s*h+o*c+l*d;n[0]=s*u+h*_+f,n[1]=o*u+c*_+m,n[2]=l*u+d*_+E,n[3]=_*u-T}static arcTanAngle(e,t){return 0==e?1==t?Math.PI/2:-Math.PI/2:e>0?Math.atan(t/e):e<0?t>0?Math.atan(t/e)+Math.PI:Math.atan(t/e)-Math.PI:0}static angleTo(e,t,r){T.subtract(t,e,g.TEMPVector30),T.normalize(g.TEMPVector30,g.TEMPVector30),r.elements[0]=Math.asin(g.TEMPVector30.y),r.elements[1]=g.arcTanAngle(-g.TEMPVector30.z,-g.TEMPVector30.x)}static createFromAxisAngle(e,t,r){var i=r.elements,a=e.elements;t*=.5;var n=Math.sin(t);i[0]=n*a[0],i[1]=n*a[1],i[2]=n*a[2],i[3]=Math.cos(t)}static createFromMatrix3x3(e,t){var r,i=t.elements,a=e.elements,n=a[0]+a[4]+a[8];if(n>0)r=Math.sqrt(n+1),i[3]=.5*r,r=.5/r,i[0]=(a[5]-a[7])*r,i[1]=(a[6]-a[2])*r,i[2]=(a[1]-a[3])*r;else{var s=0;a[4]>a[0]&&(s=1),a[8]>a[3*s+s]&&(s=2);var o=(s+1)%3,l=(s+2)%3;r=Math.sqrt(a[3*s+s]-a[3*o+o]-a[3*l+l]+1),i[s]=.5*r,r=.5/r,i[3]=(a[3*o+l]-a[3*l+o])*r,i[o]=(a[3*o+s]+a[3*s+o])*r,i[l]=(a[3*l+s]+a[3*s+l])*r}}static createFromMatrix4x4(e,t){var r,i,a=e.elements,n=t.elements,s=a[0]+a[5]+a[10];s>0?(r=Math.sqrt(s+1),n[3]=.5*r,r=.5/r,n[0]=(a[6]-a[9])*r,n[1]=(a[8]-a[2])*r,n[2]=(a[1]-a[4])*r):a[0]>=a[5]&&a[0]>=a[10]?(i=.5/(r=Math.sqrt(1+a[0]-a[5]-a[10])),n[0]=.5*r,n[1]=(a[1]+a[4])*i,n[2]=(a[2]+a[8])*i,n[3]=(a[6]-a[9])*i):a[5]>a[10]?(i=.5/(r=Math.sqrt(1+a[5]-a[0]-a[10])),n[0]=(a[4]+a[1])*i,n[1]=.5*r,n[2]=(a[9]+a[6])*i,n[3]=(a[8]-a[2])*i):(i=.5/(r=Math.sqrt(1+a[10]-a[0]-a[5])),n[0]=(a[8]+a[2])*i,n[1]=(a[9]+a[6])*i,n[2]=.5*r,n[3]=(a[1]-a[4])*i)}static slerp(e,t,r,i){var a,n,s,o,l,_=e.elements,h=t.elements,c=i.elements,d=_[0],u=_[1],f=_[2],m=_[3],E=h[0],T=h[1],p=h[2],g=h[3];return(n=d*E+u*T+f*p+m*g)<0&&(n=-n,E=-E,T=-T,p=-p,g=-g),1-n>1e-6?(a=Math.acos(n),s=Math.sin(a),o=Math.sin((1-r)*a)/s,l=Math.sin(r*a)/s):(o=1-r,l=r),c[0]=o*d+l*E,c[1]=o*u+l*T,c[2]=o*f+l*p,c[3]=o*m+l*g,c}static lerp(e,t,r,i){g._lerpArray(e.elements,t.elements,r,i.elements)}static add(e,t,r){var i=r.elements,a=e.elements,n=t.elements;i[0]=a[0]+n[0],i[1]=a[1]+n[1],i[2]=a[2]+n[2],i[3]=a[3]+n[3]}static dot(e,t){return g._dotArray(e.elements,t.elements)}get x(){return this.elements[0]}set x(e){this.elements[0]=e}get y(){return this.elements[1]}set y(e){this.elements[1]=e}get z(){return this.elements[2]}set z(e){this.elements[2]=e}get w(){return this.elements[3]}set w(e){this.elements[3]=e}scaling(e,t){var r=t.elements,i=this.elements;r[0]=i[0]*e,r[1]=i[1]*e,r[2]=i[2]*e,r[3]=i[3]*e}normalize(e){g._normalizeArray(this.elements,e.elements)}length(){var e=this.elements,t=e[0],r=e[1],i=e[2],a=e[3];return Math.sqrt(t*t+r*r+i*i+a*a)}rotateX(e,t){var r=t.elements,i=this.elements;e*=.5;var a=i[0],n=i[1],s=i[2],o=i[3],l=Math.sin(e),_=Math.cos(e);r[0]=a*_+o*l,r[1]=n*_+s*l,r[2]=s*_-n*l,r[3]=o*_-a*l}rotateY(e,t){var r=t.elements,i=this.elements;e*=.5;var a=i[0],n=i[1],s=i[2],o=i[3],l=Math.sin(e),_=Math.cos(e);r[0]=a*_-s*l,r[1]=n*_+o*l,r[2]=s*_+a*l,r[3]=o*_-n*l}rotateZ(e,t){var r=t.elements,i=this.elements;e*=.5;var a=i[0],n=i[1],s=i[2],o=i[3],l=Math.sin(e),_=Math.cos(e);r[0]=a*_+n*l,r[1]=n*_-a*l,r[2]=s*_+o*l,r[3]=o*_-s*l}getYawPitchRoll(e){T.transformQuat(T.ForwardRH,this,g.TEMPVector31),T.transformQuat(T.Up,this,g.TEMPVector32);var t=g.TEMPVector32.elements;g.angleTo(T.ZERO,g.TEMPVector31,g.TEMPVector33);var r=g.TEMPVector33.elements;r[0]==Math.PI/2?(r[1]=g.arcTanAngle(t[2],t[0]),r[2]=0):r[0]==-Math.PI/2?(r[1]=g.arcTanAngle(-t[2],-t[0]),r[2]=0):(p.createRotationY(-r[1],g.TEMPMatrix0),p.createRotationX(-r[0],g.TEMPMatrix1),T.transformCoordinate(g.TEMPVector32,g.TEMPMatrix0,g.TEMPVector32),T.transformCoordinate(g.TEMPVector32,g.TEMPMatrix1,g.TEMPVector32),r[2]=g.arcTanAngle(t[1],-t[0])),r[1]<=-Math.PI&&(r[1]=Math.PI),r[2]<=-Math.PI&&(r[2]=Math.PI),r[1]>=Math.PI&&r[2]>=Math.PI&&(r[1]=0,r[2]=0,r[0]=Math.PI-r[0]);var i=e.elements;i[0]=r[1],i[1]=r[0],i[2]=r[2]}invert(e){var t=e.elements,r=this.elements,i=r[0],a=r[1],n=r[2],s=r[3],o=i*i+a*a+n*n+s*s,l=o?1/o:0;t[0]=-i*l,t[1]=-a*l,t[2]=-n*l,t[3]=s*l}identity(){var e=this.elements;e[0]=0,e[1]=0,e[2]=0,e[3]=1}fromArray(e,t=0){this.elements[0]=e[t+0],this.elements[1]=e[t+1],this.elements[2]=e[t+2],this.elements[3]=e[t+3]}cloneTo(e){var t,r,i;if((r=this.elements)!==(i=e.elements))for(t=0;t<4;++t)i[t]=r[t]}clone(){var e=new g;return this.cloneTo(e),e}equals(e){var t=this.elements,i=e.elements;return r.nearEqual(t[0],i[0])&&r.nearEqual(t[1],i[1])&&r.nearEqual(t[2],i[2])&&r.nearEqual(t[3],i[3])}static rotationLookAt(e,t,r){g.lookAt(T.ZERO,e,t,r)}static lookAt(e,t,r,i){d.lookAt(e,t,r,g._tempMatrix3x3),g.rotationMatrix(g._tempMatrix3x3,i)}lengthSquared(){var e=this.elements[0],t=this.elements[1],r=this.elements[2],i=this.elements[3];return e*e+t*t+r*r+i*i}static invert(e,t){var i=e.elements,a=t.elements,n=e.lengthSquared();r.isZero(n)||(n=1/n,a[0]=-i[0]*n,a[1]=-i[1]*n,a[2]=-i[2]*n,a[3]=i[3]*n)}static rotationMatrix(e,t){var r,i,a=e.elements,n=a[0],s=a[1],o=a[2],l=a[3],_=a[4],h=a[5],c=a[6],d=a[7],u=a[8],f=t.elements,m=n+_+u;m>0?(r=Math.sqrt(m+1),f[3]=.5*r,r=.5/r,f[0]=(h-d)*r,f[1]=(c-o)*r,f[2]=(s-l)*r):n>=_&&n>=u?(i=.5/(r=Math.sqrt(1+n-_-u)),f[0]=.5*r,f[1]=(s+l)*i,f[2]=(o+c)*i,f[3]=(h-d)*i):_>u?(i=.5/(r=Math.sqrt(1+_-n-u)),f[0]=(l+s)*i,f[1]=.5*r,f[2]=(d+h)*i,f[3]=(c-o)*i):(i=.5/(r=Math.sqrt(1+u-n-_)),f[0]=(c+o)*i,f[1]=(d+h)*i,f[2]=.5*r,f[3]=(s-l)*i)}}g.TEMPVector30=new T,g.TEMPVector31=new T,g.TEMPVector32=new T,g.TEMPVector33=new T,g.TEMPMatrix0=new p,g.TEMPMatrix1=new p,g._tempMatrix3x3=new d,g.DEFAULT=new g,g.NAN=new g(NaN,NaN,NaN,NaN);class S{static READ_DATA(){S._DATA.offset=S._reader.getUint32(),S._DATA.size=S._reader.getUint32()}static READ_BLOCK(){for(var e=S._BLOCK.count=S._reader.getUint16(),t=S._BLOCK.blockStarts=[],r=S._BLOCK.blockLengths=[],i=0;i0&&(W.params=H=[]),r=0;r>-t-14,v._baseTable[256|e]=1024>>-t-14|32768,v._shiftTable[0|e]=-t-1,v._shiftTable[256|e]=-t-1):t<=15?(v._baseTable[0|e]=t+15<<10,v._baseTable[256|e]=t+15<<10|32768,v._shiftTable[0|e]=13,v._shiftTable[256|e]=13):t<128?(v._baseTable[0|e]=31744,v._baseTable[256|e]=64512,v._shiftTable[0|e]=24,v._shiftTable[256|e]=24):(v._baseTable[0|e]=31744,v._baseTable[256|e]=64512,v._shiftTable[0|e]=13,v._shiftTable[256|e]=13)}for(v._mantissaTable[0]=0,e=1;e<1024;++e){var r=e<<13;for(t=0;0==(8388608&r);)t-=8388608,r<<=1;r&=-8388609,t+=947912704,v._mantissaTable[e]=r|t}for(e=1024;e<2048;++e)v._mantissaTable[e]=939524096+(e-1024<<13);for(v._exponentTable[0]=0,e=1;e<31;++e)v._exponentTable[e]=e<<23;for(v._exponentTable[31]=1199570944,v._exponentTable[32]=2147483648,e=33;e<63;++e)v._exponentTable[e]=2147483648+(e-32<<23);for(v._exponentTable[63]=3347054592,v._offsetTable[0]=0,e=1;e<64;++e)v._offsetTable[e]=32===e?0:1024}static roundToFloat16Bits(e){v._floatView[0]=e;var t=v._uint32View[0],r=t>>23&511;return v._baseTable[r]+((8388607&t)>>v._shiftTable[r])}static convertToNumber(e){var t=e>>10;return v._uint32View[0]=v._mantissaTable[v._offsetTable[t]+(1023&e)]+v._exponentTable[t],v._floatView[0]}}v._buffer=new ArrayBuffer(4),v._floatView=new Float32Array(v._buffer),v._uint32View=new Uint32Array(v._buffer),v._baseTable=new Uint32Array(512),v._shiftTable=new Uint32Array(512),v._mantissaTable=new Uint32Array(2048),v._exponentTable=new Uint32Array(64),v._offsetTable=new Uint32Array(64);class R{static READ_DATA(){R._DATA.offset=R._reader.getUint32(),R._DATA.size=R._reader.getUint32()}static READ_BLOCK(){for(var e=R._BLOCK.count=R._reader.getUint16(),t=R._BLOCK.blockStarts=[],r=R._BLOCK.blockLengths=[],i=0;i0&&(k.params=W=[]),r=0;r=.64&&(s>1?o=0:o*=1-(s-.64)/.36),n[a]=Math.floor(255*o+.5)}static haloTexture(e,t,r,i,a,n){var s=(e-(r>>=1))/r,o=(t-(i>>=1))/i,l=s*s+o*o;l>1&&(l=1),n[a]=Math.floor(255*(1-l)+.5)}static _generateTexture2D(e,r,i,a){var n=0,s=0;switch(e.format){case t.TextureFormat.R8G8B8:s=3;break;case t.TextureFormat.R8G8B8A8:s=4;break;case t.TextureFormat.Alpha8:s=1;break;default:throw"GeneratedTexture._generateTexture: unkonw texture format."}for(var o=new Uint8Array(r*i*s),l=0;l=0?e.substr(t):null}static _createAffineTransformationArray(e,t,r,i){var a=t.x,n=t.y,s=t.z,o=t.w,l=a+a,_=n+n,h=s+s,c=a*l,d=a*_,u=a*h,f=n*_,m=n*h,E=s*h,T=o*l,p=o*_,g=o*h,S=r.x,v=r.y,R=r.z;i[0]=(1-(f+E))*S,i[1]=(d+g)*S,i[2]=(u-p)*S,i[3]=0,i[4]=(d-g)*v,i[5]=(1-(c+E))*v,i[6]=(m+T)*v,i[7]=0,i[8]=(u+p)*R,i[9]=(m-T)*R,i[10]=(1-(c+f))*R,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1}static _mulMatrixArray(e,t,r,i){var a,n,s,o,l,_=t.elements,h=_[0],c=_[1],d=_[2],u=_[3],f=_[4],m=_[5],E=_[6],T=_[7],p=_[8],g=_[9],S=_[10],v=_[11],R=_[12],I=_[13],x=_[14],A=_[15],D=i,M=i+4,L=i+8,C=i+12;for(a=0;a<4;a++)n=e[a],s=e[a+4],o=e[a+8],l=e[a+12],r[D+a]=n*h+s*c+o*d+l*u,r[M+a]=n*f+s*m+o*E+l*T,r[L+a]=n*p+s*g+o*S+l*v,r[C+a]=n*R+s*I+o*x+l*A}static arcTanAngle(e,t){return 0==e?1==t?Math.PI/2:-Math.PI/2:e>0?Math.atan(t/e):e<0?t>0?Math.atan(t/e)+Math.PI:Math.atan(t/e)-Math.PI:0}static angleTo(e,t,r){n.subtract(t,e,u.TEMPVector30),n.normalize(u.TEMPVector30,u.TEMPVector30),r.x=Math.asin(u.TEMPVector30.y),r.y=A.arcTanAngle(-u.TEMPVector30.z,-u.TEMPVector30.x)}static transformQuat(e,t,r){var i=t,a=e.x,n=e.y,s=e.z,o=i[0],l=i[1],_=i[2],h=i[3],c=h*a+l*s-_*n,d=h*n+_*a-o*s,u=h*s+o*n-l*a,f=-o*a-l*n-_*s;r.x=c*h+f*-o+d*-_-u*-l,r.y=d*h+f*-l+u*-o-c*-_,r.z=u*h+f*-_+c*-l-d*-o}static quaternionWeight(e,t,r){r.x=e.x*t,r.y=e.y*t,r.z=e.z*t,r.w=e.w}static quaternionConjugate(e,t){t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w}static scaleWeight(e,t,r){var i=e.x,a=e.y,n=e.z;r.x=i>0?Math.pow(Math.abs(i),t):-Math.pow(Math.abs(i),t),r.y=a>0?Math.pow(Math.abs(a),t):-Math.pow(Math.abs(a),t),r.z=n>0?Math.pow(Math.abs(n),t):-Math.pow(Math.abs(n),t)}static scaleBlend(e,t,r,i){var a=A._tempVector3_0,n=A._tempVector3_1;A.scaleWeight(e,1-r,a),A.scaleWeight(t,r,n);var s=r>.5?t:e;i.x=s.x>0?Math.abs(a.x*n.x):-Math.abs(a.x*n.x),i.y=s.y>0?Math.abs(a.y*n.y):-Math.abs(a.y*n.y),i.z=s.z>0?Math.abs(a.z*n.z):-Math.abs(a.z*n.z)}static matrix4x4MultiplyFFF(e,t,r){var i,a,n,s,o;if(r===t)for(t=new Float32Array(16),i=0;i<16;++i)t[i]=r[i];var l=t[0],_=t[1],h=t[2],c=t[3],d=t[4],u=t[5],f=t[6],m=t[7],E=t[8],T=t[9],p=t[10],g=t[11],S=t[12],v=t[13],R=t[14],I=t[15];for(i=0;i<4;i++)a=e[i],n=e[i+4],s=e[i+8],o=e[i+12],r[i]=a*l+n*_+s*h+o*c,r[i+4]=a*d+n*u+s*f+o*m,r[i+8]=a*E+n*T+s*p+o*g,r[i+12]=a*S+n*v+s*R+o*I}static matrix4x4MultiplyFFFForNative(e,r,i){t.LayaGL.instance.matrix4x4Multiply(e,r,i)}static matrix4x4MultiplyMFM(e,t,r){A.matrix4x4MultiplyFFF(e.elements,t,r.elements)}static _buildTexture2D(e,r,i,a,n=!1){var s=new t.Texture2D(e,r,i,n,!0);return s.anisoLevel=1,s.filterMode=t.BaseTexture.FILTERMODE_POINT,x._generateTexture2D(s,e,r,a),s}static _drawBound(e,t,r){e.lineCount+12>e.maxLineCount&&(e.maxLineCount+=12);var i=A._tempVector3_0,a=A._tempVector3_1,n=t.min,s=t.max;i.setValue(n.x,n.y,n.z),a.setValue(s.x,n.y,n.z),e.addLine(i,a,r,r),i.setValue(n.x,n.y,n.z),a.setValue(n.x,n.y,s.z),e.addLine(i,a,r,r),i.setValue(s.x,n.y,n.z),a.setValue(s.x,n.y,s.z),e.addLine(i,a,r,r),i.setValue(n.x,n.y,s.z),a.setValue(s.x,n.y,s.z),e.addLine(i,a,r,r),i.setValue(n.x,n.y,n.z),a.setValue(n.x,s.y,n.z),e.addLine(i,a,r,r),i.setValue(n.x,n.y,s.z),a.setValue(n.x,s.y,s.z),e.addLine(i,a,r,r),i.setValue(s.x,n.y,n.z),a.setValue(s.x,s.y,n.z),e.addLine(i,a,r,r),i.setValue(s.x,n.y,s.z),a.setValue(s.x,s.y,s.z),e.addLine(i,a,r,r),i.setValue(n.x,s.y,n.z),a.setValue(s.x,s.y,n.z),e.addLine(i,a,r,r),i.setValue(n.x,s.y,n.z),a.setValue(n.x,s.y,s.z),e.addLine(i,a,r,r),i.setValue(s.x,s.y,n.z),a.setValue(s.x,s.y,s.z),e.addLine(i,a,r,r),i.setValue(n.x,s.y,s.z),a.setValue(s.x,s.y,s.z),e.addLine(i,a,r,r)}static _getHierarchyPath(e,t,r){r.length=0;for(var i=t;i!==e;){var a=i._parent;if(!a)return null;r.push(a.getChildIndex(i)),i=a}return r}static _getNodeByHierarchyPath(e,t){for(var r=e,i=t.length-1;i>=0;i--)r=r.getChildAt(t[i]);return r}}A._tempVector3_0=new n,A._tempVector3_1=new n,A._tempArray16_0=new Float32Array(16),A._tempArray16_1=new Float32Array(16),A._tempArray16_2=new Float32Array(16),A._tempArray16_3=new Float32Array(16),A._compIdToNode=new Object;class D extends t.Resource{constructor(){super(),this._nodes=new I,this._animationEvents=[]}static _parse(e,r=null,i=null){var a=new D,n=new t.Byte(e),s=n.readUTFString();switch(s){case"LAYAANIMATION:03":S.parse(a,n);break;case"LAYAANIMATION:04":case"LAYAANIMATION:COMPRESSION_04":R.parse(a,n,s);break;default:throw"unknown animationClip version."}return a}static load(e,r){t.ILaya.loader.create(e,r,null,D.ANIMATIONCLIP)}duration(){return this._duration}_hermiteInterpolate(e,t,r,i){var a=e.outTangent,n=t.inTangent;if(Number.isFinite(a)&&Number.isFinite(n)){var s=r*r,o=s*r,l=o-2*s+r,_=o-s,h=-2*o+3*s;return(2*o-3*s+1)*e.value+l*a*i+_*n*i+h*t.value}return e.value}_hermiteInterpolateVector3(e,t,r,i,a){var n=e.value,s=e.outTangent,o=t.value,l=t.inTangent,_=r*r,h=_*r,c=2*h-3*_+1,d=h-2*_+r,u=h-_,f=-2*h+3*_,m=s.x,E=l.x;Number.isFinite(m)&&Number.isFinite(E)?a.x=c*n.x+d*m*i+u*E*i+f*o.x:a.x=n.x,m=s.y,E=l.y,Number.isFinite(m)&&Number.isFinite(E)?a.y=c*n.y+d*m*i+u*E*i+f*o.y:a.y=n.y,m=s.z,E=l.z,Number.isFinite(m)&&Number.isFinite(E)?a.z=c*n.z+d*m*i+u*E*i+f*o.z:a.z=n.z}_hermiteInterpolateQuaternion(e,t,r,i,a){var n=e.value,s=e.outTangent,o=t.value,l=t.inTangent,_=r*r,h=_*r,c=2*h-3*_+1,d=h-2*_+r,u=h-_,f=-2*h+3*_,m=s.x,E=l.x;Number.isFinite(m)&&Number.isFinite(E)?a.x=c*n.x+d*m*i+u*E*i+f*o.x:a.x=n.x,m=s.y,E=l.y,Number.isFinite(m)&&Number.isFinite(E)?a.y=c*n.y+d*m*i+u*E*i+f*o.y:a.y=n.y,m=s.z,E=l.z,Number.isFinite(m)&&Number.isFinite(E)?a.z=c*n.z+d*m*i+u*E*i+f*o.z:a.z=n.z,m=s.w,E=l.w,Number.isFinite(m)&&Number.isFinite(E)?a.w=c*n.w+d*m*i+u*E*i+f*o.w:a.w=n.w}_evaluateClipDatasRealTime(e,t,r,i,a){for(var n=0,s=e.count;nt);)d++,o++,r[n]=d;else for((o=d+1)!==c&&t>h[o].time&&(d=c-1,r[n]=d),o=d+1;d>-1&&!(h[d].timee?i=t-1:r=t+1}return r}addEvent(e){var t=this._binarySearchEventIndex(e.time);this._animationEvents.splice(t,0,e)}_disposeResource(){this._nodes=null,this._nodesMap=null}}D.ANIMATIONCLIP="ANIMATIONCLIP",D._tempQuaternion0=new u;class M{get normalizedTime(){return this._normalizedTime}get duration(){return this._duration}constructor(){}_resetPlayState(e){this._finish=!1,this._startPlayTime=e,this._elapsedTime=e,this._playEventIndex=0,this._lastIsFront=!0}_cloneTo(e){e._finish=this._finish,e._startPlayTime=this._startPlayTime,e._elapsedTime=this._elapsedTime,e._playEventIndex=this._playEventIndex,e._lastIsFront=this._lastIsFront}}class L{constructor(e){this._defaultState=null,this._referenceCount=0,this._statesMap={},this.playOnWake=!0,this._playType=-1,this._crossMark=0,this._crossDuration=-1,this._crossNodesOwnersIndicesMap={},this._crossNodesOwnersCount=0,this._crossNodesOwners=[],this._currentPlayState=null,this._states=[],this._playStateInfo=new M,this._crossPlayStateInfo=new M,this._srcCrossClipNodeIndices=[],this._destCrossClipNodeIndices=[],this.name=e,this.defaultWeight=1,this.blendingMode=L.BLENDINGMODE_OVERRIDE}get defaultState(){return this._defaultState}set defaultState(e){this._defaultState=e,this._statesMap[e.name]=e}_removeClip(e,t,r,i){var a=i._clip,n=e[r];if(e.splice(r,1),delete t[i.name],this._animator){var s=a._nodes,o=n._nodeOwners;a._removeReference();for(var l=0,_=s.count;l<_;l++)this._animator._removeKeyframeNodeOwner(o,s.getNodeByIndex(l))}}_getReferenceCount(){return this._referenceCount}_addReference(e=1){for(var t=0,r=this._states.length;t0&&this._clip._removeReference(this._referenceCount),e&&(this._currentFrameIndices=new Int16Array(e._nodes.count),this._resetFrameIndices(),this._referenceCount>0&&this._clip._addReference(this._referenceCount)),this._clip=e)}_getReferenceCount(){return this._referenceCount}_addReference(e=1){this._clip&&this._clip._addReference(e),this._referenceCount+=e}_removeReference(e=1){this._clip&&this._clip._removeReference(e),this._referenceCount-=e}_clearReference(){this._removeReference(-this._referenceCount)}_resetFrameIndices(){for(var e=0,t=this._currentFrameIndices.length;e=a){if(t._finish=!0,t._elapsedTime=a,t._normalizedPlayTime=1,_)for(var h=0,c=_.length;h=0&&(s=t[r]).time>=i;r--)for(o=0,l=e.length;o=t._lastElapsedTime;if(t._lastIsFront!==_&&(_?t._playEventIndex++:t._playEventIndex--,t._lastIsFront=_),0==l)t._playEventIndex=this._eventScript(r,a,t._playEventIndex,o,_);else if(_){this._eventScript(r,a,t._playEventIndex,n,!0);for(var h=0,c=l-1;hr._lastElapsedTime;a._evaluateClipDatasRealTime(a._nodes,s,o,t,l)}_applyFloat(e,t,r,i,a,n,s){if(r.updateMark===this._updateMark)if(i)e[t]+=a*s;else{var o=e[t];e[t]=o+a*(s-o)}else if(n)e[t]=i?r.defaultValue+s:s;else if(i)e[t]=r.defaultValue+a*s;else{var l=r.defaultValue;e[t]=l+a*(s-l)}}_applyPositionAndRotationEuler(e,t,r,i,a,n){if(e.updateMark===this._updateMark)if(t)n.x+=r*a.x,n.y+=r*a.y,n.z+=r*a.z;else{var s=n.x,o=n.y,l=n.z;n.x=s+r*(a.x-s),n.y=o+r*(a.y-o),n.z=l+r*(a.z-l)}else if(i)if(t){var _=e.defaultValue;n.x=_.x+a.x,n.y=_.y+a.y,n.z=_.z+a.z}else n.x=a.x,n.y=a.y,n.z=a.z;else if(_=e.defaultValue,t)n.x=_.x+r*a.x,n.y=_.y+r*a.y,n.z=_.z+r*a.z;else{var h=_.x,c=_.y,d=_.z;n.x=h+r*(a.x-h),n.y=c+r*(a.y-c),n.z=d+r*(a.z-d)}}_applyRotation(e,t,r,i,a,n){if(e.updateMark===this._updateMark)if(t){var s=O._tempQuaternion1;A.quaternionWeight(a,r,s),s.normalize(s),u.multiply(n,s,n)}else u.lerp(n,a,r,n);else if(i)if(t){var o=e.defaultValue;u.multiply(o,a,n)}else n.x=a.x,n.y=a.y,n.z=a.z,n.w=a.w;else o=e.defaultValue,t?(s=O._tempQuaternion1,A.quaternionWeight(a,r,s),s.normalize(s),u.multiply(o,s,n)):u.lerp(o,a,r,n)}_applyScale(e,t,r,i,a,n){if(e.updateMark===this._updateMark)if(t){var s=O._tempVector31;A.scaleWeight(a,r,s),n.x=n.x*s.x,n.y=n.y*s.y,n.z=n.z*s.z}else A.scaleBlend(n,a,r,n);else if(i)if(t){var o=e.defaultValue;n.x=o.x*a.x,n.y=o.y*a.y,n.z=o.z*a.z}else n.x=a.x,n.y=a.y,n.z=a.z;else o=e.defaultValue,t?(s=O._tempVector31,A.scaleWeight(a,r,s),n.x=o.x*s.x,n.y=o.y*s.y,n.z=o.z*s.z):A.scaleBlend(o,a,r,n)}_applyCrossData(e,t,r,i,a,n,s){var o=e.propertyOwner;if(o){switch(e.type){case 0:for(var l=e.property,_=l.length-1,h=0;h<_&&(o=o[l[h]]);h++);var c=a+s*(n-a);this._applyFloat(o,l[_],e,t,r,i,c);break;case 1:var d=o.localPosition,f=O._tempVector30,m=a.x,E=a.y,T=a.z;f.x=m+s*(n.x-m),f.y=E+s*(n.y-E),f.z=T+s*(n.z-T),this._applyPositionAndRotationEuler(e,t,r,i,f,d),o.localPosition=d;break;case 2:var p=o.localRotation,g=O._tempQuaternion0;u.lerp(a,n,s,g),this._applyRotation(e,t,r,i,g,p),o.localRotation=p;break;case 3:var S=o.localScale,v=O._tempVector30;A.scaleBlend(a,n,s,v),this._applyScale(e,t,r,i,v,S),o.localScale=S;break;case 4:var R=o.localRotationEuler,I=O._tempVector30;m=a.x,E=a.y,T=a.z,I.x=m+s*(n.x-m),I.y=E+s*(n.y-E),I.z=T+s*(n.z-T),this._applyPositionAndRotationEuler(e,t,r,i,I,R),o.localRotationEuler=R}e.updateMark=this._updateMark}}_setClipDatasToNode(e,t,r,i){for(var a=e._clip._nodes,n=e._nodeOwners,s=0,o=a.count;sg?g/T:1,v=this._speed*m.speed;this._updatePlayer(m,_,r*S*v,E.islooping);var R=(_._elapsedTime-p)/S/T;R>=1?i&&(this._updateClipDatas(m,f,_,s*v),this._setClipDatasToNode(m,f,o.defaultWeight,0===a),o._playType=0,o._currentPlayState=m,_._cloneTo(l)):(l._finish||(d=this._speed*h.speed,this._updatePlayer(h,l,r*d,c.islooping)),i&&(this._updateClipDatas(h,f,l,s*d),this._updateClipDatas(m,f,_,s*S*v),this._setCrossClipDatasToNode(o,h,m,R,0===a))),i&&(this._updateEventScript(h,l),this._updateEventScript(m,_));break;case 2:E=(m=o._crossPlayState)._clip,T=o._crossDuration,p=_._startPlayTime,S=T>(g=E._duration-p)?g/T:1,v=this._speed*m.speed,this._updatePlayer(m,_,r*S*v,E.islooping),i&&((R=(_._elapsedTime-p)/S/T)>=1?(this._updateClipDatas(m,f,_,s*v),this._setClipDatasToNode(m,f,1,0===a),o._playType=0,o._currentPlayState=m,_._cloneTo(l)):(this._updateClipDatas(m,f,_,s*S*v),this._setFixedCrossClipDatasToNode(o,m,R,0===a)),this._updateEventScript(m,_))}}i&&this._avatar&&(t.Render.supportWebGLPlusAnimation&&this._updateAnimationNodeWorldMatix(this._animationNodeLocalPositions,this._animationNodeLocalRotations,this._animationNodeLocalScales,this._animationNodeWorldMatrixs,this._animationNodeParentIndices),this._updateAvatarNodesToSprite())}}_cloneTo(e){var t=e;t.avatar=this.avatar,t.cullingMode=this.cullingMode;for(var r=0,i=this._controllerLayers.length;r=0;i--){var a=r[i]&t[i];0==a&&i==this._length-1?this._length--:r[i]=a}}add(e){var t=e._index,r=t+1,i=this._mask,a=i.length;if(athis._length?(i[t]=e._value,this._length=r):i[t]|=e._value}remove(e){var t=e._index,r=this._mask,i=this._length-1;if(!(t>i)){var a=r[t]&~e._value;t==i&&0===a?this._length--:r[t]=a}}addDefineDatas(e){var t=e._mask,r=e._length,i=this._mask,a=i.length;if(a=0;a--)if(!(a>i)){var n=r[a]&~t[a];a==i&&0===n?(i--,this._length--):r[a]=n}}has(e){var t=e._index;return!(t>=this._length)&&0!=(this._mask[t]&e._value)}clear(){this._length=0}cloneTo(e){var t=e,r=t._mask,i=this._mask,a=this._length;r.length=a;for(var n=0;n0&&_>o)break;o&_&&t.push(s[_])}}static getDefineByName(e){var t=F._defineMap[e];if(!t){var r=F._maskMap,i=F._defineCounter,a=Math.floor(i/32),n=1<0&&(r&&r._removeReference(),t&&t._addReference())}getTexture(e){return this._data[e]}setAttribute(e,t){this._data[e]=t}getAttribute(e){return this._data[e]}getLength(){return this._data.length}setLength(e){this._data.length=e}cloneTo(e){var r=e,s=r._data;for(var o in this._data){var l=this._data[o];if(null!=l)if("number"==typeof l)s[o]=l;else if("number"==typeof l)s[o]=l;else if("boolean"==typeof l)s[o]=l;else if(l instanceof i){var _=s[o]||(s[o]=new i);l.cloneTo(_),s[o]=_}else if(l instanceof n){var h=s[o]||(s[o]=new n);l.cloneTo(h),s[o]=h}else if(l instanceof a){var c=s[o]||(s[o]=new a);l.cloneTo(c),s[o]=c}else if(l instanceof p){var d=s[o]||(s[o]=new p);l.cloneTo(d),s[o]=d}else l instanceof t.BaseTexture&&(s[o]=l)}this._defineDatas.cloneTo(r._defineDatas)}clone(){var e=new B;return this.cloneTo(e),e}cloneToForNative(e){var r=e;this._int32Data.length-r._int32Data.length>0&&r.needRenewArrayBufferForNative(this._int32Data.length),r._int32Data.set(this._int32Data,0);var s=r._nativeArray,o=this._nativeArray.length;s.length=o;for(var l=0;l=this._int32Data.length){var r=4*(e+1),i=this._int32Data,a=this._data.conchRef,n=this._data._ptrID;this._data=new ArrayBuffer(r),this._int32Data=new Int32Array(this._data),this._float32Data=new Float32Array(this._data),this._data.conchRef=a,this._data._ptrID=n,i&&this._int32Data.set(i,0);var s=t.LayaGL.instance;s.updateArrayBufferRef?s.updateArrayBufferRef(this._data._ptrID,a.isSyncToRender(),this._data):window.conch.updateArrayBufferRef(this._data._ptrID,a.isSyncToRender(),this._data)}}getDataForNative(){return this._nativeArray}getIntForNative(e){return this._int32Data[e]}setIntForNative(e,t){this.needRenewArrayBufferForNative(e),this._int32Data[e]=t,this._nativeArray[e]=t}getBoolForNative(e){return 1==this._int32Data[e]}setBoolForNative(e,t){this.needRenewArrayBufferForNative(e),this._int32Data[e]=t?1:0,this._nativeArray[e]=t}getNumberForNative(e){return this._float32Data[e]}setNumberForNative(e,t){this.needRenewArrayBufferForNative(e),this._float32Data[e]=t,this._nativeArray[e]=t}getMatrix4x4ForNative(e){return this._nativeArray[e]}setMatrix4x4ForNative(e,t){this.needRenewArrayBufferForNative(e),this._nativeArray[e]=t;var r=this.setReferenceForNative(t.elements);this._int32Data[e]=r}getVectorForNative(e){return this._nativeArray[e]}setVectorForNative(e,t){this.needRenewArrayBufferForNative(e),this._nativeArray[e]=t,t.elements||t.forNativeElement();var r=this.setReferenceForNative(t.elements);this._int32Data[e]=r}getVector2ForNative(e){return this._nativeArray[e]}setVector2ForNative(e,t){this.needRenewArrayBufferForNative(e),this._nativeArray[e]=t,t.elements||t.forNativeElement();var r=this.setReferenceForNative(t.elements);this._int32Data[e]=r}getVector3ForNative(e){return this._nativeArray[e]}setVector3ForNative(e,t){this.needRenewArrayBufferForNative(e),this._nativeArray[e]=t,t.elements||t.forNativeElement();var r=this.setReferenceForNative(t.elements);this._int32Data[e]=r}getQuaternionForNative(e){return this._nativeArray[e]}setQuaternionForNative(e,t){this.needRenewArrayBufferForNative(e),this._nativeArray[e]=t,t.elements||t.forNativeElement();var r=this.setReferenceForNative(t.elements);this._int32Data[e]=r}getBufferForNative(e){return this._nativeArray[e]}setBufferForNative(e,t){this.needRenewArrayBufferForNative(e),this._nativeArray[e]=t;var r=this.setReferenceForNative(t);this._int32Data[e]=r}getAttributeForNative(e){return this._nativeArray[e]}setAttributeForNative(e,r){this._nativeArray[e]=r,r._ptrID||t.LayaGL.instance.createArrayBufferRef(r,t.LayaGL.ARRAY_BUFFER_TYPE_DATA,!0),t.LayaGL.instance.syncBufferToRenderThread(r),this._int32Data[e]=r._ptrID}getTextureForNative(e){return this._nativeArray[e]}setTextureForNative(e,t){if(t){this.needRenewArrayBufferForNative(e);var r=this._nativeArray[e];this._nativeArray[e]=t;var i=t._getSource()||t.defaulteTexture._getSource();this._int32Data[e]=i.id,this._ownerResource&&this._ownerResource.referenceCount>0&&(r&&r._removeReference(),t&&t._addReference())}}setReferenceForNative(e){this.clearRuntimeCopyArray();var r=0,i=0;return B._SET_RUNTIME_VALUE_MODE_REFERENCE_?(t.LayaGL.instance.createArrayBufferRefs(e,t.LayaGL.ARRAY_BUFFER_TYPE_DATA,!0,t.LayaGL.ARRAY_BUFFER_REF_REFERENCE),r=0,i=e.getPtrID(r)):(t.LayaGL.instance.createArrayBufferRefs(e,t.LayaGL.ARRAY_BUFFER_TYPE_DATA,!0,t.LayaGL.ARRAY_BUFFER_REF_COPY),r=e.getRefNum()-1,i=e.getPtrID(r),this._runtimeCopyValues.push({obj:e,refID:r,ptrID:i})),t.LayaGL.instance.syncBufferToRenderThread(e,r),i}static setRuntimeValueMode(e){B._SET_RUNTIME_VALUE_MODE_REFERENCE_=e}clearRuntimeCopyArray(){var e=t.Stat.loopCount;if(this._frameCount!=e){this._frameCount=e;for(var r=0,i=this._runtimeCopyValues.length;r0&&this._removeTetxureReference(),this._shaderValues=null}setShaderName(e){if(this._shader=F.find(e),!this._shader)throw new Error("BaseMaterial: unknown shader name.")}cloneTo(e){var t=e;t.name=this.name,t.renderQueue=this.renderQueue,this._disablePublicDefineDatas.cloneTo(t._disablePublicDefineDatas),this._shaderValues.cloneTo(t._shaderValues)}clone(){var e=new W;return this.cloneTo(e),e}get _defineDatas(){return this._shaderValues._defineDatas}}W.MATERIAL="MATERIAL",W.RENDERQUEUE_OPAQUE=2e3,W.RENDERQUEUE_ALPHATEST=2450,W.RENDERQUEUE_TRANSPARENT=3e3,W.ALPHATESTVALUE=F.propertyNameToID("u_AlphaTestValue"),W.SHADERDEFINE_ALPHATEST=null;class k{}class X{constructor(){this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.srcBlend=X.BLENDPARAM_ONE,this.dstBlend=X.BLENDPARAM_ZERO,this.srcBlendRGB=X.BLENDPARAM_ONE,this.dstBlendRGB=X.BLENDPARAM_ZERO,this.srcBlendAlpha=X.BLENDPARAM_ONE,this.dstBlendAlpha=X.BLENDPARAM_ZERO,this.blendConstColor=new a(1,1,1,1),this.blendEquation=X.BLENDEQUATION_ADD,this.blendEquationRGB=X.BLENDEQUATION_ADD,this.blendEquationAlpha=X.BLENDEQUATION_ADD,this.depthTest=X.DEPTHTEST_LEQUAL,this.depthWrite=!0}cloneTo(e){var t=e;t.cull=this.cull,t.blend=this.blend,t.srcBlend=this.srcBlend,t.dstBlend=this.dstBlend,t.srcBlendRGB=this.srcBlendRGB,t.dstBlendRGB=this.dstBlendRGB,t.srcBlendAlpha=this.srcBlendAlpha,t.dstBlendAlpha=this.dstBlendAlpha,this.blendConstColor.cloneTo(t.blendConstColor),t.blendEquation=this.blendEquation,t.blendEquationRGB=this.blendEquationRGB,t.blendEquationAlpha=this.blendEquationAlpha,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite}clone(){var e=new X;return this.cloneTo(e),e}}X.CULL_NONE=0,X.CULL_FRONT=1,X.CULL_BACK=2,X.BLEND_DISABLE=0,X.BLEND_ENABLE_ALL=1,X.BLEND_ENABLE_SEPERATE=2,X.BLENDPARAM_ZERO=0,X.BLENDPARAM_ONE=1,X.BLENDPARAM_SRC_COLOR=768,X.BLENDPARAM_ONE_MINUS_SRC_COLOR=769,X.BLENDPARAM_DST_COLOR=774,X.BLENDPARAM_ONE_MINUS_DST_COLOR=775,X.BLENDPARAM_SRC_ALPHA=770,X.BLENDPARAM_ONE_MINUS_SRC_ALPHA=771,X.BLENDPARAM_DST_ALPHA=772,X.BLENDPARAM_ONE_MINUS_DST_ALPHA=773,X.BLENDPARAM_SRC_ALPHA_SATURATE=776,X.BLENDEQUATION_ADD=32774,X.BLENDEQUATION_SUBTRACT=32778,X.BLENDEQUATION_REVERSE_SUBTRACT=32779,X.DEPTHTEST_OFF=0,X.DEPTHTEST_NEVER=512,X.DEPTHTEST_LESS=513,X.DEPTHTEST_EQUAL=514,X.DEPTHTEST_LEQUAL=515,X.DEPTHTEST_GREATER=516,X.DEPTHTEST_NOTEQUAL=517,X.DEPTHTEST_GEQUAL=518,X.DEPTHTEST_ALWAYS=519;class Y extends W{constructor(){super(),this._enableVertexColor=!1,this.setShaderName("BLINNPHONG"),this._albedoIntensity=1,this._albedoColor=new a(1,1,1,1);var e=this._shaderValues;e.setVector(Y.ALBEDOCOLOR,new a(1,1,1,1)),e.setVector(Y.MATERIALSPECULAR,new a(1,1,1,1)),e.setNumber(Y.SHININESS,.078125),e.setNumber(W.ALPHATESTVALUE,.5),e.setVector(Y.TILINGOFFSET,new a(1,1,0,0)),this._enableLighting=!0,this.renderMode=Y.RENDERMODE_OPAQUE}static __initDefine__(){Y.SHADERDEFINE_DIFFUSEMAP=F.getDefineByName("DIFFUSEMAP"),Y.SHADERDEFINE_NORMALMAP=F.getDefineByName("NORMALMAP"),Y.SHADERDEFINE_SPECULARMAP=F.getDefineByName("SPECULARMAP"),Y.SHADERDEFINE_TILINGOFFSET=F.getDefineByName("TILINGOFFSET"),Y.SHADERDEFINE_ENABLEVERTEXCOLOR=F.getDefineByName("ENABLEVERTEXCOLOR")}get _ColorR(){return this._albedoColor.x}set _ColorR(e){this._albedoColor.x=e,this.albedoColor=this._albedoColor}get _ColorG(){return this._albedoColor.y}set _ColorG(e){this._albedoColor.y=e,this.albedoColor=this._albedoColor}get _ColorB(){return this._albedoColor.z}set _ColorB(e){this._albedoColor.z=e,this.albedoColor=this._albedoColor}get _ColorA(){return this._albedoColor.w}set _ColorA(e){this._albedoColor.w=e,this.albedoColor=this._albedoColor}get _SpecColorR(){return this._shaderValues.getVector(Y.MATERIALSPECULAR).x}set _SpecColorR(e){this._shaderValues.getVector(Y.MATERIALSPECULAR).x=e}get _SpecColorG(){return this._shaderValues.getVector(Y.MATERIALSPECULAR).y}set _SpecColorG(e){this._shaderValues.getVector(Y.MATERIALSPECULAR).y=e}get _SpecColorB(){return this._shaderValues.getVector(Y.MATERIALSPECULAR).z}set _SpecColorB(e){this._shaderValues.getVector(Y.MATERIALSPECULAR).z=e}get _SpecColorA(){return this._shaderValues.getVector(Y.MATERIALSPECULAR).w}set _SpecColorA(e){this._shaderValues.getVector(Y.MATERIALSPECULAR).w=e}get _AlbedoIntensity(){return this._albedoIntensity}set _AlbedoIntensity(e){if(this._albedoIntensity!==e){var t=this._shaderValues.getVector(Y.ALBEDOCOLOR);a.scale(this._albedoColor,e,t),this._albedoIntensity=e,this._shaderValues.setVector(Y.ALBEDOCOLOR,t)}}get _Shininess(){return this._shaderValues.getNumber(Y.SHININESS)}set _Shininess(e){e=Math.max(0,Math.min(1,e)),this._shaderValues.setNumber(Y.SHININESS,e)}get _MainTex_STX(){return this._shaderValues.getVector(Y.TILINGOFFSET).x}set _MainTex_STX(e){var t=this._shaderValues.getVector(Y.TILINGOFFSET);t.x=e,this.tilingOffset=t}get _MainTex_STY(){return this._shaderValues.getVector(Y.TILINGOFFSET).y}set _MainTex_STY(e){var t=this._shaderValues.getVector(Y.TILINGOFFSET);t.y=e,this.tilingOffset=t}get _MainTex_STZ(){return this._shaderValues.getVector(Y.TILINGOFFSET).z}set _MainTex_STZ(e){var t=this._shaderValues.getVector(Y.TILINGOFFSET);t.z=e,this.tilingOffset=t}get _MainTex_STW(){return this._shaderValues.getVector(Y.TILINGOFFSET).w}set _MainTex_STW(e){var t=this._shaderValues.getVector(Y.TILINGOFFSET);t.w=e,this.tilingOffset=t}get _Cutoff(){return this.alphaTestValue}set _Cutoff(e){this.alphaTestValue=e}set renderMode(e){switch(e){case Y.RENDERMODE_OPAQUE:this.alphaTest=!1,this.renderQueue=W.RENDERQUEUE_OPAQUE,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS;break;case Y.RENDERMODE_CUTOUT:this.renderQueue=W.RENDERQUEUE_ALPHATEST,this.alphaTest=!0,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS;break;case Y.RENDERMODE_TRANSPARENT:this.renderQueue=W.RENDERQUEUE_TRANSPARENT,this.alphaTest=!1,this.depthWrite=!1,this.cull=X.CULL_BACK,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_SRC_ALPHA,this.blendDst=X.BLENDPARAM_ONE_MINUS_SRC_ALPHA,this.depthTest=X.DEPTHTEST_LESS;break;default:throw new Error("Material:renderMode value error.")}}get enableVertexColor(){return this._enableVertexColor}set enableVertexColor(e){this._enableVertexColor=e,e?this._shaderValues.addDefine(Y.SHADERDEFINE_ENABLEVERTEXCOLOR):this._shaderValues.removeDefine(Y.SHADERDEFINE_ENABLEVERTEXCOLOR)}get tilingOffsetX(){return this._MainTex_STX}set tilingOffsetX(e){this._MainTex_STX=e}get tilingOffsetY(){return this._MainTex_STY}set tilingOffsetY(e){this._MainTex_STY=e}get tilingOffsetZ(){return this._MainTex_STZ}set tilingOffsetZ(e){this._MainTex_STZ=e}get tilingOffsetW(){return this._MainTex_STW}set tilingOffsetW(e){this._MainTex_STW=e}get tilingOffset(){return this._shaderValues.getVector(Y.TILINGOFFSET)}set tilingOffset(e){e&&(1!=e.x||1!=e.y||0!=e.z||0!=e.w)?this._shaderValues.addDefine(Y.SHADERDEFINE_TILINGOFFSET):this._shaderValues.removeDefine(Y.SHADERDEFINE_TILINGOFFSET),this._shaderValues.setVector(Y.TILINGOFFSET,e)}get albedoColorR(){return this._ColorR}set albedoColorR(e){this._ColorR=e}get albedoColorG(){return this._ColorG}set albedoColorG(e){this._ColorG=e}get albedoColorB(){return this._ColorB}set albedoColorB(e){this._ColorB=e}get albedoColorA(){return this._ColorA}set albedoColorA(e){this._ColorA=e}get albedoColor(){return this._albedoColor}set albedoColor(e){var t=this._shaderValues.getVector(Y.ALBEDOCOLOR);a.scale(e,this._albedoIntensity,t),this._albedoColor=e,this._shaderValues.setVector(Y.ALBEDOCOLOR,t)}get albedoIntensity(){return this._albedoIntensity}set albedoIntensity(e){this._AlbedoIntensity=e}get specularColorR(){return this._SpecColorR}set specularColorR(e){this._SpecColorR=e}get specularColorG(){return this._SpecColorG}set specularColorG(e){this._SpecColorG=e}get specularColorB(){return this._SpecColorB}set specularColorB(e){this._SpecColorB=e}get specularColorA(){return this._SpecColorA}set specularColorA(e){this._SpecColorA=e}get specularColor(){return this._shaderValues.getVector(Y.MATERIALSPECULAR)}set specularColor(e){this._shaderValues.setVector(Y.MATERIALSPECULAR,e)}get shininess(){return this._Shininess}set shininess(e){this._Shininess=e}get albedoTexture(){return this._shaderValues.getTexture(Y.ALBEDOTEXTURE)}set albedoTexture(e){e?this._shaderValues.addDefine(Y.SHADERDEFINE_DIFFUSEMAP):this._shaderValues.removeDefine(Y.SHADERDEFINE_DIFFUSEMAP),this._shaderValues.setTexture(Y.ALBEDOTEXTURE,e)}get normalTexture(){return this._shaderValues.getTexture(Y.NORMALTEXTURE)}set normalTexture(e){e?this._shaderValues.addDefine(Y.SHADERDEFINE_NORMALMAP):this._shaderValues.removeDefine(Y.SHADERDEFINE_NORMALMAP),this._shaderValues.setTexture(Y.NORMALTEXTURE,e)}get specularTexture(){return this._shaderValues.getTexture(Y.SPECULARTEXTURE)}set specularTexture(e){e?this._shaderValues.addDefine(Y.SHADERDEFINE_SPECULARMAP):this._shaderValues.removeDefine(Y.SHADERDEFINE_SPECULARMAP),this._shaderValues.setTexture(Y.SPECULARTEXTURE,e)}get enableLighting(){return this._enableLighting}set enableLighting(e){this._enableLighting!==e&&(e?(this._disablePublicDefineDatas.remove(k.SHADERDEFINE_POINTLIGHT),this._disablePublicDefineDatas.remove(k.SHADERDEFINE_SPOTLIGHT),this._disablePublicDefineDatas.remove(k.SHADERDEFINE_DIRECTIONLIGHT)):(this._disablePublicDefineDatas.add(k.SHADERDEFINE_POINTLIGHT),this._disablePublicDefineDatas.add(k.SHADERDEFINE_SPOTLIGHT),this._disablePublicDefineDatas.add(k.SHADERDEFINE_DIRECTIONLIGHT)),this._enableLighting=e)}get depthWrite(){return this._shaderValues.getBool(Y.DEPTH_WRITE)}set depthWrite(e){this._shaderValues.setBool(Y.DEPTH_WRITE,e)}get cull(){return this._shaderValues.getInt(Y.CULL)}set cull(e){this._shaderValues.setInt(Y.CULL,e)}get blend(){return this._shaderValues.getInt(Y.BLEND)}set blend(e){this._shaderValues.setInt(Y.BLEND,e)}get blendSrc(){return this._shaderValues.getInt(Y.BLEND_SRC)}set blendSrc(e){this._shaderValues.setInt(Y.BLEND_SRC,e)}get blendDst(){return this._shaderValues.getInt(Y.BLEND_DST)}set blendDst(e){this._shaderValues.setInt(Y.BLEND_DST,e)}get depthTest(){return this._shaderValues.getInt(Y.DEPTH_TEST)}set depthTest(e){this._shaderValues.setInt(Y.DEPTH_TEST,e)}clone(){var e=new Y;return this.cloneTo(e),e}cloneTo(e){super.cloneTo(e);var t=e;t._enableLighting=this._enableLighting,t._albedoIntensity=this._albedoIntensity,t._enableVertexColor=this._enableVertexColor,this._albedoColor.cloneTo(t._albedoColor)}}Y.RENDERMODE_OPAQUE=0,Y.RENDERMODE_CUTOUT=1,Y.RENDERMODE_TRANSPARENT=2,Y.ALBEDOTEXTURE=F.propertyNameToID("u_DiffuseTexture"),Y.NORMALTEXTURE=F.propertyNameToID("u_NormalTexture"),Y.SPECULARTEXTURE=F.propertyNameToID("u_SpecularTexture"),Y.ALBEDOCOLOR=F.propertyNameToID("u_DiffuseColor"),Y.MATERIALSPECULAR=F.propertyNameToID("u_MaterialSpecular"),Y.SHININESS=F.propertyNameToID("u_Shininess"),Y.TILINGOFFSET=F.propertyNameToID("u_TilingOffset"),Y.CULL=F.propertyNameToID("s_Cull"),Y.BLEND=F.propertyNameToID("s_Blend"),Y.BLEND_SRC=F.propertyNameToID("s_BlendSrc"),Y.BLEND_DST=F.propertyNameToID("s_BlendDst"),Y.DEPTH_TEST=F.propertyNameToID("s_DepthTest"),Y.DEPTH_WRITE=F.propertyNameToID("s_DepthWrite");class Z extends W{constructor(){super(),this.setShaderName("Effect"),this._color=new a(1,1,1,1),this._shaderValues.setVector(Z.TINTCOLOR,new a(1,1,1,1)),this.renderMode=Z.RENDERMODE_ADDTIVE}static __initDefine__(){Z.SHADERDEFINE_MAINTEXTURE=F.getDefineByName("MAINTEXTURE"),Z.SHADERDEFINE_TILINGOFFSET=F.getDefineByName("TILINGOFFSET"),Z.SHADERDEFINE_ADDTIVEFOG=F.getDefineByName("ADDTIVEFOG")}get _TintColorR(){return this._color.x}set _TintColorR(e){this._color.x=e,this.color=this._color}get _TintColorG(){return this._color.y}set _TintColorG(e){this._color.y=e,this.color=this._color}get _TintColorB(){return this._color.z}set _TintColorB(e){this._color.z=e,this.color=this._color}get _TintColorA(){return this._color.w}set _TintColorA(e){this._color.w=e,this.color=this._color}get _MainTex_STX(){return this._shaderValues.getVector(Z.TILINGOFFSET).x}set _MainTex_STX(e){var t=this._shaderValues.getVector(Z.TILINGOFFSET);t.x=e,this.tilingOffset=t}get _MainTex_STY(){return this._shaderValues.getVector(Z.TILINGOFFSET).y}set _MainTex_STY(e){var t=this._shaderValues.getVector(Z.TILINGOFFSET);t.y=e,this.tilingOffset=t}get _MainTex_STZ(){return this._shaderValues.getVector(Z.TILINGOFFSET).z}set _MainTex_STZ(e){var t=this._shaderValues.getVector(Z.TILINGOFFSET);t.z=e,this.tilingOffset=t}get _MainTex_STW(){return this._shaderValues.getVector(Z.TILINGOFFSET).w}set _MainTex_STW(e){var t=this._shaderValues.getVector(Z.TILINGOFFSET);t.w=e,this.tilingOffset=t}set renderMode(e){switch(e){case Z.RENDERMODE_ADDTIVE:this.renderQueue=W.RENDERQUEUE_TRANSPARENT,this.alphaTest=!1,this.depthWrite=!1,this.cull=X.CULL_NONE,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_SRC_ALPHA,this.blendDst=X.BLENDPARAM_ONE,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.addDefine(Z.SHADERDEFINE_ADDTIVEFOG);break;case Z.RENDERMODE_ALPHABLENDED:this.renderQueue=W.RENDERQUEUE_TRANSPARENT,this.alphaTest=!1,this.depthWrite=!1,this.cull=X.CULL_NONE,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_SRC_ALPHA,this.blendDst=X.BLENDPARAM_ONE_MINUS_SRC_ALPHA,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.removeDefine(Z.SHADERDEFINE_ADDTIVEFOG);break;default:throw new Error("MeshEffectMaterial : renderMode value error.")}}get colorR(){return this._TintColorR}set colorR(e){this._TintColorR=e}get colorG(){return this._TintColorG}set colorG(e){this._TintColorG=e}get colorB(){return this._TintColorB}set colorB(e){this._TintColorB=e}get colorA(){return this._TintColorA}set colorA(e){this._TintColorA=e}get color(){return this._shaderValues.getVector(Z.TINTCOLOR)}set color(e){this._shaderValues.setVector(Z.TINTCOLOR,e)}get texture(){return this._shaderValues.getTexture(Z.MAINTEXTURE)}set texture(e){e?this._shaderValues.addDefine(Z.SHADERDEFINE_MAINTEXTURE):this._shaderValues.removeDefine(Z.SHADERDEFINE_MAINTEXTURE),this._shaderValues.setTexture(Z.MAINTEXTURE,e)}get tilingOffsetX(){return this._MainTex_STX}set tilingOffsetX(e){this._MainTex_STX=e}get tilingOffsetY(){return this._MainTex_STY}set tilingOffsetY(e){this._MainTex_STY=e}get tilingOffsetZ(){return this._MainTex_STZ}set tilingOffsetZ(e){this._MainTex_STZ=e}get tilingOffsetW(){return this._MainTex_STW}set tilingOffsetW(e){this._MainTex_STW=e}get tilingOffset(){return this._shaderValues.getVector(Z.TILINGOFFSET)}set tilingOffset(e){e&&(1!=e.x||1!=e.y||0!=e.z||0!=e.w)?this._shaderValues.addDefine(Z.SHADERDEFINE_TILINGOFFSET):this._shaderValues.removeDefine(Z.SHADERDEFINE_TILINGOFFSET),this._shaderValues.setVector(Z.TILINGOFFSET,e)}set depthWrite(e){this._shaderValues.setBool(Z.DEPTH_WRITE,e)}get depthWrite(){return this._shaderValues.getBool(Z.DEPTH_WRITE)}set cull(e){this._shaderValues.setInt(Z.CULL,e)}get cull(){return this._shaderValues.getInt(Z.CULL)}set blend(e){this._shaderValues.setInt(Z.BLEND,e)}get blend(){return this._shaderValues.getInt(Z.BLEND)}set blendSrc(e){this._shaderValues.setInt(Z.BLEND_SRC,e)}get blendSrc(){return this._shaderValues.getInt(Z.BLEND_SRC)}set blendDst(e){this._shaderValues.setInt(Z.BLEND_DST,e)}get blendDst(){return this._shaderValues.getInt(Z.BLEND_DST)}set depthTest(e){this._shaderValues.setInt(Z.DEPTH_TEST,e)}get depthTest(){return this._shaderValues.getInt(Z.DEPTH_TEST)}clone(){var e=new Z;return this.cloneTo(e),e}}Z.RENDERMODE_ADDTIVE=0,Z.RENDERMODE_ALPHABLENDED=1,Z.MAINTEXTURE=F.propertyNameToID("u_AlbedoTexture"),Z.TINTCOLOR=F.propertyNameToID("u_AlbedoColor"),Z.TILINGOFFSET=F.propertyNameToID("u_TilingOffset"),Z.CULL=F.propertyNameToID("s_Cull"),Z.BLEND=F.propertyNameToID("s_Blend"),Z.BLEND_SRC=F.propertyNameToID("s_BlendSrc"),Z.BLEND_DST=F.propertyNameToID("s_BlendDst"),Z.DEPTH_TEST=F.propertyNameToID("s_DepthTest"),Z.DEPTH_WRITE=F.propertyNameToID("s_DepthWrite");class j extends W{constructor(){super(),this._enableLighting=!0,this.setShaderName("ExtendTerrain"),this.renderMode=j.RENDERMODE_OPAQUE}static __initDefine__(){j.SHADERDEFINE_DETAIL_NUM1=F.getDefineByName("ExtendTerrain_DETAIL_NUM1"),j.SHADERDEFINE_DETAIL_NUM2=F.getDefineByName("ExtendTerrain_DETAIL_NUM2"),j.SHADERDEFINE_DETAIL_NUM3=F.getDefineByName("ExtendTerrain_DETAIL_NUM3"),j.SHADERDEFINE_DETAIL_NUM4=F.getDefineByName("ExtendTerrain_DETAIL_NUM4"),j.SHADERDEFINE_DETAIL_NUM5=F.getDefineByName("ExtendTerrain_DETAIL_NUM5")}get splatAlphaTexture(){return this._shaderValues.getTexture(j.SPLATALPHATEXTURE)}set splatAlphaTexture(e){this._shaderValues.setTexture(j.SPLATALPHATEXTURE,e)}set diffuseTexture1(e){this._shaderValues.setTexture(j.DIFFUSETEXTURE1,e),this._setDetailNum(1)}get diffuseTexture2(){return this._shaderValues.getTexture(j.DIFFUSETEXTURE2)}set diffuseTexture2(e){this._shaderValues.setTexture(j.DIFFUSETEXTURE2,e),this._setDetailNum(2)}get diffuseTexture3(){return this._shaderValues.getTexture(j.DIFFUSETEXTURE3)}set diffuseTexture3(e){this._shaderValues.setTexture(j.DIFFUSETEXTURE3,e),this._setDetailNum(3)}get diffuseTexture4(){return this._shaderValues.getTexture(j.DIFFUSETEXTURE4)}set diffuseTexture4(e){this._shaderValues.setTexture(j.DIFFUSETEXTURE4,e),this._setDetailNum(4)}get diffuseTexture5(){return this._shaderValues.getTexture(j.DIFFUSETEXTURE5)}set diffuseTexture5(e){this._shaderValues.setTexture(j.DIFFUSETEXTURE5,e),this._setDetailNum(5)}_setDetailNum(e){switch(e){case 1:this._shaderValues.addDefine(j.SHADERDEFINE_DETAIL_NUM1),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM2),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM3),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM4),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM5);break;case 2:this._shaderValues.addDefine(j.SHADERDEFINE_DETAIL_NUM2),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM1),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM3),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM4),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM5);break;case 3:this._shaderValues.addDefine(j.SHADERDEFINE_DETAIL_NUM3),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM1),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM2),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM4),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM5);break;case 4:this._shaderValues.addDefine(j.SHADERDEFINE_DETAIL_NUM4),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM1),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM2),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM3),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM5);break;case 5:this._shaderValues.addDefine(j.SHADERDEFINE_DETAIL_NUM5),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM1),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM2),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM3),this._shaderValues.removeDefine(j.SHADERDEFINE_DETAIL_NUM4)}}set diffuseScaleOffset1(e){this._shaderValues.setVector(j.DIFFUSESCALEOFFSET1,e)}set diffuseScaleOffset2(e){this._shaderValues.setVector(j.DIFFUSESCALEOFFSET2,e)}set diffuseScaleOffset3(e){this._shaderValues.setVector(j.DIFFUSESCALEOFFSET3,e)}set diffuseScaleOffset4(e){this._shaderValues.setVector(j.DIFFUSESCALEOFFSET4,e)}set diffuseScaleOffset5(e){this._shaderValues.setVector(j.DIFFUSESCALEOFFSET5,e)}get enableLighting(){return this._enableLighting}set enableLighting(e){this._enableLighting!==e&&(e?(this._disablePublicDefineDatas.remove(k.SHADERDEFINE_POINTLIGHT),this._disablePublicDefineDatas.remove(k.SHADERDEFINE_SPOTLIGHT),this._disablePublicDefineDatas.remove(k.SHADERDEFINE_DIRECTIONLIGHT)):(this._disablePublicDefineDatas.add(k.SHADERDEFINE_POINTLIGHT),this._disablePublicDefineDatas.add(k.SHADERDEFINE_SPOTLIGHT),this._disablePublicDefineDatas.add(k.SHADERDEFINE_DIRECTIONLIGHT)),this._enableLighting=e)}set renderMode(e){switch(e){case j.RENDERMODE_OPAQUE:this.renderQueue=W.RENDERQUEUE_OPAQUE,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS;break;case j.RENDERMODE_TRANSPARENT:this.renderQueue=W.RENDERQUEUE_OPAQUE,this.depthWrite=!1,this.cull=X.CULL_BACK,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_SRC_ALPHA,this.blendDst=X.BLENDPARAM_ONE_MINUS_SRC_ALPHA,this.depthTest=X.DEPTHTEST_LEQUAL;break;default:throw new Error("ExtendTerrainMaterial:renderMode value error.")}}set depthWrite(e){this._shaderValues.setBool(j.DEPTH_WRITE,e)}get depthWrite(){return this._shaderValues.getBool(j.DEPTH_WRITE)}set cull(e){this._shaderValues.setInt(j.CULL,e)}get cull(){return this._shaderValues.getInt(j.CULL)}set blend(e){this._shaderValues.setInt(j.BLEND,e)}get blend(){return this._shaderValues.getInt(j.BLEND)}set blendSrc(e){this._shaderValues.setInt(j.BLEND_SRC,e)}get blendSrc(){return this._shaderValues.getInt(j.BLEND_SRC)}set blendDst(e){this._shaderValues.setInt(j.BLEND_DST,e)}get blendDst(){return this._shaderValues.getInt(j.BLEND_DST)}set depthTest(e){this._shaderValues.setInt(j.DEPTH_TEST,e)}get depthTest(){return this._shaderValues.getInt(j.DEPTH_TEST)}clone(){var e=new j;return this.cloneTo(e),e}}j.RENDERMODE_OPAQUE=1,j.RENDERMODE_TRANSPARENT=2,j.SPLATALPHATEXTURE=F.propertyNameToID("u_SplatAlphaTexture"),j.DIFFUSETEXTURE1=F.propertyNameToID("u_DiffuseTexture1"),j.DIFFUSETEXTURE2=F.propertyNameToID("u_DiffuseTexture2"),j.DIFFUSETEXTURE3=F.propertyNameToID("u_DiffuseTexture3"),j.DIFFUSETEXTURE4=F.propertyNameToID("u_DiffuseTexture4"),j.DIFFUSETEXTURE5=F.propertyNameToID("u_DiffuseTexture5"),j.DIFFUSESCALEOFFSET1=F.propertyNameToID("u_DiffuseScaleOffset1"),j.DIFFUSESCALEOFFSET2=F.propertyNameToID("u_DiffuseScaleOffset2"),j.DIFFUSESCALEOFFSET3=F.propertyNameToID("u_DiffuseScaleOffset3"),j.DIFFUSESCALEOFFSET4=F.propertyNameToID("u_DiffuseScaleOffset4"),j.DIFFUSESCALEOFFSET5=F.propertyNameToID("u_DiffuseScaleOffset5"),j.CULL=F.propertyNameToID("s_Cull"),j.BLEND=F.propertyNameToID("s_Blend"),j.BLEND_SRC=F.propertyNameToID("s_BlendSrc"),j.BLEND_DST=F.propertyNameToID("s_BlendDst"),j.DEPTH_TEST=F.propertyNameToID("s_DepthTest"),j.DEPTH_WRITE=F.propertyNameToID("s_DepthWrite");class q extends W{constructor(){super(),this.setShaderName("PBRSpecular"),this._albedoColor=new a(1,1,1,1),this._shaderValues.setVector(q.ALBEDOCOLOR,new a(1,1,1,1)),this._emissionColor=new a(0,0,0,0),this._shaderValues.setVector(q.EMISSIONCOLOR,new a(0,0,0,0)),this._specularColor=new a(.2,.2,.2,.2),this._shaderValues.setVector(q.SPECULARCOLOR,new a(.2,.2,.2,.2)),this._shaderValues.setNumber(q.SMOOTHNESS,.5),this._shaderValues.setNumber(q.SMOOTHNESSSCALE,1),this._shaderValues.setNumber(q.SMOOTHNESSSOURCE,0),this._shaderValues.setNumber(q.OCCLUSIONSTRENGTH,1),this._shaderValues.setNumber(q.NORMALSCALE,1),this._shaderValues.setNumber(q.PARALLAXSCALE,.001),this._shaderValues.setBool(q.ENABLEEMISSION,!1),this._shaderValues.setNumber(W.ALPHATESTVALUE,.5),this.renderMode=q.RENDERMODE_OPAQUE}static __initDefine__(){q.SHADERDEFINE_ALBEDOTEXTURE=F.getDefineByName("ALBEDOTEXTURE"),q.SHADERDEFINE_SPECULARTEXTURE=F.getDefineByName("SPECULARTEXTURE"),q.SHADERDEFINE_SMOOTHNESSSOURCE_ALBEDOTEXTURE_ALPHA=F.getDefineByName("SMOOTHNESSSOURCE_ALBEDOTEXTURE_ALPHA"),q.SHADERDEFINE_NORMALTEXTURE=F.getDefineByName("NORMALTEXTURE"),q.SHADERDEFINE_PARALLAXTEXTURE=F.getDefineByName("PARALLAXTEXTURE"),q.SHADERDEFINE_OCCLUSIONTEXTURE=F.getDefineByName("OCCLUSIONTEXTURE"),q.SHADERDEFINE_EMISSION=F.getDefineByName("EMISSION"),q.SHADERDEFINE_EMISSIONTEXTURE=F.getDefineByName("EMISSIONTEXTURE"),q.SHADERDEFINE_TILINGOFFSET=F.getDefineByName("TILINGOFFSET"),q.SHADERDEFINE_ALPHAPREMULTIPLY=F.getDefineByName("ALPHAPREMULTIPLY")}get _ColorR(){return this._albedoColor.x}set _ColorR(e){this._albedoColor.x=e,this.albedoColor=this._albedoColor}get _ColorG(){return this._albedoColor.y}set _ColorG(e){this._albedoColor.y=e,this.albedoColor=this._albedoColor}get _ColorB(){return this._albedoColor.z}set _ColorB(e){this._albedoColor.z=e,this.albedoColor=this._albedoColor}get _ColorA(){return this._albedoColor.w}set _ColorA(e){this._albedoColor.w=e,this.albedoColor=this._albedoColor}get _SpecColorR(){return this._specularColor.x}set _SpecColorR(e){this._specularColor.x=e,this.specularColor=this._specularColor}get _SpecColorG(){return this._specularColor.y}set _SpecColorG(e){this._specularColor.y=e,this.specularColor=this._specularColor}get _SpecColorB(){return this._specularColor.z}set _SpecColorB(e){this._specularColor.z=e,this.specularColor=this._specularColor}get _SpecColorA(){return this._specularColor.w}set _SpecColorA(e){this._specularColor.w=e,this.specularColor=this._specularColor}get _Glossiness(){return this._shaderValues.getNumber(q.SMOOTHNESS)}set _Glossiness(e){this._shaderValues.setNumber(q.SMOOTHNESS,e)}get _GlossMapScale(){return this._shaderValues.getNumber(q.SMOOTHNESSSCALE)}set _GlossMapScale(e){this._shaderValues.setNumber(q.SMOOTHNESSSCALE,e)}get _BumpScale(){return this._shaderValues.getNumber(q.NORMALSCALE)}set _BumpScale(e){this._shaderValues.setNumber(q.NORMALSCALE,e)}get _Parallax(){return this._shaderValues.getNumber(q.PARALLAXSCALE)}set _Parallax(e){this._shaderValues.setNumber(q.PARALLAXSCALE,e)}get _OcclusionStrength(){return this._shaderValues.getNumber(q.OCCLUSIONSTRENGTH)}set _OcclusionStrength(e){this._shaderValues.setNumber(q.OCCLUSIONSTRENGTH,e)}get _EmissionColorR(){return this._emissionColor.x}set _EmissionColorR(e){this._emissionColor.x=e,this.emissionColor=this._emissionColor}get _EmissionColorG(){return this._emissionColor.y}set _EmissionColorG(e){this._emissionColor.y=e,this.emissionColor=this._emissionColor}get _EmissionColorB(){return this._emissionColor.z}set _EmissionColorB(e){this._emissionColor.z=e,this.emissionColor=this._emissionColor}get _EmissionColorA(){return this._emissionColor.w}set _EmissionColorA(e){this._emissionColor.w=e,this.emissionColor=this._emissionColor}get _MainTex_STX(){return this._shaderValues.getVector(q.TILINGOFFSET).x}set _MainTex_STX(e){var t=this._shaderValues.getVector(q.TILINGOFFSET);t.x=e,this.tilingOffset=t}get _MainTex_STY(){return this._shaderValues.getVector(q.TILINGOFFSET).y}set _MainTex_STY(e){var t=this._shaderValues.getVector(q.TILINGOFFSET);t.y=e,this.tilingOffset=t}get _MainTex_STZ(){return this._shaderValues.getVector(q.TILINGOFFSET).z}set _MainTex_STZ(e){var t=this._shaderValues.getVector(q.TILINGOFFSET);t.z=e,this.tilingOffset=t}get _MainTex_STW(){return this._shaderValues.getVector(q.TILINGOFFSET).w}set _MainTex_STW(e){var t=this._shaderValues.getVector(q.TILINGOFFSET);t.w=e,this.tilingOffset=t}get _Cutoff(){return this.alphaTestValue}set _Cutoff(e){this.alphaTestValue=e}get albedoColorR(){return this._ColorR}set albedoColorR(e){this._ColorR=e}get albedoColorG(){return this._ColorG}set albedoColorG(e){this._ColorG=e}get albedoColorB(){return this._ColorB}set albedoColorB(e){this._ColorB=e}get albedoColorA(){return this._ColorA}set albedoColorA(e){this._ColorA=e}get albedoColor(){return this._albedoColor}set albedoColor(e){this._albedoColor=e,this._shaderValues.setVector(q.ALBEDOCOLOR,e)}get albedoTexture(){return this._shaderValues.getTexture(q.ALBEDOTEXTURE)}set albedoTexture(e){e?this._shaderValues.addDefine(q.SHADERDEFINE_ALBEDOTEXTURE):this._shaderValues.removeDefine(q.SHADERDEFINE_ALBEDOTEXTURE),this._shaderValues.setTexture(q.ALBEDOTEXTURE,e)}get normalTexture(){return this._shaderValues.getTexture(q.NORMALTEXTURE)}set normalTexture(e){e?this._shaderValues.addDefine(q.SHADERDEFINE_NORMALTEXTURE):this._shaderValues.removeDefine(q.SHADERDEFINE_NORMALTEXTURE),this._shaderValues.setTexture(q.NORMALTEXTURE,e)}get normalTextureScale(){return this._BumpScale}set normalTextureScale(e){this._BumpScale=e}get parallaxTexture(){return this._shaderValues.getTexture(q.PARALLAXTEXTURE)}set parallaxTexture(e){e?this._shaderValues.addDefine(q.SHADERDEFINE_PARALLAXTEXTURE):this._shaderValues.removeDefine(q.SHADERDEFINE_PARALLAXTEXTURE),this._shaderValues.setTexture(q.PARALLAXTEXTURE,e)}get parallaxTextureScale(){return this._Parallax}set parallaxTextureScale(e){this._Parallax=Math.max(.005,Math.min(.08,e))}get occlusionTexture(){return this._shaderValues.getTexture(q.OCCLUSIONTEXTURE)}set occlusionTexture(e){e?this._shaderValues.addDefine(q.SHADERDEFINE_OCCLUSIONTEXTURE):this._shaderValues.removeDefine(q.SHADERDEFINE_OCCLUSIONTEXTURE),this._shaderValues.setTexture(q.OCCLUSIONTEXTURE,e)}get occlusionTextureStrength(){return this._OcclusionStrength}set occlusionTextureStrength(e){this._OcclusionStrength=Math.max(0,Math.min(1,e))}get specularTexture(){return this._shaderValues.getTexture(q.SPECULARTEXTURE)}set specularTexture(e){e?this._shaderValues.addDefine(q.SHADERDEFINE_SPECULARTEXTURE):this._shaderValues.removeDefine(q.SHADERDEFINE_SPECULARTEXTURE),this._shaderValues.setTexture(q.SPECULARTEXTURE,e)}get specularColorR(){return this._SpecColorR}set specularColorR(e){this._SpecColorR=e}get specularColorG(){return this._SpecColorG}set specularColorG(e){this._SpecColorG=e}get specularColorB(){return this._SpecColorB}set specularColorB(e){this._SpecColorB=e}get specularColorA(){return this._SpecColorA}set specularColorA(e){this._SpecColorA=e}get specularColor(){return this._shaderValues.getVector(q.SPECULARCOLOR)}set specularColor(e){this._shaderValues.setVector(q.SPECULARCOLOR,e)}get smoothness(){return this._Glossiness}set smoothness(e){this._Glossiness=Math.max(0,Math.min(1,e))}get smoothnessTextureScale(){return this._GlossMapScale}set smoothnessTextureScale(e){this._GlossMapScale=Math.max(0,Math.min(1,e))}get smoothnessSource(){return this._shaderValues.getInt(q.SMOOTHNESSSOURCE)}set smoothnessSource(e){e?(this._shaderValues.addDefine(q.SHADERDEFINE_SMOOTHNESSSOURCE_ALBEDOTEXTURE_ALPHA),this._shaderValues.setInt(q.SMOOTHNESSSOURCE,1)):(this._shaderValues.removeDefine(q.SHADERDEFINE_SMOOTHNESSSOURCE_ALBEDOTEXTURE_ALPHA),this._shaderValues.setInt(q.SMOOTHNESSSOURCE,0))}get enableEmission(){return this._shaderValues.getBool(q.ENABLEEMISSION)}set enableEmission(e){e?this._shaderValues.addDefine(q.SHADERDEFINE_EMISSION):this._shaderValues.removeDefine(q.SHADERDEFINE_EMISSION),this._shaderValues.setBool(q.ENABLEEMISSION,e)}get emissionColor(){return this._shaderValues.getVector(q.EMISSIONCOLOR)}set emissionColor(e){this._shaderValues.setVector(q.EMISSIONCOLOR,e)}get emissionTexture(){return this._shaderValues.getTexture(q.EMISSIONTEXTURE)}set emissionTexture(e){e?this._shaderValues.addDefine(q.SHADERDEFINE_EMISSIONTEXTURE):this._shaderValues.removeDefine(q.SHADERDEFINE_EMISSIONTEXTURE),this._shaderValues.setTexture(q.EMISSIONTEXTURE,e)}get enableReflection(){return this._shaderValues.getBool(q.ENABLEREFLECT)}set enableReflection(e){this._shaderValues.setBool(q.ENABLEREFLECT,!0),e?this._disablePublicDefineDatas.remove(k.SHADERDEFINE_REFLECTMAP):this._disablePublicDefineDatas.add(k.SHADERDEFINE_REFLECTMAP)}get tilingOffsetX(){return this._MainTex_STX}set tilingOffsetX(e){this._MainTex_STX=e}get tilingOffsetY(){return this._MainTex_STY}set tilingOffsetY(e){this._MainTex_STY=e}get tilingOffsetZ(){return this._MainTex_STZ}set tilingOffsetZ(e){this._MainTex_STZ=e}get tilingOffsetW(){return this._MainTex_STW}set tilingOffsetW(e){this._MainTex_STW=e}get tilingOffset(){return this._shaderValues.getVector(q.TILINGOFFSET)}set tilingOffset(e){e&&(1!=e.x||1!=e.y||0!=e.z||0!=e.w)?this._shaderValues.addDefine(q.SHADERDEFINE_TILINGOFFSET):this._shaderValues.removeDefine(q.SHADERDEFINE_TILINGOFFSET),this._shaderValues.setVector(q.TILINGOFFSET,e)}set renderMode(e){switch(e){case q.RENDERMODE_OPAQUE:this.alphaTest=!1,this.renderQueue=W.RENDERQUEUE_OPAQUE,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.removeDefine(q.SHADERDEFINE_ALPHAPREMULTIPLY);break;case q.RENDERMODE_CUTOUT:this.renderQueue=W.RENDERQUEUE_ALPHATEST,this.alphaTest=!0,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.removeDefine(q.SHADERDEFINE_ALPHAPREMULTIPLY);break;case q.RENDERMODE_FADE:this.renderQueue=W.RENDERQUEUE_TRANSPARENT,this.alphaTest=!1,this.depthWrite=!1,this.cull=X.CULL_BACK,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_SRC_ALPHA,this.blendDst=X.BLENDPARAM_ONE_MINUS_SRC_ALPHA,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.removeDefine(q.SHADERDEFINE_ALPHAPREMULTIPLY);break;case q.RENDERMODE_TRANSPARENT:this.renderQueue=W.RENDERQUEUE_TRANSPARENT,this.alphaTest=!1,this.depthWrite=!1,this.cull=X.CULL_BACK,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_ONE,this.blendDst=X.BLENDPARAM_ONE_MINUS_SRC_ALPHA,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.addDefine(q.SHADERDEFINE_ALPHAPREMULTIPLY);break;default:throw new Error("PBRSpecularMaterial : renderMode value error.")}}get depthWrite(){return this._shaderValues.getBool(q.DEPTH_WRITE)}set depthWrite(e){this._shaderValues.setBool(q.DEPTH_WRITE,e)}get cull(){return this._shaderValues.getInt(q.CULL)}set cull(e){this._shaderValues.setInt(q.CULL,e)}get blend(){return this._shaderValues.getInt(q.BLEND)}set blend(e){this._shaderValues.setInt(q.BLEND,e)}get blendSrc(){return this._shaderValues.getInt(q.BLEND_SRC)}set blendSrc(e){this._shaderValues.setInt(q.BLEND_SRC,e)}get blendDst(){return this._shaderValues.getInt(q.BLEND_DST)}set blendDst(e){this._shaderValues.setInt(q.BLEND_DST,e)}get depthTest(){return this._shaderValues.getInt(q.DEPTH_TEST)}set depthTest(e){this._shaderValues.setInt(q.DEPTH_TEST,e)}clone(){var e=new q;return this.cloneTo(e),e}cloneTo(e){super.cloneTo(e);var t=e;this._albedoColor.cloneTo(t._albedoColor),this._specularColor.cloneTo(t._specularColor),this._emissionColor.cloneTo(t._emissionColor)}}q.SmoothnessSource_SpecularTexture_Alpha=0,q.SmoothnessSource_AlbedoTexture_Alpha=1,q.RENDERMODE_OPAQUE=0,q.RENDERMODE_CUTOUT=1,q.RENDERMODE_FADE=2,q.RENDERMODE_TRANSPARENT=3,q.ALBEDOTEXTURE=F.propertyNameToID("u_AlbedoTexture"),q.SPECULARTEXTURE=F.propertyNameToID("u_SpecularTexture"),q.NORMALTEXTURE=F.propertyNameToID("u_NormalTexture"),q.PARALLAXTEXTURE=F.propertyNameToID("u_ParallaxTexture"),q.OCCLUSIONTEXTURE=F.propertyNameToID("u_OcclusionTexture"),q.EMISSIONTEXTURE=F.propertyNameToID("u_EmissionTexture"),q.ALBEDOCOLOR=F.propertyNameToID("u_AlbedoColor"),q.SPECULARCOLOR=F.propertyNameToID("u_SpecularColor"),q.EMISSIONCOLOR=F.propertyNameToID("u_EmissionColor"),q.SMOOTHNESS=F.propertyNameToID("u_smoothness"),q.SMOOTHNESSSCALE=F.propertyNameToID("u_smoothnessScale"),q.SMOOTHNESSSOURCE=-1,q.OCCLUSIONSTRENGTH=F.propertyNameToID("u_occlusionStrength"),q.NORMALSCALE=F.propertyNameToID("u_normalScale"),q.PARALLAXSCALE=F.propertyNameToID("u_parallaxScale"),q.ENABLEEMISSION=-1,q.ENABLEREFLECT=-1,q.TILINGOFFSET=F.propertyNameToID("u_TilingOffset"),q.CULL=F.propertyNameToID("s_Cull"),q.BLEND=F.propertyNameToID("s_Blend"),q.BLEND_SRC=F.propertyNameToID("s_BlendSrc"),q.BLEND_DST=F.propertyNameToID("s_BlendDst"),q.DEPTH_TEST=F.propertyNameToID("s_DepthTest"),q.DEPTH_WRITE=F.propertyNameToID("s_DepthWrite");class Q extends W{constructor(){super(),this.setShaderName("PBRStandard"),this._albedoColor=new a(1,1,1,1),this._shaderValues.setVector(Q.ALBEDOCOLOR,new a(1,1,1,1)),this._emissionColor=new a(0,0,0,0),this._shaderValues.setVector(Q.EMISSIONCOLOR,new a(0,0,0,0)),this._shaderValues.setNumber(Q.METALLIC,0),this._shaderValues.setNumber(Q.SMOOTHNESS,.5),this._shaderValues.setNumber(Q.SMOOTHNESSSCALE,1),this._shaderValues.setNumber(Q.SMOOTHNESSSOURCE,0),this._shaderValues.setNumber(Q.OCCLUSIONSTRENGTH,1),this._shaderValues.setNumber(Q.NORMALSCALE,1),this._shaderValues.setNumber(Q.PARALLAXSCALE,.001),this._shaderValues.setBool(Q.ENABLEEMISSION,!1),this._shaderValues.setBool(Q.ENABLEREFLECT,!0),this._shaderValues.setNumber(W.ALPHATESTVALUE,.5),this._disablePublicDefineDatas.remove(k.SHADERDEFINE_REFLECTMAP),this.renderMode=Q.RENDERMODE_OPAQUE}static __initDefine__(){Q.SHADERDEFINE_ALBEDOTEXTURE=F.getDefineByName("ALBEDOTEXTURE"),Q.SHADERDEFINE_METALLICGLOSSTEXTURE=F.getDefineByName("METALLICGLOSSTEXTURE"),Q.SHADERDEFINE_SMOOTHNESSSOURCE_ALBEDOTEXTURE_ALPHA=F.getDefineByName("SMOOTHNESSSOURCE_ALBEDOTEXTURE_ALPHA"),Q.SHADERDEFINE_NORMALTEXTURE=F.getDefineByName("NORMALTEXTURE"),Q.SHADERDEFINE_PARALLAXTEXTURE=F.getDefineByName("PARALLAXTEXTURE"),Q.SHADERDEFINE_OCCLUSIONTEXTURE=F.getDefineByName("OCCLUSIONTEXTURE"),Q.SHADERDEFINE_EMISSION=F.getDefineByName("EMISSION"),Q.SHADERDEFINE_EMISSIONTEXTURE=F.getDefineByName("EMISSIONTEXTURE"),Q.SHADERDEFINE_REFLECTMAP=F.getDefineByName("REFLECTMAP"),Q.SHADERDEFINE_TILINGOFFSET=F.getDefineByName("TILINGOFFSET"),Q.SHADERDEFINE_ALPHAPREMULTIPLY=F.getDefineByName("ALPHAPREMULTIPLY")}get _ColorR(){return this._albedoColor.x}set _ColorR(e){this._albedoColor.x=e,this.albedoColor=this._albedoColor}get _ColorG(){return this._albedoColor.y}set _ColorG(e){this._albedoColor.y=e,this.albedoColor=this._albedoColor}get _ColorB(){return this._albedoColor.z}set _ColorB(e){this._albedoColor.z=e,this.albedoColor=this._albedoColor}get _ColorA(){return this._albedoColor.w}set _ColorA(e){this._albedoColor.w=e,this.albedoColor=this._albedoColor}get _Metallic(){return this._shaderValues.getNumber(Q.METALLIC)}set _Metallic(e){this._shaderValues.setNumber(Q.METALLIC,e)}get _Glossiness(){return this._shaderValues.getNumber(Q.SMOOTHNESS)}set _Glossiness(e){this._shaderValues.setNumber(Q.SMOOTHNESS,e)}get _GlossMapScale(){return this._shaderValues.getNumber(Q.SMOOTHNESSSCALE)}set _GlossMapScale(e){this._shaderValues.setNumber(Q.SMOOTHNESSSCALE,e)}get _BumpScale(){return this._shaderValues.getNumber(Q.NORMALSCALE)}set _BumpScale(e){this._shaderValues.setNumber(Q.NORMALSCALE,e)}get _Parallax(){return this._shaderValues.getNumber(Q.PARALLAXSCALE)}set _Parallax(e){this._shaderValues.setNumber(Q.PARALLAXSCALE,e)}get _OcclusionStrength(){return this._shaderValues.getNumber(Q.OCCLUSIONSTRENGTH)}set _OcclusionStrength(e){this._shaderValues.setNumber(Q.OCCLUSIONSTRENGTH,e)}get _EmissionColorR(){return this._emissionColor.x}set _EmissionColorR(e){this._emissionColor.x=e,this.emissionColor=this._emissionColor}get _EmissionColorG(){return this._emissionColor.y}set _EmissionColorG(e){this._emissionColor.y=e,this.emissionColor=this._emissionColor}get _EmissionColorB(){return this._emissionColor.z}set _EmissionColorB(e){this._emissionColor.z=e,this.emissionColor=this._emissionColor}get _EmissionColorA(){return this._emissionColor.w}set _EmissionColorA(e){this._emissionColor.w=e,this.emissionColor=this._emissionColor}get _MainTex_STX(){return this._shaderValues.getVector(Q.TILINGOFFSET).x}set _MainTex_STX(e){var t=this._shaderValues.getVector(Q.TILINGOFFSET);t.x=e,this.tilingOffset=t}get _MainTex_STY(){return this._shaderValues.getVector(Q.TILINGOFFSET).y}set _MainTex_STY(e){var t=this._shaderValues.getVector(Q.TILINGOFFSET);t.y=e,this.tilingOffset=t}get _MainTex_STZ(){return this._shaderValues.getVector(Q.TILINGOFFSET).z}set _MainTex_STZ(e){var t=this._shaderValues.getVector(Q.TILINGOFFSET);t.z=e,this.tilingOffset=t}get _MainTex_STW(){return this._shaderValues.getVector(Q.TILINGOFFSET).w}set _MainTex_STW(e){var t=this._shaderValues.getVector(Q.TILINGOFFSET);t.w=e,this.tilingOffset=t}get _Cutoff(){return this.alphaTestValue}set _Cutoff(e){this.alphaTestValue=e}get albedoColorR(){return this._ColorR}set albedoColorR(e){this._ColorR=e}get albedoColorG(){return this._ColorG}set albedoColorG(e){this._ColorG=e}get albedoColorB(){return this._ColorB}set albedoColorB(e){this._ColorB=e}get albedoColorA(){return this._ColorA}set albedoColorA(e){this._ColorA=e}get albedoColor(){return this._albedoColor}set albedoColor(e){this._albedoColor=e,this._shaderValues.setVector(Q.ALBEDOCOLOR,e)}get albedoTexture(){return this._shaderValues.getTexture(Q.ALBEDOTEXTURE)}set albedoTexture(e){e?this._shaderValues.addDefine(Q.SHADERDEFINE_ALBEDOTEXTURE):this._shaderValues.removeDefine(Q.SHADERDEFINE_ALBEDOTEXTURE),this._shaderValues.setTexture(Q.ALBEDOTEXTURE,e)}get normalTexture(){return this._shaderValues.getTexture(Q.NORMALTEXTURE)}set normalTexture(e){e?this._shaderValues.addDefine(Q.SHADERDEFINE_NORMALTEXTURE):this._shaderValues.removeDefine(Q.SHADERDEFINE_NORMALTEXTURE),this._shaderValues.setTexture(Q.NORMALTEXTURE,e)}get normalTextureScale(){return this._BumpScale}set normalTextureScale(e){this._BumpScale=e}get parallaxTexture(){return this._shaderValues.getTexture(Q.PARALLAXTEXTURE)}set parallaxTexture(e){e?this._shaderValues.addDefine(Q.SHADERDEFINE_PARALLAXTEXTURE):this._shaderValues.removeDefine(Q.SHADERDEFINE_PARALLAXTEXTURE),this._shaderValues.setTexture(Q.PARALLAXTEXTURE,e)}get parallaxTextureScale(){return this._Parallax}set parallaxTextureScale(e){this._Parallax=Math.max(.005,Math.min(.08,e))}get occlusionTexture(){return this._shaderValues.getTexture(Q.OCCLUSIONTEXTURE)}set occlusionTexture(e){e?this._shaderValues.addDefine(Q.SHADERDEFINE_OCCLUSIONTEXTURE):this._shaderValues.removeDefine(Q.SHADERDEFINE_OCCLUSIONTEXTURE),this._shaderValues.setTexture(Q.OCCLUSIONTEXTURE,e)}get occlusionTextureStrength(){return this._OcclusionStrength}set occlusionTextureStrength(e){this._OcclusionStrength=Math.max(0,Math.min(1,e))}get metallicGlossTexture(){return this._shaderValues.getTexture(Q.METALLICGLOSSTEXTURE)}set metallicGlossTexture(e){e?this._shaderValues.addDefine(Q.SHADERDEFINE_METALLICGLOSSTEXTURE):this._shaderValues.removeDefine(Q.SHADERDEFINE_METALLICGLOSSTEXTURE),this._shaderValues.setTexture(Q.METALLICGLOSSTEXTURE,e)}get metallic(){return this._Metallic}set metallic(e){this._Metallic=Math.max(0,Math.min(1,e))}get smoothness(){return this._Glossiness}set smoothness(e){this._Glossiness=Math.max(0,Math.min(1,e))}get smoothnessTextureScale(){return this._GlossMapScale}set smoothnessTextureScale(e){this._GlossMapScale=Math.max(0,Math.min(1,e))}get smoothnessSource(){return this._shaderValues.getInt(Q.SMOOTHNESSSOURCE)}set smoothnessSource(e){e?(this._shaderValues.addDefine(Q.SHADERDEFINE_SMOOTHNESSSOURCE_ALBEDOTEXTURE_ALPHA),this._shaderValues.setInt(Q.SMOOTHNESSSOURCE,1)):(this._shaderValues.removeDefine(Q.SHADERDEFINE_SMOOTHNESSSOURCE_ALBEDOTEXTURE_ALPHA),this._shaderValues.setInt(Q.SMOOTHNESSSOURCE,0))}get enableEmission(){return this._shaderValues.getBool(Q.ENABLEEMISSION)}set enableEmission(e){e?this._shaderValues.addDefine(Q.SHADERDEFINE_EMISSION):this._shaderValues.removeDefine(Q.SHADERDEFINE_EMISSION),this._shaderValues.setBool(Q.ENABLEEMISSION,e)}get emissionColorR(){return this._EmissionColorR}set emissionColorR(e){this._EmissionColorR=e}get emissionColorG(){return this._EmissionColorG}set emissionColorG(e){this._EmissionColorG=e}get emissionColorB(){return this._EmissionColorB}set emissionColorB(e){this._EmissionColorB=e}get emissionColorA(){return this._EmissionColorA}set emissionColorA(e){this._EmissionColorA=e}get emissionColor(){return this._shaderValues.getVector(Q.EMISSIONCOLOR)}set emissionColor(e){this._shaderValues.setVector(Q.EMISSIONCOLOR,e)}get emissionTexture(){return this._shaderValues.getTexture(Q.EMISSIONTEXTURE)}set emissionTexture(e){e?this._shaderValues.addDefine(Q.SHADERDEFINE_EMISSIONTEXTURE):this._shaderValues.removeDefine(Q.SHADERDEFINE_EMISSIONTEXTURE),this._shaderValues.setTexture(Q.EMISSIONTEXTURE,e)}get enableReflection(){return this._shaderValues.getBool(Q.ENABLEREFLECT)}set enableReflection(e){this._shaderValues.setBool(Q.ENABLEREFLECT,!0),e?this._disablePublicDefineDatas.remove(k.SHADERDEFINE_REFLECTMAP):this._disablePublicDefineDatas.add(k.SHADERDEFINE_REFLECTMAP)}get tilingOffsetX(){return this._MainTex_STX}set tilingOffsetX(e){this._MainTex_STX=e}get tilingOffsetY(){return this._MainTex_STY}set tilingOffsetY(e){this._MainTex_STY=e}get tilingOffsetZ(){return this._MainTex_STZ}set tilingOffsetZ(e){this._MainTex_STZ=e}get tilingOffsetW(){return this._MainTex_STW}set tilingOffsetW(e){this._MainTex_STW=e}get tilingOffset(){return this._shaderValues.getVector(Q.TILINGOFFSET)}set tilingOffset(e){e&&(1!=e.x||1!=e.y||0!=e.z||0!=e.w)?this._shaderValues.addDefine(Q.SHADERDEFINE_TILINGOFFSET):this._shaderValues.removeDefine(Q.SHADERDEFINE_TILINGOFFSET),this._shaderValues.setVector(Q.TILINGOFFSET,e)}set renderMode(e){switch(e){case Q.RENDERMODE_OPAQUE:this.alphaTest=!1,this.renderQueue=W.RENDERQUEUE_OPAQUE,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.removeDefine(Q.SHADERDEFINE_ALPHAPREMULTIPLY);break;case Q.RENDERMODE_CUTOUT:this.renderQueue=W.RENDERQUEUE_ALPHATEST,this.alphaTest=!0,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.removeDefine(Q.SHADERDEFINE_ALPHAPREMULTIPLY);break;case Q.RENDERMODE_FADE:this.renderQueue=W.RENDERQUEUE_TRANSPARENT,this.alphaTest=!1,this.depthWrite=!1,this.cull=X.CULL_BACK,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_SRC_ALPHA,this.blendDst=X.BLENDPARAM_ONE_MINUS_SRC_ALPHA,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.removeDefine(Q.SHADERDEFINE_ALPHAPREMULTIPLY);break;case Q.RENDERMODE_TRANSPARENT:this.renderQueue=W.RENDERQUEUE_TRANSPARENT,this.alphaTest=!1,this.depthWrite=!1,this.cull=X.CULL_BACK,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_ONE,this.blendDst=X.BLENDPARAM_ONE_MINUS_SRC_ALPHA,this.depthTest=X.DEPTHTEST_LESS,this._shaderValues.addDefine(Q.SHADERDEFINE_ALPHAPREMULTIPLY);break;default:throw new Error("PBRSpecularMaterial : renderMode value error.")}}get depthWrite(){return this._shaderValues.getBool(Q.DEPTH_WRITE)}set depthWrite(e){this._shaderValues.setBool(Q.DEPTH_WRITE,e)}get cull(){return this._shaderValues.getInt(Q.CULL)}set cull(e){this._shaderValues.setInt(Q.CULL,e)}get blend(){return this._shaderValues.getInt(Q.BLEND)}set blend(e){this._shaderValues.setInt(Q.BLEND,e)}get blendSrc(){return this._shaderValues.getInt(Q.BLEND_SRC)}set blendSrc(e){this._shaderValues.setInt(Q.BLEND_SRC,e)}get blendDst(){return this._shaderValues.getInt(Q.BLEND_DST)}set blendDst(e){this._shaderValues.setInt(Q.BLEND_DST,e)}get depthTest(){return this._shaderValues.getInt(Q.DEPTH_TEST)}set depthTest(e){this._shaderValues.setInt(Q.DEPTH_TEST,e)}clone(){var e=new Q;return this.cloneTo(e),e}cloneTo(e){super.cloneTo(e);var t=e;this._albedoColor.cloneTo(t._albedoColor),this._emissionColor.cloneTo(t._emissionColor)}}Q.SmoothnessSource_MetallicGlossTexture_Alpha=0,Q.SmoothnessSource_AlbedoTexture_Alpha=1,Q.RENDERMODE_OPAQUE=0,Q.RENDERMODE_CUTOUT=1,Q.RENDERMODE_FADE=2,Q.RENDERMODE_TRANSPARENT=3,Q.ALBEDOTEXTURE=F.propertyNameToID("u_AlbedoTexture"),Q.METALLICGLOSSTEXTURE=F.propertyNameToID("u_MetallicGlossTexture"),Q.NORMALTEXTURE=F.propertyNameToID("u_NormalTexture"),Q.PARALLAXTEXTURE=F.propertyNameToID("u_ParallaxTexture"),Q.OCCLUSIONTEXTURE=F.propertyNameToID("u_OcclusionTexture"),Q.EMISSIONTEXTURE=F.propertyNameToID("u_EmissionTexture"),Q.ALBEDOCOLOR=F.propertyNameToID("u_AlbedoColor"),Q.EMISSIONCOLOR=F.propertyNameToID("u_EmissionColor"),Q.METALLIC=F.propertyNameToID("u_metallic"),Q.SMOOTHNESS=F.propertyNameToID("u_smoothness"),Q.SMOOTHNESSSCALE=F.propertyNameToID("u_smoothnessScale"),Q.SMOOTHNESSSOURCE=-1,Q.OCCLUSIONSTRENGTH=F.propertyNameToID("u_occlusionStrength"),Q.NORMALSCALE=F.propertyNameToID("u_normalScale"),Q.PARALLAXSCALE=F.propertyNameToID("u_parallaxScale"),Q.ENABLEEMISSION=-1,Q.ENABLEREFLECT=-1,Q.TILINGOFFSET=F.propertyNameToID("u_TilingOffset"),Q.CULL=F.propertyNameToID("s_Cull"),Q.BLEND=F.propertyNameToID("s_Blend"),Q.BLEND_SRC=F.propertyNameToID("s_BlendSrc"),Q.BLEND_DST=F.propertyNameToID("s_BlendDst"),Q.DEPTH_TEST=F.propertyNameToID("s_DepthTest"),Q.DEPTH_WRITE=F.propertyNameToID("s_DepthWrite");class K extends W{constructor(){super(),this.setShaderName("SkyBox"),this.tintColor=new a(.5,.5,.5,.5),this.exposure=1,this.rotation=0}static __initDefine__(){}get tintColor(){return this._shaderValues.getVector(K.TINTCOLOR)}set tintColor(e){this._shaderValues.setVector(K.TINTCOLOR,e)}get exposure(){return this._shaderValues.getNumber(K.EXPOSURE)}set exposure(e){this._shaderValues.setNumber(K.EXPOSURE,e)}get rotation(){return this._shaderValues.getNumber(K.ROTATION)}set rotation(e){this._shaderValues.setNumber(K.ROTATION,e)}get textureCube(){return this._shaderValues.getTexture(K.TEXTURECUBE)}set textureCube(e){this._shaderValues.setTexture(K.TEXTURECUBE,e)}clone(){var e=new K;return this.cloneTo(e),e}}K.TINTCOLOR=F.propertyNameToID("u_TintColor"),K.EXPOSURE=F.propertyNameToID("u_Exposure"),K.ROTATION=F.propertyNameToID("u_Rotation"),K.TEXTURECUBE=F.propertyNameToID("u_CubeTexture");class J extends W{constructor(){super(),this.setShaderName("SkyBoxProcedural"),this.sunDisk=J.SUN_HIGH_QUALITY,this.sunSize=.04,this.sunSizeConvergence=5,this.atmosphereThickness=1,this.skyTint=new a(.5,.5,.5,1),this.groundTint=new a(.369,.349,.341,1),this.exposure=1.3}static __initDefine__(){J.SHADERDEFINE_SUN_HIGH_QUALITY=F.getDefineByName("SUN_HIGH_QUALITY"),J.SHADERDEFINE_SUN_SIMPLE=F.getDefineByName("SUN_SIMPLE")}get sunDisk(){return this._sunDisk}set sunDisk(e){switch(e){case J.SUN_HIGH_QUALITY:this._shaderValues.removeDefine(J.SHADERDEFINE_SUN_SIMPLE),this._shaderValues.addDefine(J.SHADERDEFINE_SUN_HIGH_QUALITY);break;case J.SUN_SIMPLE:this._shaderValues.removeDefine(J.SHADERDEFINE_SUN_HIGH_QUALITY),this._shaderValues.addDefine(J.SHADERDEFINE_SUN_SIMPLE);break;case J.SUN_NODE:this._shaderValues.removeDefine(J.SHADERDEFINE_SUN_HIGH_QUALITY),this._shaderValues.removeDefine(J.SHADERDEFINE_SUN_SIMPLE);break;default:throw"SkyBoxProceduralMaterial: unknown sun value."}this._sunDisk=e}get sunSize(){return this._shaderValues.getNumber(J.SUNSIZE)}set sunSize(e){e=Math.min(Math.max(0,e),1),this._shaderValues.setNumber(J.SUNSIZE,e)}get sunSizeConvergence(){return this._shaderValues.getNumber(J.SUNSIZECONVERGENCE)}set sunSizeConvergence(e){e=Math.min(Math.max(0,e),20),this._shaderValues.setNumber(J.SUNSIZECONVERGENCE,e)}get atmosphereThickness(){return this._shaderValues.getNumber(J.ATMOSPHERETHICKNESS)}set atmosphereThickness(e){e=Math.min(Math.max(0,e),5),this._shaderValues.setNumber(J.ATMOSPHERETHICKNESS,e)}get skyTint(){return this._shaderValues.getVector(J.SKYTINT)}set skyTint(e){this._shaderValues.setVector(J.SKYTINT,e)}get groundTint(){return this._shaderValues.getVector(J.GROUNDTINT)}set groundTint(e){this._shaderValues.setVector(J.GROUNDTINT,e)}get exposure(){return this._shaderValues.getNumber(J.EXPOSURE)}set exposure(e){e=Math.min(Math.max(0,e),8),this._shaderValues.setNumber(J.EXPOSURE,e)}clone(){var e=new J;return this.cloneTo(e),e}}J.SUN_NODE=0,J.SUN_SIMPLE=1,J.SUN_HIGH_QUALITY=2,J.SUNSIZE=F.propertyNameToID("u_SunSize"),J.SUNSIZECONVERGENCE=F.propertyNameToID("u_SunSizeConvergence"),J.ATMOSPHERETHICKNESS=F.propertyNameToID("u_AtmosphereThickness"),J.SKYTINT=F.propertyNameToID("u_SkyTint"),J.GROUNDTINT=F.propertyNameToID("u_GroundTint"),J.EXPOSURE=F.propertyNameToID("u_Exposure");class $ extends W{constructor(){super(),this._albedoColor=new a(1,1,1,1),this._albedoIntensity=1,this._enableVertexColor=!1,this.setShaderName("Unlit"),this._shaderValues.setVector($.ALBEDOCOLOR,new a(1,1,1,1)),this.renderMode=$.RENDERMODE_OPAQUE}static __initDefine__(){$.SHADERDEFINE_ALBEDOTEXTURE=F.getDefineByName("ALBEDOTEXTURE"),$.SHADERDEFINE_TILINGOFFSET=F.getDefineByName("TILINGOFFSET"),$.SHADERDEFINE_ENABLEVERTEXCOLOR=F.getDefineByName("ENABLEVERTEXCOLOR")}get _ColorR(){return this._albedoColor.x}set _ColorR(e){this._albedoColor.x=e,this.albedoColor=this._albedoColor}get _ColorG(){return this._albedoColor.y}set _ColorG(e){this._albedoColor.y=e,this.albedoColor=this._albedoColor}get _ColorB(){return this._albedoColor.z}set _ColorB(e){this._albedoColor.z=e,this.albedoColor=this._albedoColor}get _ColorA(){return this._albedoColor.w}set _ColorA(e){this._albedoColor.w=e,this.albedoColor=this._albedoColor}get _AlbedoIntensity(){return this._albedoIntensity}set _AlbedoIntensity(e){if(this._albedoIntensity!==e){var t=this._shaderValues.getVector($.ALBEDOCOLOR);a.scale(this._albedoColor,e,t),this._albedoIntensity=e,this._shaderValues.setVector($.ALBEDOCOLOR,t)}}get _MainTex_STX(){return this._shaderValues.getVector($.TILINGOFFSET).x}set _MainTex_STX(e){var t=this._shaderValues.getVector($.TILINGOFFSET);t.x=e,this.tilingOffset=t}get _MainTex_STY(){return this._shaderValues.getVector($.TILINGOFFSET).y}set _MainTex_STY(e){var t=this._shaderValues.getVector($.TILINGOFFSET);t.y=e,this.tilingOffset=t}get _MainTex_STZ(){return this._shaderValues.getVector($.TILINGOFFSET).z}set _MainTex_STZ(e){var t=this._shaderValues.getVector($.TILINGOFFSET);t.z=e,this.tilingOffset=t}get _MainTex_STW(){return this._shaderValues.getVector($.TILINGOFFSET).w}set _MainTex_STW(e){var t=this._shaderValues.getVector($.TILINGOFFSET);t.w=e,this.tilingOffset=t}get _Cutoff(){return this.alphaTestValue}set _Cutoff(e){this.alphaTestValue=e}get albedoColorR(){return this._ColorR}set albedoColorR(e){this._ColorR=e}get albedoColorG(){return this._ColorG}set albedoColorG(e){this._ColorG=e}get albedoColorB(){return this._ColorB}set albedoColorB(e){this._ColorB=e}get albedoColorA(){return this._ColorA}set albedoColorA(e){this._ColorA=e}get albedoColor(){return this._albedoColor}set albedoColor(e){var t=this._shaderValues.getVector($.ALBEDOCOLOR);a.scale(e,this._albedoIntensity,t),this._albedoColor=e,this._shaderValues.setVector($.ALBEDOCOLOR,t)}get albedoIntensity(){return this._albedoIntensity}set albedoIntensity(e){this._AlbedoIntensity=e}get albedoTexture(){return this._shaderValues.getTexture($.ALBEDOTEXTURE)}set albedoTexture(e){e?this._shaderValues.addDefine($.SHADERDEFINE_ALBEDOTEXTURE):this._shaderValues.removeDefine($.SHADERDEFINE_ALBEDOTEXTURE),this._shaderValues.setTexture($.ALBEDOTEXTURE,e)}get tilingOffsetX(){return this._MainTex_STX}set tilingOffsetX(e){this._MainTex_STX=e}get tilingOffsetY(){return this._MainTex_STY}set tilingOffsetY(e){this._MainTex_STY=e}get tilingOffsetZ(){return this._MainTex_STZ}set tilingOffsetZ(e){this._MainTex_STZ=e}get tilingOffsetW(){return this._MainTex_STW}set tilingOffsetW(e){this._MainTex_STW=e}get tilingOffset(){return this._shaderValues.getVector($.TILINGOFFSET)}set tilingOffset(e){e&&(1!=e.x||1!=e.y||0!=e.z||0!=e.w)?this._shaderValues.addDefine($.SHADERDEFINE_TILINGOFFSET):this._shaderValues.removeDefine($.SHADERDEFINE_TILINGOFFSET),this._shaderValues.setVector($.TILINGOFFSET,e)}get enableVertexColor(){return this._enableVertexColor}set enableVertexColor(e){this._enableVertexColor=e,e?this._shaderValues.addDefine($.SHADERDEFINE_ENABLEVERTEXCOLOR):this._shaderValues.removeDefine($.SHADERDEFINE_ENABLEVERTEXCOLOR)}set renderMode(e){switch(e){case $.RENDERMODE_OPAQUE:this.alphaTest=!1,this.renderQueue=W.RENDERQUEUE_OPAQUE,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS;break;case $.RENDERMODE_CUTOUT:this.renderQueue=W.RENDERQUEUE_ALPHATEST,this.alphaTest=!0,this.depthWrite=!0,this.cull=X.CULL_BACK,this.blend=X.BLEND_DISABLE,this.depthTest=X.DEPTHTEST_LESS;break;case $.RENDERMODE_TRANSPARENT:this.renderQueue=W.RENDERQUEUE_TRANSPARENT,this.alphaTest=!1,this.depthWrite=!1,this.cull=X.CULL_BACK,this.blend=X.BLEND_ENABLE_ALL,this.blendSrc=X.BLENDPARAM_SRC_ALPHA,this.blendDst=X.BLENDPARAM_ONE_MINUS_SRC_ALPHA,this.depthTest=X.DEPTHTEST_LESS;break;default:throw new Error("UnlitMaterial : renderMode value error.")}}get depthWrite(){return this._shaderValues.getBool($.DEPTH_WRITE)}set depthWrite(e){this._shaderValues.setBool($.DEPTH_WRITE,e)}get cull(){return this._shaderValues.getInt($.CULL)}set cull(e){this._shaderValues.setInt($.CULL,e)}get blend(){return this._shaderValues.getInt($.BLEND)}set blend(e){this._shaderValues.setInt($.BLEND,e)}get blendSrc(){return this._shaderValues.getInt($.BLEND_SRC)}set blendSrc(e){this._shaderValues.setInt($.BLEND_SRC,e)}get blendDst(){return this._shaderValues.getInt($.BLEND_DST)}set blendDst(e){this._shaderValues.setInt($.BLEND_DST,e)}get depthTest(){return this._shaderValues.getInt($.DEPTH_TEST)}set depthTest(e){this._shaderValues.setInt($.DEPTH_TEST,e)}clone(){var e=new $;return this.cloneTo(e),e}}$.RENDERMODE_OPAQUE=0,$.RENDERMODE_CUTOUT=1,$.RENDERMODE_TRANSPARENT=2,$.RENDERMODE_ADDTIVE=3,$.ALBEDOTEXTURE=F.propertyNameToID("u_AlbedoTexture"),$.ALBEDOCOLOR=F.propertyNameToID("u_AlbedoColor"),$.TILINGOFFSET=F.propertyNameToID("u_TilingOffset"),$.CULL=F.propertyNameToID("s_Cull"),$.BLEND=F.propertyNameToID("s_Blend"),$.BLEND_SRC=F.propertyNameToID("s_BlendSrc"),$.BLEND_DST=F.propertyNameToID("s_BlendDst"),$.DEPTH_TEST=F.propertyNameToID("s_DepthTest"),$.DEPTH_WRITE=F.propertyNameToID("s_DepthWrite");class ee extends W{constructor(){super(),this.setShaderName("WaterPrimary"),this._shaderValues.setVector(ee.HORIZONCOLOR,new a(.172,.463,.435,0)),this._shaderValues.setNumber(ee.WAVESCALE,.15),this._shaderValues.setVector(ee.WAVESPEED,new a(19,9,-16,-7))}static __initDefine__(){ee.SHADERDEFINE_MAINTEXTURE=F.getDefineByName("MAINTEXTURE"),ee.SHADERDEFINE_NORMALTEXTURE=F.getDefineByName("NORMALTEXTURE")}get horizonColor(){return this._shaderValues.getVector(ee.HORIZONCOLOR)}set horizonColor(e){this._shaderValues.setVector(ee.HORIZONCOLOR,e)}get mainTexture(){return this._shaderValues.getTexture(ee.MAINTEXTURE)}set mainTexture(e){e?this._shaderValues.addDefine(ee.SHADERDEFINE_MAINTEXTURE):this._shaderValues.removeDefine(ee.SHADERDEFINE_MAINTEXTURE),this._shaderValues.setTexture(ee.MAINTEXTURE,e)}get normalTexture(){return this._shaderValues.getTexture(ee.NORMALTEXTURE)}set normalTexture(e){e?this._shaderValues.addDefine(ee.SHADERDEFINE_NORMALTEXTURE):this._shaderValues.removeDefine(ee.SHADERDEFINE_NORMALTEXTURE),this._shaderValues.setTexture(ee.NORMALTEXTURE,e)}get waveScale(){return this._shaderValues.getNumber(ee.WAVESCALE)}set waveScale(e){this._shaderValues.setNumber(ee.WAVESCALE,e)}get waveSpeed(){return this._shaderValues.getVector(ee.WAVESPEED)}set waveSpeed(e){this._shaderValues.setVector(ee.WAVESPEED,e)}clone(){var e=new ee;return this.cloneTo(e),e}}ee.HORIZONCOLOR=F.propertyNameToID("u_HorizonColor"),ee.MAINTEXTURE=F.propertyNameToID("u_MainTexture"),ee.NORMALTEXTURE=F.propertyNameToID("u_NormalTexture"),ee.WAVESCALE=F.propertyNameToID("u_WaveScale"),ee.WAVESPEED=F.propertyNameToID("u_WaveSpeed");class te{constructor(e=1,t=1,r=1,i=1){this.r=e,this.g=t,this.b=r,this.a=i}static gammaToLinearSpace(e){return e<=.04045?e/12.92:e<1?Math.pow((e+.055)/1.055,2.4):Math.pow(e,2.4)}static linearToGammaSpace(e){return e<=0?0:e<=.0031308?12.92*e:e<=1?1.055*Math.pow(e,.41666)-.055:Math.pow(e,.41666)}toLinear(e){e.r=te.gammaToLinearSpace(this.r),e.g=te.gammaToLinearSpace(this.g),e.b=te.gammaToLinearSpace(this.b)}toGamma(e){e.r=te.linearToGammaSpace(this.r),e.g=te.linearToGammaSpace(this.g),e.b=te.linearToGammaSpace(this.b)}cloneTo(e){var t=e;t.r=this.r,t.g=this.g,t.b=this.b,t.a=this.a}clone(){var e=new te;return this.cloneTo(e),e}forNativeElement(){}}te.RED=new te(1,0,0,1),te.GREEN=new te(0,1,0,1),te.BLUE=new te(0,0,1,1),te.CYAN=new te(0,1,1,1),te.YELLOW=new te(1,.92,.016,1),te.MAGENTA=new te(1,0,1,1),te.GRAY=new te(.5,.5,.5,1),te.WHITE=new te(1,1,1,1),te.BLACK=new te(0,0,0,1);class re{constructor(){this._batchRenderElementPool=[]}static _registerManager(e){re._managers.push(e)}_clear(){this._batchRenderElementPoolIndex=0}_getBatchRenderElementFromPool(){throw"StaticBatch:must override this function."}dispose(){}}re._managers=[];class ie extends t.EventDispatcher{constructor(e){super(),this._localPosition=new n(0,0,0),this._localRotation=new u(0,0,0,1),this._localScale=new n(1,1,1),this._localRotationEuler=new n(0,0,0),this._localMatrix=new p,this._position=new n(0,0,0),this._rotation=new u(0,0,0,1),this._scale=new n(1,1,1),this._rotationEuler=new n(0,0,0),this._worldMatrix=new p,this._children=null,this._parent=null,this._dummy=null,this._transformFlag=0,this._owner=e,this._children=[],this._setTransformFlag(ie.TRANSFORM_LOCALQUATERNION|ie.TRANSFORM_LOCALEULER|ie.TRANSFORM_LOCALMATRIX,!1),this._setTransformFlag(ie.TRANSFORM_WORLDPOSITION|ie.TRANSFORM_WORLDQUATERNION|ie.TRANSFORM_WORLDEULER|ie.TRANSFORM_WORLDSCALE|ie.TRANSFORM_WORLDMATRIX,!0)}get _isFrontFaceInvert(){var e=this.getWorldLossyScale(),t=e.x<0;return e.y<0&&(t=!t),e.z<0&&(t=!t),t}get owner(){return this._owner}get worldNeedUpdate(){return this._getTransformFlag(ie.TRANSFORM_WORLDMATRIX)}get localPositionX(){return this._localPosition.x}set localPositionX(e){this._localPosition.x=e,this.localPosition=this._localPosition}get localPositionY(){return this._localPosition.y}set localPositionY(e){this._localPosition.y=e,this.localPosition=this._localPosition}get localPositionZ(){return this._localPosition.z}set localPositionZ(e){this._localPosition.z=e,this.localPosition=this._localPosition}get localPosition(){return this._localPosition}set localPosition(e){this._localPosition!==e&&e.cloneTo(this._localPosition),this._setTransformFlag(ie.TRANSFORM_LOCALMATRIX,!0),this._onWorldPositionTransform()}get localRotationX(){return this.localRotation.x}set localRotationX(e){this._localRotation.x=e,this.localRotation=this._localRotation}get localRotationY(){return this.localRotation.y}set localRotationY(e){this._localRotation.y=e,this.localRotation=this._localRotation}get localRotationZ(){return this.localRotation.z}set localRotationZ(e){this._localRotation.z=e,this.localRotation=this._localRotation}get localRotationW(){return this.localRotation.w}set localRotationW(e){this._localRotation.w=e,this.localRotation=this._localRotation}get localRotation(){if(this._getTransformFlag(ie.TRANSFORM_LOCALQUATERNION)){var e=this._localRotationEuler;u.createFromYawPitchRoll(e.y/ie._angleToRandin,e.x/ie._angleToRandin,e.z/ie._angleToRandin,this._localRotation),this._setTransformFlag(ie.TRANSFORM_LOCALQUATERNION,!1)}return this._localRotation}set localRotation(e){this._localRotation!==e&&e.cloneTo(this._localRotation),this._localRotation.normalize(this._localRotation),this._setTransformFlag(ie.TRANSFORM_LOCALEULER|ie.TRANSFORM_LOCALMATRIX,!0),this._setTransformFlag(ie.TRANSFORM_LOCALQUATERNION,!1),this._onWorldRotationTransform()}get localScaleX(){return this._localScale.x}set localScaleX(e){this._localScale.x=e,this.localScale=this._localScale}get localScaleY(){return this._localScale.y}set localScaleY(e){this._localScale.y=e,this.localScale=this._localScale}get localScaleZ(){return this._localScale.z}set localScaleZ(e){this._localScale.z=e,this.localScale=this._localScale}get localScale(){return this._localScale}set localScale(e){this._localScale!==e&&e.cloneTo(this._localScale),this._setTransformFlag(ie.TRANSFORM_LOCALMATRIX,!0),this._onWorldScaleTransform()}get localRotationEulerX(){return this.localRotationEuler.x}set localRotationEulerX(e){this._localRotationEuler.x=e,this.localRotationEuler=this._localRotationEuler}get localRotationEulerY(){return this.localRotationEuler.y}set localRotationEulerY(e){this._localRotationEuler.y=e,this.localRotationEuler=this._localRotationEuler}get localRotationEulerZ(){return this.localRotationEuler.z}set localRotationEulerZ(e){this._localRotationEuler.z=e,this.localRotationEuler=this._localRotationEuler}get localRotationEuler(){if(this._getTransformFlag(ie.TRANSFORM_LOCALEULER)){this._localRotation.getYawPitchRoll(ie._tempVector30);var e=ie._tempVector30,t=this._localRotationEuler;t.x=e.y*ie._angleToRandin,t.y=e.x*ie._angleToRandin,t.z=e.z*ie._angleToRandin,this._setTransformFlag(ie.TRANSFORM_LOCALEULER,!1)}return this._localRotationEuler}set localRotationEuler(e){this._localRotationEuler!==e&&e.cloneTo(this._localRotationEuler),this._setTransformFlag(ie.TRANSFORM_LOCALEULER,!1),this._setTransformFlag(ie.TRANSFORM_LOCALQUATERNION|ie.TRANSFORM_LOCALMATRIX,!0),this._onWorldRotationTransform()}get localMatrix(){return this._getTransformFlag(ie.TRANSFORM_LOCALMATRIX)&&(p.createAffineTransformation(this._localPosition,this.localRotation,this._localScale,this._localMatrix),this._setTransformFlag(ie.TRANSFORM_LOCALMATRIX,!1)),this._localMatrix}set localMatrix(e){this._localMatrix!==e&&e.cloneTo(this._localMatrix),this._localMatrix.decomposeTransRotScale(this._localPosition,this._localRotation,this._localScale),this._setTransformFlag(ie.TRANSFORM_LOCALEULER,!0),this._setTransformFlag(ie.TRANSFORM_LOCALMATRIX,!1),this._onWorldTransform()}get position(){if(this._getTransformFlag(ie.TRANSFORM_WORLDPOSITION)){if(null!=this._parent){var e=this.worldMatrix.elements;this._position.x=e[12],this._position.y=e[13],this._position.z=e[14]}else this._localPosition.cloneTo(this._position);this._setTransformFlag(ie.TRANSFORM_WORLDPOSITION,!1)}return this._position}set position(e){if(null!=this._parent){var t=ie._tempMatrix0;this._parent.worldMatrix.invert(t),n.transformCoordinate(e,t,this._localPosition)}else e.cloneTo(this._localPosition);this.localPosition=this._localPosition,this._position!==e&&e.cloneTo(this._position),this._setTransformFlag(ie.TRANSFORM_WORLDPOSITION,!1)}get rotation(){return this._getTransformFlag(ie.TRANSFORM_WORLDQUATERNION)&&(null!=this._parent?u.multiply(this._parent.rotation,this.localRotation,this._rotation):this.localRotation.cloneTo(this._rotation),this._setTransformFlag(ie.TRANSFORM_WORLDQUATERNION,!1)),this._rotation}set rotation(e){null!=this._parent?(this._parent.rotation.invert(ie._tempQuaternion0),u.multiply(ie._tempQuaternion0,e,this._localRotation)):e.cloneTo(this._localRotation),this.localRotation=this._localRotation,e!==this._rotation&&e.cloneTo(this._rotation),this._setTransformFlag(ie.TRANSFORM_WORLDQUATERNION,!1)}get rotationEuler(){if(this._getTransformFlag(ie.TRANSFORM_WORLDEULER)){this.rotation.getYawPitchRoll(ie._tempVector30);var e=ie._tempVector30,t=this._rotationEuler;t.x=e.y*ie._angleToRandin,t.y=e.x*ie._angleToRandin,t.z=e.z*ie._angleToRandin,this._setTransformFlag(ie.TRANSFORM_WORLDEULER,!1)}return this._rotationEuler}set rotationEuler(e){u.createFromYawPitchRoll(e.y/ie._angleToRandin,e.x/ie._angleToRandin,e.z/ie._angleToRandin,this._rotation),this.rotation=this._rotation,this._rotationEuler!==e&&e.cloneTo(this._rotationEuler),this._setTransformFlag(ie.TRANSFORM_WORLDEULER,!1)}get worldMatrix(){return this._getTransformFlag(ie.TRANSFORM_WORLDMATRIX)&&(null!=this._parent?p.multiply(this._parent.worldMatrix,this.localMatrix,this._worldMatrix):this.localMatrix.cloneTo(this._worldMatrix),this._setTransformFlag(ie.TRANSFORM_WORLDMATRIX,!1)),this._worldMatrix}set worldMatrix(e){null===this._parent?e.cloneTo(this._localMatrix):(this._parent.worldMatrix.invert(this._localMatrix),p.multiply(this._localMatrix,e,this._localMatrix)),this.localMatrix=this._localMatrix,this._worldMatrix!==e&&e.cloneTo(this._worldMatrix),this._setTransformFlag(ie.TRANSFORM_WORLDMATRIX,!1)}_getScaleMatrix(){var e=ie._tempQuaternion0,t=ie._tempMatrix3x30,r=ie._tempMatrix3x31,i=ie._tempMatrix3x32;return d.createFromMatrix4x4(this.worldMatrix,r),this.rotation.invert(e),d.createRotationQuaternion(e,t),d.multiply(t,r,i),i}_setTransformFlag(e,t){t?this._transformFlag|=e:this._transformFlag&=~e}_getTransformFlag(e){return 0!=(this._transformFlag&e)}_setParent(e){if(this._parent!==e){if(this._parent){var t=this._parent._children,r=t.indexOf(this);t.splice(r,1)}e&&(e._children.push(this),e&&this._onWorldTransform()),this._parent=e}}_onWorldPositionRotationTransform(){if(!(this._getTransformFlag(ie.TRANSFORM_WORLDMATRIX)&&this._getTransformFlag(ie.TRANSFORM_WORLDPOSITION)&&this._getTransformFlag(ie.TRANSFORM_WORLDQUATERNION)&&this._getTransformFlag(ie.TRANSFORM_WORLDEULER))){this._setTransformFlag(ie.TRANSFORM_WORLDMATRIX|ie.TRANSFORM_WORLDPOSITION|ie.TRANSFORM_WORLDQUATERNION|ie.TRANSFORM_WORLDEULER,!0),this.event(t.Event.TRANSFORM_CHANGED,this._transformFlag);for(var e=0,r=this._children.length;e=0&&e<=30))throw new Error("Layer value must be 0-30.");this._layer=e}}get url(){return this._url}get isStatic(){return this._isStatic}get transform(){return this._transform}_setCreateURL(e){this._url=t.URL.formatURL(e)}_changeAnimatorsToLinkSprite3D(e,t,r){var i=this.getComponent(O);if(i&&(i.avatar||e._changeAnimatorToLinkSprite3DNoAvatar(i,t,r)),this._parent&&this._parent instanceof ae){r.unshift(this._parent.name);var a=this._parent;a._hierarchyAnimator&&a._changeAnimatorsToLinkSprite3D(e,t,r)}}_setHierarchyAnimator(e,t){this._changeHierarchyAnimator(e),this._changeAnimatorAvatar(e.avatar);for(var r=0,i=this._children.length;r0){for(var i=0;i0;)r--;if(t1){var i=this._partition(e,t,r),a=i-1;t0&&l._quickSort(0,f-1),(f=_.elements.length)>0&&_._quickSort(0,f-1)}static renderObjectCullingNative(e,t,r,i,a,s){var o,l,_,h,c=t._opaqueQueue,d=t._transparentQueue;c.clear(),d.clear();var u=se._managers;for(o=0,l=u.length;o0&&c._quickSort(0,S-1),(S=d.elements.length)>0&&d._quickSort(0,S-1)}static cullingNative(e,r,i,a,n){return t.LayaGL.instance.culling(e,r,i,a,n)}}oe._tempVector3=new n,oe._tempColor0=new te,oe.debugFrustumCulling=!1;class le{constructor(){this.updateMark=-1,this.indexInList=-1,this.batched=!1}}class _e{constructor(){this._destroyed=!1}get destroyed(){return this._destroyed}_getType(){throw"GeometryElement:must override it."}_prepareRender(e){return!0}_render(e){throw"GeometryElement:must override it."}destroy(){this._destroyed||(this._destroyed=!0)}}_e._typeCounter=0;class he extends t.Buffer{constructor(e,r,i=!1){super(),this._vertexDeclaration=null,this._float32Reader=null;var a=t.LayaGL.instance;this._bufferUsage=r,this._bufferType=a.ARRAY_BUFFER,this._canRead=i,this._byteLength=e,this.bind(),a.bufferData(this._bufferType,this._byteLength,this._bufferUsage),i&&(this._buffer=new Uint8Array(e),this._float32Reader=new Float32Array(this._buffer.buffer))}get vertexDeclaration(){return this._vertexDeclaration}set vertexDeclaration(e){this._vertexDeclaration=e}get canRead(){return this._canRead}bind(){if(t.Buffer._bindedVertexBuffer!==this._glBuffer){var e=t.LayaGL.instance;return e.bindBuffer(e.ARRAY_BUFFER,this._glBuffer),t.Buffer._bindedVertexBuffer=this._glBuffer,!0}return!1}setData(e,r=0,i=0,a=Number.MAX_SAFE_INTEGER){if(this.bind(),0!==i||a!==Number.MAX_SAFE_INTEGER){var n=new Uint8Array(e,i,a);t.LayaGL.instance.bufferSubData(this._bufferType,r,n),this._canRead&&this._buffer.set(n,r)}else t.LayaGL.instance.bufferSubData(this._bufferType,r,e),this._canRead&&this._buffer.set(new Uint8Array(e),r)}getUint8Data(){if(this._canRead)return this._buffer;throw new Error("Can't read data from VertexBuffer with only write flag!")}getFloat32Data(){if(this._canRead)return this._float32Reader;throw new Error("Can't read data from VertexBuffer with only write flag!")}markAsUnreadbale(){this._canRead=!1,this._buffer=null,this._float32Reader=null}destroy(){super.destroy(),this._buffer=null,this._float32Reader=null,this._vertexDeclaration=null}}he.DATATYPE_FLOAT32ARRAY=0,he.DATATYPE_UINT8ARRAY=1;class ce{static __init__(){var e=t.LayaGL.instance;ce._elementInfos={single:[1,e.FLOAT,0],vector2:[2,e.FLOAT,0],vector3:[3,e.FLOAT,0],vector4:[4,e.FLOAT,0],color:[4,e.FLOAT,0],byte4:[4,e.UNSIGNED_BYTE,0],short2:[2,e.FLOAT,0],short4:[4,e.FLOAT,0],normalizedshort2:[2,e.FLOAT,0],normalizedshort4:[4,e.FLOAT,0],halfvector2:[2,e.FLOAT,0],halfvector4:[4,e.FLOAT,0]}}static getElementInfos(e){var t=ce._elementInfos[e];if(t)return t;throw"VertexElementFormat: this vertexElementFormat is not implement."}}ce.Single="single",ce.Vector2="vector2",ce.Vector3="vector3",ce.Vector4="vector4",ce.Color="color",ce.Byte4="byte4",ce.Short2="short2",ce.Short4="short4",ce.NormalizedShort2="normalizedshort2",ce.NormalizedShort4="normalizedshort4",ce.HalfVector2="halfvector2",ce.HalfVector4="halfvector4";class de{constructor(e,t){this._id=++de._uniqueIDCounter,this._vertexElementsDic={},this._vertexStride=e,this._vertexElements=t;var r=t.length;this._shaderValues=new B(null);for(var i=0;il*l))return!1;var _=n.dot(s,t);return!(Math.cos(i)*Math.sqrt(o-_*_)-_*Math.sin(i)>l||_>l+r||_<-l)}_placePointLightToClusters(e,t){for(var r=this._clusterDatas,i=this._updateMark,a=t.zMin,n=t.zMax;at||o<=e)return!1;var l=this._depthSliceParam;return a.zMin=Math.floor(Math.log2(Math.max(s,e))*l.x-l.y),a.zMax=Math.min(Math.ceil(Math.log2(o)*l.x-l.y),this._zSlices),!0}_shrinkSpotLightZPerspective(e,t,r,i,a,n,s){var o=i.x,l=i.y,_=i.z,h=Math.tan(n)*a,c=r.x,d=r.y,u=r.z,f=o-c,m=l-d,E=_-u,T=f*f+m*m+E*E,p=Math.sqrt(1-E*E/T),g=Math.max(Math.min(u,_-p*h),r.z-a),S=Math.min(Math.max(u,_+p*h),r.z+a);if(g>t||S<=e)return!1;var v=this._depthSliceParam;return s.zMin=Math.floor(Math.log2(Math.max(g,e))*v.x-v.y),s.zMax=Math.min(Math.ceil(Math.log2(S)*v.x-v.y),this._zSlices),!0}_shrinkSphereLightByBoundOrth(e,t,r,i,a,n,s){var o=a.z,l=o-n,_=o+n;if(l>i||_<=r)return!1;var h=a.x,c=h-n,d=h+n;if(c>e||d<=-e)return!1;var u=a.y,f=u-n,m=u+n;if(f>t||m<=-t)return!1;var E=this._xSlices,T=this._ySlices,p=this._depthSliceParam,g=2*e/E,S=2*t/T;return s.xMin=Math.max(Math.floor((c+e)/g),0),s.xMax=Math.min(Math.ceil((d+e)/g),E),s.yMin=Math.max(Math.floor((t-m)/S),0),s.yMax=Math.min(Math.ceil((t-f)/S),T),s.zMin=Math.floor(Math.log2(Math.max(l,r))*p.x-p.y),s.zMax=Math.min(Math.ceil(Math.log2(_)*p.x-p.y),this._zSlices),!0}_shrinkSpotLightByBoundOrth(e,t,r,i,a,n,s,o,l){var _=n.x,h=n.y,c=n.z,d=Math.tan(o)*s,u=a.x,f=a.y,m=a.z,E=_-u,T=h-f,p=c-m,g=E*E+T*T+p*p,S=Math.sqrt(1-p*p/g),v=Math.max(Math.min(m,c-S*d),a.z-s),R=Math.min(Math.max(m,c+S*d),a.z+s);if(v>i||R<=r)return!1;var I=Math.sqrt(1-E*E/g),x=Math.max(Math.min(u,_-I*d),a.x-s),A=Math.min(Math.max(u,_+I*d),a.x+s);if(x>e||A<=-e)return!1;var D=Math.sqrt(1-T*T/g),M=Math.max(Math.min(f,h-D*d),a.y-s),L=Math.min(Math.max(f,h+D*d),a.y+s);if(M>t||L<=-t)return!1;var C=this._xSlices,y=this._ySlices,O=this._depthSliceParam,N=2*e/C,P=2*t/y;return l.xMin=Math.max(Math.floor((x+e)/N),0),l.xMax=Math.min(Math.ceil((A+e)/N),C),l.yMin=Math.max(Math.floor((t-L)/P),0),l.yMax=Math.min(Math.ceil((t-M)/P),y),l.zMin=Math.floor(Math.log2(Math.max(v,r))*O.x-O.y),l.zMax=Math.min(Math.ceil(Math.log2(R)*O.x-O.y),this._zSlices),!0}_shrinkXYByRadiusPerspective(e,t,r,i,a){var n,s,o,l,_,h=e.x,c=e.y,d=e.z,u=this._ySlices+1;for(_=0;_0){for(var g=this._xSlices,S=this._ySlices,v=this._zSlices,R=g*S*4,I=R*v,x=this._clusterPixels,A=x.length,D=this._clusterDatas,M=this._updateMark,L=!0,C=0;Co&&(u+=(o-h)*(o-h)),cl&&(u+=(l-c)*(l-c)),d_&&(u+=(_-d)*(_-d)),Math.sqrt(u)}static distanceBoxToBox(e,t){var r,i=e.min,a=i.x,n=i.y,s=i.z,o=e.max,l=o.x,_=o.y,h=o.z,c=t.min,d=c.x,u=c.y,f=c.z,m=t.max,E=m.x,T=m.y,p=m.z,g=0;return a>E?g+=(r=a-E)*r:d>l&&(g+=(r=d-l)*r),n>T?g+=(r=n-T)*r:u>_&&(g+=(r=u-_)*r),s>p?g+=(r=s-p)*r:f>h&&(g+=(r=f-h)*r),Math.sqrt(g)}static distanceSphereToPoint(e,t){var r=Math.sqrt(n.distanceSquared(e.center,t));return r-=e.radius,Math.max(r,0)}static distanceSphereToSphere(e,t){var r=Math.sqrt(n.distanceSquared(e.center,t.center));return r-=e.radius+t.radius,Math.max(r,0)}static intersectsRayAndTriangleRD(e,t,i,a,n){var s=e.origin,o=s.x,l=s.y,_=s.z,h=e.direction,c=h.x,d=h.y,u=h.z,f=t.x,m=t.y,E=t.z,T=i.x,p=i.y,g=i.z,S=a.x,v=a.y,R=a.z,I=ve._tempV30.x,x=ve._tempV30.y,A=ve._tempV30.z;I=T-f,x=p-m,A=g-E;var D=ve._tempV31.x,M=ve._tempV31.y,L=ve._tempV31.z;D=S-f,M=v-m,L=R-E;var C=ve._tempV32.x,y=ve._tempV32.y,O=ve._tempV32.z,N=I*(C=d*L-u*M)+x*(y=u*D-c*L)+A*(O=c*M-d*D);if(r.isZero(N))return!1;var P=1/N,w=ve._tempV33.x,V=ve._tempV33.y,b=ve._tempV33.z,F=(w=o-f)*C+(V=l-m)*y+(b=_-E)*O;if((F*=P)<0||F>1)return!1;var B=ve._tempV34.x,U=ve._tempV34.y,G=ve._tempV34.z,z=c*(B=V*A-b*x)+d*(U=b*I-w*A)+u*(G=w*x-V*I);if((z*=P)<0||F+z>1)return!1;var H=D*B+M*U+L*G;return!((H*=P)<0)}static intersectsRayAndTriangleRP(e,t,r,i,a){return ve.intersectsRayAndTriangleRD(e,t,r,i,void 0)?(n.scale(e.direction,void 0,ve._tempV30),n.add(e.origin,ve._tempV30,a),!0):(a=n._ZERO,!1)}static intersectsRayAndPoint(e,t){n.subtract(e.origin,t,ve._tempV30);var i=n.dot(ve._tempV30,e.direction),a=n.dot(ve._tempV30,ve._tempV30)-r.zeroTolerance;return!(a>0&&i>0)&&!(i*i-a<0)}static intersectsRayAndRay(e,t,i){var a=e.origin,s=a.x,o=a.y,l=a.z,_=e.direction,h=_.x,c=_.y,d=_.z,u=t.origin,f=u.x,m=u.y,E=u.z,T=t.direction,p=T.x,g=T.y,S=T.z;n.cross(_,T,ve._tempV30);var v=ve._tempV30,R=n.scalarLength(ve._tempV30);if(r.isZero(R)&&r.nearEqual(f,s)&&r.nearEqual(m,o)&&r.nearEqual(E,l))return!0;R*=R;var I=f-s,x=m-o,A=E-l,D=p,M=g,L=S,C=v.x,y=v.y,O=v.z,N=I*M*O+x*L*C+A*D*y-I*L*y-x*D*O-A*M*C;D=h,M=c,L=d;var P=N/R;n.scale(_,P,ve._tempV30),n.scale(T,P,ve._tempV31),n.add(a,ve._tempV30,ve._tempV32),n.add(u,ve._tempV31,ve._tempV33);var w=ve._tempV32,V=ve._tempV33;return!!(r.nearEqual(V.x,w.x)&&r.nearEqual(V.y,w.y)&&r.nearEqual(V.z,w.z))}static intersectsPlaneAndTriangle(e,t,r,i){var a=ve.intersectsPlaneAndPoint(e,t),n=ve.intersectsPlaneAndPoint(e,r),s=ve.intersectsPlaneAndPoint(e,i);return a==pe.PlaneIntersectionType_Front&&n==pe.PlaneIntersectionType_Front&&s==pe.PlaneIntersectionType_Front?pe.PlaneIntersectionType_Front:a==pe.PlaneIntersectionType_Back&&n==pe.PlaneIntersectionType_Back&&s==pe.PlaneIntersectionType_Back?pe.PlaneIntersectionType_Back:pe.PlaneIntersectionType_Intersecting}static intersectsRayAndPlaneRD(e,t,i){var a=t.normal,s=n.dot(a,e.direction);if(r.isZero(s))return 0,!1;var o=n.dot(a,e.origin);return!((-t.distance-o)/s<0)||(0,!1)}static intersectsRayAndPlaneRP(e,t,r){return!!ve.intersectsRayAndPlaneRD(e,t,void 0)&&(n.scale(e.direction,void 0,ve._tempV30),n.add(e.origin,ve._tempV30,ve._tempV31),!0)}static intersectsRayAndBoxRD(e,t){var i=e.origin,a=i.x,n=i.y,s=i.z,o=e.direction,l=o.x,_=o.y,h=o.z,c=t.min,d=c.x,u=c.y,f=c.z,m=t.max,E=m.x,T=m.y,p=m.z,g=0,S=r.MaxValue;if(r.isZero(l)){if(aE)return-1}else{var v=1/l,R=(d-a)*v,I=(E-a)*v;if(R>I){var x=R;R=I,I=x}if((g=Math.max(R,g))>(S=Math.min(I,S)))return-1}if(r.isZero(_)){if(nT)return-1}else{var A=1/_,D=(u-n)*A,M=(T-n)*A;if(D>M){var L=D;D=M,M=L}if((g=Math.max(D,g))>(S=Math.min(M,S)))return-1}if(r.isZero(h)){if(sp)return-1}else{var C=1/h,y=(f-s)*C,O=(p-s)*C;if(y>O){var N=y;y=O,O=N}if((g=Math.max(y,g))>(S=Math.min(O,S)))return-1}return g}static intersectsRayAndBoxRP(e,t,r){var i=ve.intersectsRayAndBoxRD(e,t);return-1===i?(n._ZERO.cloneTo(r),i):(n.scale(e.direction,i,ve._tempV30),n.add(e.origin,ve._tempV30,ve._tempV31),ve._tempV31.cloneTo(r),i)}static intersectsRayAndSphereRD(e,t){var r=t.radius;n.subtract(e.origin,t.center,ve._tempV30);var i=n.dot(ve._tempV30,e.direction),a=n.dot(ve._tempV30,ve._tempV30)-r*r;if(a>0&&i>0)return-1;var s=i*i-a;if(s<0)return-1;var o=-i-Math.sqrt(s);return o<0&&(o=0),o}static intersectsRayAndSphereRP(e,t,r){var i=ve.intersectsRayAndSphereRD(e,t);return-1===i?(n._ZERO.cloneTo(r),i):(n.scale(e.direction,i,ve._tempV30),n.add(e.origin,ve._tempV30,ve._tempV31),ve._tempV31.cloneTo(r),i)}static intersectsSphereAndTriangle(e,t,r,i){var a=e.center,s=e.radius;return ve.closestPointPointTriangle(a,t,r,i,ve._tempV30),n.subtract(ve._tempV30,a,ve._tempV31),n.dot(ve._tempV31,ve._tempV31)<=s*s}static intersectsPlaneAndPoint(e,t){var r=n.dot(e.normal,t)+e.distance;return r>0?pe.PlaneIntersectionType_Front:r<0?pe.PlaneIntersectionType_Back:pe.PlaneIntersectionType_Intersecting}static intersectsPlaneAndPlane(e,t){n.cross(e.normal,t.normal,ve._tempV30);var i=n.dot(ve._tempV30,ve._tempV30);return!r.isZero(i)}static intersectsPlaneAndPlaneRL(e,t,i){var a=e.normal,s=t.normal;n.cross(a,s,ve._tempV34);var o=n.dot(ve._tempV34,ve._tempV34);return!r.isZero(o)&&(n.scale(s,e.distance,ve._tempV30),n.scale(a,t.distance,ve._tempV31),n.subtract(ve._tempV30,ve._tempV31,ve._tempV32),n.cross(ve._tempV32,ve._tempV34,ve._tempV33),n.normalize(ve._tempV34,ve._tempV34),!0)}static intersectsPlaneAndBox(e,t){var r=e.distance,i=e.normal,a=i.x,s=i.y,o=i.z,l=t.min,_=l.x,h=l.y,c=l.z,d=t.max,u=d.x,f=d.y,m=d.z;ve._tempV30.x=a>0?_:u,ve._tempV30.y=s>0?h:f,ve._tempV30.z=o>0?c:m,ve._tempV31.x=a>0?u:_,ve._tempV31.y=s>0?f:h,ve._tempV31.z=o>0?m:c;var E=n.dot(i,ve._tempV30);return E+r>0?pe.PlaneIntersectionType_Front:(E=n.dot(i,ve._tempV31))+r<0?pe.PlaneIntersectionType_Back:pe.PlaneIntersectionType_Intersecting}static intersectsPlaneAndSphere(e,t){var r=t.radius,i=n.dot(e.normal,t.center)+e.distance;return i>r?pe.PlaneIntersectionType_Front:i<-r?pe.PlaneIntersectionType_Back:pe.PlaneIntersectionType_Intersecting}static intersectsBoxAndBox(e,t){var r=e.min,i=e.max,a=t.min,n=t.max;return!(r.x>n.x||a.x>i.x)&&(!(r.y>n.y||a.y>i.y)&&!(r.z>n.z||a.z>i.z))}static intersectsBoxAndSphere(e,t){var r=t.center,i=t.radius;return n.Clamp(r,e.min,e.max,ve._tempV30),n.distanceSquared(r,ve._tempV30)<=i*i}static intersectsSphereAndSphere(e,t){var r=e.radius+t.radius;return n.distanceSquared(e.center,t.center)<=r*r}static boxContainsPoint(e,t){var r=e.min,i=e.max;return r.x<=t.x&&i.x>=t.x&&r.y<=t.y&&i.y>=t.y&&r.z<=t.z&&i.z>=t.z?Se.Contains:Se.Disjoint}static boxContainsBox(e,t){var r=e.min,i=r.x,a=r.y,n=r.z,s=e.max,o=s.x,l=s.y,_=s.z,h=t.min,c=h.x,d=h.y,u=h.z,f=t.max,m=f.x,E=f.y,T=f.z;return om?Se.Disjoint:lE?Se.Disjoint:_T?Se.Disjoint:i<=c&&m<=o&&a<=d&&E<=l&&n<=u&&T<=_?Se.Contains:Se.Intersects}static boxContainsSphere(e,t){var r=e.min,i=r.x,a=r.y,s=r.z,o=e.max,l=o.x,_=o.y,h=o.z,c=t.center,d=c.x,u=c.y,f=c.z,m=t.radius;return n.Clamp(c,r,o,ve._tempV30),n.distanceSquared(c,ve._tempV30)>m*m?Se.Disjoint:i+m<=d&&d<=l-m&&l-i>m&&a+m<=u&&u<=_-m&&_-a>m&&s+m<=f&&f<=h-m&&h-s>m?Se.Contains:Se.Intersects}static sphereContainsPoint(e,t){return n.distanceSquared(t,e.center)<=e.radius*e.radius?Se.Contains:Se.Disjoint}static sphereContainsTriangle(e,t,r,i){var a=ve.sphereContainsPoint(e,t),n=ve.sphereContainsPoint(e,r),s=ve.sphereContainsPoint(e,i);return a==Se.Contains&&n==Se.Contains&&s==Se.Contains?Se.Contains:ve.intersectsSphereAndTriangle(e,t,r,i)?Se.Intersects:Se.Disjoint}static sphereContainsBox(e,t){var r=e.center,i=r.x,a=r.y,s=r.z,o=e.radius,l=t.min,_=l.x,h=l.y,c=l.z,d=t.max,u=d.x,f=d.y,m=d.z,E=ve._tempV30;E.x,E.y,E.z;if(!ve.intersectsBoxAndSphere(t,e))return Se.Disjoint;var T=o*o;return i-_,a-f,s-m,n.scalarLengthSquared(ve._tempV30)>T?Se.Intersects:(i-u,a-f,s-m,n.scalarLengthSquared(ve._tempV30)>T?Se.Intersects:(i-u,a-h,s-m,n.scalarLengthSquared(ve._tempV30)>T?Se.Intersects:(i-_,a-h,s-m,n.scalarLengthSquared(ve._tempV30)>T?Se.Intersects:(i-_,a-f,s-c,n.scalarLengthSquared(ve._tempV30)>T?Se.Intersects:(i-u,a-f,s-c,n.scalarLengthSquared(ve._tempV30)>T?Se.Intersects:(i-u,a-h,s-c,n.scalarLengthSquared(ve._tempV30)>T?Se.Intersects:(i-_,a-h,s-c,n.scalarLengthSquared(ve._tempV30)>T?Se.Intersects:Se.Contains)))))))}static sphereContainsSphere(e,t){var r=e.radius,i=t.radius,a=n.distance(e.center,t.center);return r+i=0&&_<=l)r.cloneTo(a);else{var d=s*_-l*o;if(d<=0&&s>=0&&l<=0){var u=s/(s-l);return n.scale(ve._tempV30,u,a),void n.add(t,a,a)}if(c>=0&&h<=c)i.cloneTo(a);else{var f=h*o-s*c;if(f<=0&&o>=0&&c<=0){var m=o/(o-c);return n.scale(ve._tempV31,m,a),void n.add(t,a,a)}var E=l*c-h*_;if(E<=0&&_-l>=0&&h-c>=0){var T=(_-l)/(_-l+(h-c));return n.subtract(i,r,a),n.scale(a,T,a),void n.add(r,a,a)}var p=1/(E+f+d),g=f*p,S=d*p;n.scale(ve._tempV30,g,ve._tempV35),n.scale(ve._tempV31,S,ve._tempV36),n.add(ve._tempV35,ve._tempV36,a),n.add(t,a,a)}}}static closestPointPlanePoint(e,t,r){var i=e.normal,a=n.dot(i,t)-e.distance;n.scale(i,a,ve._tempV30),n.subtract(t,ve._tempV30,r)}static closestPointBoxPoint(e,t,r){n.max(t,e.min,ve._tempV30),n.min(ve._tempV30,e.max,r)}static closestPointSpherePoint(e,t,r){var i=e.center;n.subtract(t,i,r),n.normalize(r,r),n.scale(r,e.radius,r),n.add(r,i,r)}static closestPointSphereSphere(e,t,r){var i=e.center;n.subtract(t.center,i,r),n.normalize(r,r),n.scale(r,e.radius,r),n.add(r,i,r)}}ve._tempV30=new n,ve._tempV31=new n,ve._tempV32=new n,ve._tempV33=new n,ve._tempV34=new n,ve._tempV35=new n,ve._tempV36=new n;class Re{constructor(e){this._matrix=e,this._near=new pe(new n),this._far=new pe(new n),this._left=new pe(new n),this._right=new pe(new n),this._top=new pe(new n),this._bottom=new pe(new n),Re._getPlanesFromMatrix(this._matrix,this._near,this._far,this._left,this._right,this._top,this._bottom)}get matrix(){return this._matrix}set matrix(e){this._matrix=e,Re._getPlanesFromMatrix(this._matrix,this._near,this._far,this._left,this._right,this._top,this._bottom)}get near(){return this._near}get far(){return this._far}get left(){return this._left}get right(){return this._right}get top(){return this._top}get bottom(){return this._bottom}equalsBoundFrustum(e){return this._matrix.equalsOtherMatrix(e.matrix)}equalsObj(e){if(e instanceof Re){var t=e;return this.equalsBoundFrustum(t)}return!1}getPlane(e){switch(e){case 0:return this._near;case 1:return this._far;case 2:return this._left;case 3:return this._right;case 4:return this._top;case 5:return this._bottom;default:return null}}static _getPlanesFromMatrix(e,t,r,i,a,n,s){var o=e.elements,l=o[0],_=o[1],h=o[2],c=o[3],d=o[4],u=o[5],f=o[6],m=o[7],E=o[8],T=o[9],p=o[10],g=o[11],S=o[12],v=o[13],R=o[14],I=o[15],x=t.normal;x.x=c+h,x.y=m+f,x.z=g+p,t.distance=I+R,t.normalize();var A=r.normal;A.x=c-h,A.y=m-f,A.z=g-p,r.distance=I-R,r.normalize();var D=i.normal;D.x=c+l,D.y=m+d,D.z=g+E,i.distance=I+S,i.normalize();var M=a.normal;M.x=c-l,M.y=m-d,M.z=g-E,a.distance=I-S,a.normalize();var L=n.normal;L.x=c-_,L.y=m-u,L.z=g-T,n.distance=I-v,n.normalize();var C=s.normal;C.x=c+_,C.y=m+u,C.z=g+T,s.distance=I+v,s.normalize()}static _get3PlaneInterPoint(e,t,r){var i=e.normal,a=t.normal,s=r.normal;n.cross(a,s,Re._tempV30),n.cross(s,i,Re._tempV31),n.cross(i,a,Re._tempV32);var o=n.dot(i,Re._tempV30),l=n.dot(a,Re._tempV31),_=n.dot(s,Re._tempV32);return n.scale(Re._tempV30,-e.distance/o,Re._tempV33),n.scale(Re._tempV31,-t.distance/l,Re._tempV34),n.scale(Re._tempV32,-r.distance/_,Re._tempV35),n.add(Re._tempV33,Re._tempV34,Re._tempV36),n.add(Re._tempV35,Re._tempV36,Re._tempV37),Re._tempV37}getCorners(e){Re._get3PlaneInterPoint(this._near,this._bottom,this._right).cloneTo(e[0]),Re._get3PlaneInterPoint(this._near,this._top,this._right).cloneTo(e[1]),Re._get3PlaneInterPoint(this._near,this._top,this._left).cloneTo(e[2]),Re._get3PlaneInterPoint(this._near,this._bottom,this._left).cloneTo(e[3]),Re._get3PlaneInterPoint(this._far,this._bottom,this._right).cloneTo(e[4]),Re._get3PlaneInterPoint(this._far,this._top,this._right).cloneTo(e[5]),Re._get3PlaneInterPoint(this._far,this._top,this._left).cloneTo(e[6]),Re._get3PlaneInterPoint(this._far,this._bottom,this._left).cloneTo(e[7])}containsPoint(e){for(var t=pe.PlaneIntersectionType_Front,r=pe.PlaneIntersectionType_Front,i=0;i<6;i++){switch(i){case 0:r=ve.intersectsPlaneAndPoint(this._near,e);break;case 1:r=ve.intersectsPlaneAndPoint(this._far,e);break;case 2:r=ve.intersectsPlaneAndPoint(this._left,e);break;case 3:r=ve.intersectsPlaneAndPoint(this._right,e);break;case 4:r=ve.intersectsPlaneAndPoint(this._top,e);break;case 5:r=ve.intersectsPlaneAndPoint(this._bottom,e)}switch(r){case pe.PlaneIntersectionType_Back:return Se.Disjoint;case pe.PlaneIntersectionType_Intersecting:t=pe.PlaneIntersectionType_Intersecting}}switch(t){case pe.PlaneIntersectionType_Intersecting:return Se.Intersects;default:return Se.Contains}}intersects(e){var t=e.min,r=e.max,i=t.x,a=t.y,n=t.z,s=r.x,o=r.y,l=r.z,_=this._near.normal;if(this._near.distance+_.x*(_.x<0?i:s)+_.y*(_.y<0?a:o)+_.z*(_.z<0?n:l)<0)return!1;var h=this._left.normal;if(this._left.distance+h.x*(h.x<0?i:s)+h.y*(h.y<0?a:o)+h.z*(h.z<0?n:l)<0)return!1;var c=this._right.normal;if(this._right.distance+c.x*(c.x<0?i:s)+c.y*(c.y<0?a:o)+c.z*(c.z<0?n:l)<0)return!1;var d=this._bottom.normal;if(this._bottom.distance+d.x*(d.x<0?i:s)+d.y*(d.y<0?a:o)+d.z*(d.z<0?n:l)<0)return!1;var u=this._top.normal;if(this._top.distance+u.x*(u.x<0?i:s)+u.y*(u.y<0?a:o)+u.z*(u.z<0?n:l)<0)return!1;var f=this._far.normal;return!(this._far.distance+f.x*(f.x<0?i:s)+f.y*(f.y<0?a:o)+f.z*(f.z<0?n:l)<0)}containsBoundBox(e){for(var t=Re._tempV30,r=Re._tempV31,i=e.min,a=e.max,n=Se.Contains,s=0;s<6;s++){var o=this.getPlane(s),l=o.normal;if(l.x>=0?(t.x=a.x,r.x=i.x):(t.x=i.x,r.x=a.x),l.y>=0?(t.y=a.y,r.y=i.y):(t.y=i.y,r.y=a.y),l.z>=0?(t.z=a.z,r.z=i.z):(t.z=i.z,r.z=a.z),ve.intersectsPlaneAndPoint(o,t)===pe.PlaneIntersectionType_Back)return Se.Disjoint;ve.intersectsPlaneAndPoint(o,r)===pe.PlaneIntersectionType_Back&&(n=Se.Intersects)}return n}containsBoundSphere(e){for(var t=pe.PlaneIntersectionType_Front,r=pe.PlaneIntersectionType_Front,i=0;i<6;i++){switch(i){case 0:r=ve.intersectsPlaneAndSphere(this._near,e);break;case 1:r=ve.intersectsPlaneAndSphere(this._far,e);break;case 2:r=ve.intersectsPlaneAndSphere(this._left,e);break;case 3:r=ve.intersectsPlaneAndSphere(this._right,e);break;case 4:r=ve.intersectsPlaneAndSphere(this._top,e);break;case 5:r=ve.intersectsPlaneAndSphere(this._bottom,e)}switch(r){case pe.PlaneIntersectionType_Back:return Se.Disjoint;case pe.PlaneIntersectionType_Intersecting:t=pe.PlaneIntersectionType_Intersecting}}switch(t){case pe.PlaneIntersectionType_Intersecting:return Se.Intersects;default:return Se.Contains}}}Re._tempV30=new n,Re._tempV31=new n,Re._tempV32=new n,Re._tempV33=new n,Re._tempV34=new n,Re._tempV35=new n,Re._tempV36=new n,Re._tempV37=new n;class Ie{constructor(e,t,r,i){this.minDepth=0,this.maxDepth=1,this.x=e,this.y=t,this.width=r,this.height=i}project(e,t,r){var i=e.x,a=e.y,s=e.z;n.transformV3ToV3(e,t,r);var o=t.elements,l=i*o[3]+a*o[7]+s*o[11]+o[15];1!==l&&(r.x=r.x/l,r.y=r.y/l,r.z=r.z/l),r.x=.5*(r.x+1)*this.width+this.x,r.y=.5*(1-r.y)*this.height+this.y,r.z=r.z*(this.maxDepth-this.minDepth)+this.minDepth}unprojectFromMat(e,t,r){var i=t.elements;r.x=(e.x-this.x)/this.width*2-1,r.y=-((e.y-this.y)/this.height*2-1);var a=(this.maxDepth-this.minDepth)/2;r.z=(e.z-this.minDepth-a)/a;var s=r.x*i[3]+r.y*i[7]+r.z*i[11]+i[15];n.transformV3ToV3(r,t,r),1!==s&&(r.x=r.x/s,r.y=r.y/s,r.z=r.z/s)}unprojectFromWVP(e,t,r,i,a){p.multiply(t,r,Ie._tempMatrix4x4),i&&p.multiply(Ie._tempMatrix4x4,i,Ie._tempMatrix4x4),Ie._tempMatrix4x4.invert(Ie._tempMatrix4x4),this.unprojectFromMat(e,Ie._tempMatrix4x4,a)}cloneTo(e){e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e.minDepth=this.minDepth,e.maxDepth=this.maxDepth}}Ie._tempMatrix4x4=new p;class xe{constructor(){}static calculateCursorRay(e,t,r,i,a,s){var o=e.x,l=e.y,_=xe._tempVector30,h=_;h.x=o,h.y=l,h.z=t.minDepth;var c=xe._tempVector31,d=c;d.x=o,d.y=l,d.z=t.maxDepth;var u=s.origin,f=xe._tempVector32;t.unprojectFromWVP(_,r,i,a,u),t.unprojectFromWVP(c,r,i,a,f);var m=s.direction;m.x=f.x-u.x,m.y=f.y-u.y,m.z=f.z-u.z,n.normalize(s.direction,s.direction)}static rayIntersectsTriangle(e,t,r,i){var a=xe._tempVector30,s=xe._tempVector31;n.subtract(r,t,a),n.subtract(i,t,s);var o,l=xe._tempVector32;if(n.cross(e.direction,s,l),(o=n.dot(a,l))>-Number.MIN_VALUE&&o1)return Number.NaN;var d,u,f=xe._tempVector34;return n.cross(c,a,f),d=n.dot(e.direction,f),(d*=h)<0||_+d>1?Number.NaN:(u=n.dot(s,f),(u*=h)<0?Number.NaN:u)}}xe._tempVector30=new n,xe._tempVector31=new n,xe._tempVector32=new n,xe._tempVector33=new n,xe._tempVector34=new n;class Ae{static supportTextureFormat(e){switch(e){case t.TextureFormat.R32G32B32A32:return!(!t.LayaGL.layaGPUInstance._isWebGL2&&!t.LayaGL.layaGPUInstance._oesTextureFloat);default:return!0}}static supportRenderTextureFormat(e){switch(e){case t.RenderTextureFormat.R16G16B16A16:return!!(t.LayaGL.layaGPUInstance._isWebGL2||t.LayaGL.layaGPUInstance._oesTextureHalfFloat&&t.LayaGL.layaGPUInstance._oesTextureHalfFloatLinear);default:return!0}}}class De extends t.BufferStateBase{constructor(){super()}applyVertexBuffer(e){if(t.BufferStateBase._curBindedBufferState!==this)throw"BufferState: must call bind() function first.";var r=t.LayaGL.instance,i=e.vertexDeclaration,a=i._shaderValues.getData();for(var n in this.vertexDeclaration=i,e.bind(),a){var s=parseInt(n),o=a[n];r.enableVertexAttribArray(s),r.vertexAttribPointer(s,o[0],o[1],!!o[2],o[3],o[4])}}applyVertexBuffers(e){if(t.BufferStateBase._curBindedBufferState!==this)throw"BufferState: must call bind() function first.";for(var r=t.LayaGL.instance,i=0,a=e.length;io&&(a=o);for(var l=0;le[t].renderingOrder){var i=e[r];e[r]=e[t],e[t]=i}}_calculateProjectionMatrix(){}_onScreenSizeChanged(){this._calculateProjectionMatrix()}_prepareCameraToRender(){var e=this._shaderValues;this.transform.getForward(this._forward),this.transform.getUp(this._up),e.setVector3(Oe.CAMERAPOS,this.transform.position),e.setVector3(Oe.CAMERADIRECTION,this._forward),e.setVector3(Oe.CAMERAUP,this._up)}render(e=null,t=null){}addLayer(e){this.cullingMask|=Math.pow(2,e)}removeLayer(e){this.cullingMask&=~Math.pow(2,e)}addAllLayers(){this.cullingMask=2147483647}removeAllLayers(){this.cullingMask=0}resetProjectionMatrix(){this._useUserProjectionMatrix=!1,this._calculateProjectionMatrix()}_onActive(){this._scene._addCamera(this),super._onActive()}_onInActive(){this._scene._removeCamera(this),super._onInActive()}_parse(e,r){super._parse(e,r);var i=e.clearFlag;void 0!==i&&(this.clearFlag=i),this.orthographic=e.orthographic,void 0!==e.orthographicVerticalSize&&(this.orthographicVerticalSize=e.orthographicVerticalSize),void 0!==e.fieldOfView&&(this.fieldOfView=e.fieldOfView),this.nearPlane=e.nearPlane,this.farPlane=e.farPlane;var n=e.clearColor;this.clearColor=new a(n[0],n[1],n[2],n[3]);var s=e.skyboxMaterial;s&&(this._skyRenderer.material=t.Loader.getRes(s.path))}destroy(e=!0){this._skyRenderer.destroy(),this._skyRenderer=null,t.Laya.stage.off(t.Event.RESIZE,this,this._onScreenSizeChanged),super.destroy(e)}_create(){return new Oe}}Oe._tempMatrix4x40=new p,Oe.CAMERAPOS=F.propertyNameToID("u_CameraPos"),Oe.VIEWMATRIX=F.propertyNameToID("u_View"),Oe.PROJECTMATRIX=F.propertyNameToID("u_Projection"),Oe.VIEWPROJECTMATRIX=F.propertyNameToID("u_ViewProjection"),Oe.CAMERADIRECTION=F.propertyNameToID("u_CameraDirection"),Oe.CAMERAUP=F.propertyNameToID("u_CameraUp"),Oe.VIEWPORT=F.propertyNameToID("u_Viewport"),Oe.PROJECTION_PARAMS=F.propertyNameToID("u_ProjectionParams"),Oe.RENDERINGTYPE_DEFERREDLIGHTING="DEFERREDLIGHTING",Oe.RENDERINGTYPE_FORWARDRENDERING="FORWARDRENDERING",Oe.CLEARFLAG_SOLIDCOLOR=0,Oe.CLEARFLAG_SKY=1,Oe.CLEARFLAG_DEPTHONLY=2,Oe.CLEARFLAG_NONE=3,Oe._invertYScaleMatrix=new p(1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1),Oe._invertYProjectionMatrix=new p,Oe._invertYProjectionViewMatrix=new p;class Ne extends t.Resource{constructor(){super(),this._bufferState=new De,this._bufferStateInvertUV=new De;var e=t.LayaGL.instance;this._vertexBuffer=new he(64,e.STATIC_DRAW,!1),this._vertexBuffer.vertexDeclaration=Ne._vertexDeclaration,this._vertexBuffer.setData(Ne._vertices.buffer),this._bufferState.bind(),this._bufferState.applyVertexBuffer(this._vertexBuffer),this._bufferState.unBind(),this._vertexBufferInvertUV=new he(64,e.STATIC_DRAW,!1),this._vertexBufferInvertUV.vertexDeclaration=Ne._vertexDeclaration,this._vertexBufferInvertUV.setData(Ne._verticesInvertUV.buffer),this._bufferStateInvertUV.bind(),this._bufferStateInvertUV.applyVertexBuffer(this._vertexBufferInvertUV),this._bufferStateInvertUV.unBind(),this._setGPUMemory(this._vertexBuffer._byteLength+this._vertexBufferInvertUV._byteLength)}static __init__(){Ne._vertexDeclaration=new de(16,[new ue(0,ce.Vector4,Ne.SCREENQUAD_POSITION_UV)]),Ne.instance=new Ne,Ne.instance.lock=!0}render(){var e=t.LayaGL.instance;this._bufferState.bind(),e.drawArrays(e.TRIANGLE_STRIP,0,4),t.Stat.renderBatches++}renderInvertUV(){var e=t.LayaGL.instance;this._bufferStateInvertUV.bind(),e.drawArrays(e.TRIANGLE_STRIP,0,4),t.Stat.renderBatches++}destroy(){super.destroy(),this._bufferState.destroy(),this._vertexBuffer.destroy(),this._bufferStateInvertUV.destroy(),this._vertexBufferInvertUV.destroy(),this._setGPUMemory(0)}}Ne.SCREENQUAD_POSITION_UV=0,Ne._vertices=new Float32Array([1,1,1,0,1,-1,1,1,-1,1,0,0,-1,-1,0,1]),Ne._verticesInvertUV=new Float32Array([1,1,1,1,1,-1,1,0,-1,1,0,1,-1,-1,0,0]);class Pe extends t.Resource{constructor(){super(),this._bufferState=new De,this._bufferStateInvertUV=new De;var e=t.LayaGL.instance;this._vertexBuffer=new he(48,e.STATIC_DRAW,!1),this._vertexBuffer.vertexDeclaration=Pe._vertexDeclaration,this._vertexBuffer.setData(Pe._vertices.buffer),this._bufferState.bind(),this._bufferState.applyVertexBuffer(this._vertexBuffer),this._bufferState.unBind(),this._vertexBufferInvertUV=new he(48,e.STATIC_DRAW,!1),this._vertexBufferInvertUV.vertexDeclaration=Pe._vertexDeclaration,this._vertexBufferInvertUV.setData(Pe._verticesInvertUV.buffer),this._bufferStateInvertUV.bind(),this._bufferStateInvertUV.applyVertexBuffer(this._vertexBufferInvertUV),this._bufferStateInvertUV.unBind(),this._setGPUMemory(this._vertexBuffer._byteLength+this._vertexBufferInvertUV._byteLength)}static __init__(){Pe._vertexDeclaration=new de(16,[new ue(0,ce.Vector4,Pe.SCREENTRIANGLE_POSITION_UV)]),Pe.instance=new Pe,Pe.instance.lock=!0}render(){var e=t.LayaGL.instance;this._bufferState.bind(),e.drawArrays(e.TRIANGLES,0,3),t.Stat.renderBatches++}renderInvertUV(){var e=t.LayaGL.instance;this._bufferStateInvertUV.bind(),e.drawArrays(e.TRIANGLES,0,3),t.Stat.renderBatches++}destroy(){super.destroy(),this._bufferState.destroy(),this._vertexBuffer.destroy(),this._bufferStateInvertUV.destroy(),this._vertexBufferInvertUV.destroy(),this._setGPUMemory(0)}}Pe.SCREENTRIANGLE_POSITION_UV=0,Pe._vertices=new Float32Array([-1,-1,0,1,-1,3,0,-1,3,-1,2,1]),Pe._verticesInvertUV=new Float32Array([-1,-1,0,0,-1,3,0,2,3,-1,2,0]);class we{constructor(){this._commandBuffer=null}static __init__(){we._screenShaderData=new B,we._screenShader=F.find("BlitScreen")}run(){}recover(){this._commandBuffer=null}}we.SCREENTEXTURE_NAME="u_MainTex",we.MAINTEXTURE_TEXELSIZE_NAME="u_MainTex_TexelSize",we.SCREENTEXTURE_ID=F.propertyNameToID(we.SCREENTEXTURE_NAME),we.MAINTEXTURE_TEXELSIZE_ID=F.propertyNameToID(we.MAINTEXTURE_TEXELSIZE_NAME);class Ve extends we{constructor(){super(...arguments),this._source=null,this._dest=null,this._shader=null,this._shaderData=null,this._subShader=0,this._sourceTexelSize=new a,this._screenType=0}static create(e,t,r=null,i=null,a=0,n=Ve._SCREENTYPE_QUAD){var s;return(s=Ve._pool.length>0?Ve._pool.pop():new Ve)._source=e,s._dest=t,s._shader=r,s._shaderData=i,s._subShader=a,s._screenType=n,s}run(){var e=this._shader||we._screenShader,r=this._shaderData||we._screenShaderData,i=this._dest;t.LayaGL.instance.viewport(0,0,i?i.width:P.clientWidth,i?i.height:P.clientHeight),r.setTexture(we.SCREENTEXTURE_ID,this._source),this._sourceTexelSize.setValue(1/this._source.width,1/this._source.height,this._source.width,this._source.height),r.setVector(we.MAINTEXTURE_TEXELSIZE_ID,this._sourceTexelSize),i&&i._start();for(var a=e.getSubShaderAt(this._subShader)._passes,n=0,s=a.length;n0?be._pool.pop():new be)._renderTexture=e,t}run(){this._renderTexture._start()}recover(){be._pool.push(this),this._renderTexture=null}}be._pool=[];class Fe extends we{constructor(){super(...arguments),this._shaderData=null,this._nameID=0,this._texture=null}static create(e,t,r){var i;return(i=Fe._pool.length>0?Fe._pool.pop():new Fe)._shaderData=e,i._nameID=t,i._texture=r,i}run(){this._shaderData.setTexture(this._nameID,this._texture)}recover(){Fe._pool.push(this),this._shaderData=null,this._nameID=0,this._texture=null}}Fe._pool=[];class Be{constructor(){this._camera=null,this._commands=[]}_apply(){for(var e=0,t=this._commands.length;e=.5?Math.floor(i):o,d=l-a>=.5?Math.floor(a):l,u=n-_>=.5?Math.ceil(n):_,f=s-h>=.5?Math.ceil(s):h;this._viewport.x=c,this._viewport.y=d,this._viewport.width=u-c,this._viewport.height=f-d}_calculateProjectionMatrix(){if(!this._useUserProjectionMatrix)if(this._orthographic){var e=.5*this.orthographicVerticalSize,t=e*this.aspectRatio;p.createOrthoOffCenter(-t,t,-e,e,this.nearPlane,this.farPlane,this._projectionMatrix)}else p.createPerspective(3.1416*this.fieldOfView/180,this.aspectRatio,this.nearPlane,this.farPlane,this._projectionMatrix)}_isLayerVisible(e){return 0!=(Math.pow(2,e)&this.cullingMask)}_onTransformChanged(e){(e&=ie.TRANSFORM_WORLDMATRIX)&&(this._updateViewMatrix=!0)}_parse(e,t){super._parse(e,t);var r=e.viewport;this.normalizedViewport=new Ie(r[0],r[1],r[2],r[3]);var i=e.enableHDR;void 0!==i&&(this.enableHDR=i)}_getCanvasHeight(){return this._offScreenRenderTexture?this._offScreenRenderTexture.height:P.clientHeight}_getInternalRenderTexture(){return this._renderTexture||this._offScreenRenderTexture}_applyPostProcessCommandBuffers(){for(var e=0,t=this._postProcessCommandBuffers.length;e1,a=i?t._indexCount:r._vertexCount;if(a<=o.SubMeshDynamicBatch.maxAllowVertexCount){var n=3*a;this._dynamicVertexBatch=!0,this._dynamicWorldPositions=new Float32Array(n),this._dynamicWorldNormals=new Float32Array(n),this._dynamicVertexCount=a,this._dynamicMultiSubMesh=i}else this._dynamicVertexBatch=!1}this._geometry=e}}addToOpaqueRenderQueue(e,r){var i=this.staticBatch,a=r.elements,n=a.elements;if(i){var s=o.MeshRenderStaticBatchManager.instance,l=s.getBatchOpaquaMark(this.render.lightmapIndex+1,this.render.receiveShadow,this.material.id,i._batchID);if(s._updateCountMark===l.updateMark){var _=l.indexInList;if(l.batched)n[_].staticBatchElementList.add(this);else{var h=n[_],c=h.render,d=s._getBatchRenderElementFromPool();d.renderType=Ge.RENDERTYPE_STATICBATCH,d.setGeometry(i),d.material=h.material;var u=i.batchOwner,f=u?u._transform:null;d.setTransform(f),d.render=c,d.renderSubShader=h.renderSubShader;var m=d.staticBatchElementList;m.length=0,m.add(h),m.add(this),n[_]=d,l.batched=!0}}else l.updateMark=s._updateCountMark,l.indexInList=a.length,l.batched=!1,a.add(this)}else if(this.renderSubShader._owner._enableInstancing&&t.LayaGL.layaGPUInstance.supportInstance()&&this.render.lightmapIndex<0){var E=this._geometry,T=o.MeshRenderDynamicBatchManager.instance,p=T.getInstanceBatchOpaquaMark(this.render.receiveShadow,this.material.id,E._id,this._transform._isFrontFaceInvert);if(T._updateCountMark===p.updateMark){var g=p.indexInList;if(p.batched){var S=n[g].instanceBatchElementList;S.length===me.instance.maxInstanceCount?(p.updateMark=T._updateCountMark,p.indexInList=a.length,p.batched=!1,a.add(this)):S.add(this)}else{var v=n[g],R=v.render,I=T._getBatchRenderElementFromPool();I.renderType=Ge.RENDERTYPE_INSTANCEBATCH,I.setGeometry(me.instance),I.material=v.material,I.setTransform(null),I.render=R,I.instanceSubMesh=E,I.renderSubShader=v.renderSubShader;var x=I.instanceBatchElementList;x.length=0,x.add(v),x.add(this),n[g]=I,p.batched=!0}}else p.updateMark=T._updateCountMark,p.indexInList=a.length,p.batched=!1,a.add(this)}else if(this._dynamicVertexBatch){var A=this._geometry._vertexBuffer.vertexDeclaration,D=o.MeshRenderDynamicBatchManager.instance,M=D.getVertexBatchOpaquaMark(this.render.lightmapIndex+1,this.render.receiveShadow,this.material.id,A.id);if(D._updateCountMark===M.updateMark){var L=M.indexInList;if(M.batched)n[L].vertexBatchElementList.add(this);else{var C=n[L],y=C.render,O=D._getBatchRenderElementFromPool();O.renderType=Ge.RENDERTYPE_VERTEXBATCH,O.setGeometry(o.SubMeshDynamicBatch.instance),O.material=C.material,O.setTransform(null),O.render=y,O.vertexBatchVertexDeclaration=A,O.renderSubShader=C.renderSubShader;var N=O.vertexBatchElementList;N.length=0,N.add(C),N.add(this),n[L]=O,M.batched=!0}}else M.updateMark=D._updateCountMark,M.indexInList=a.length,M.batched=!1,a.add(this)}else a.add(this)}addToTransparentRenderQueue(e,r){var i=this.staticBatch,a=r.elements,n=a.elements;if(i){var s=o.MeshRenderStaticBatchManager.instance,l=r.lastTransparentRenderElement;if(l){var _=l.render;if(l._geometry._getType()!==this._geometry._getType()||l.staticBatch!==i||l.material!==this.material||_.receiveShadow!==this.render.receiveShadow||_.lightmapIndex!==this.render.lightmapIndex)a.add(this),r.lastTransparentBatched=!1;else{if(r.lastTransparentBatched)n[a.length-1].staticBatchElementList.add(this);else{var h=s._getBatchRenderElementFromPool();h.renderType=Ge.RENDERTYPE_STATICBATCH,h.setGeometry(i),h.material=l.material;var c=i.batchOwner,d=c?c._transform:null;h.setTransform(d),h.render=this.render,h.renderSubShader=l.renderSubShader;var u=h.staticBatchElementList;u.length=0,u.add(l),u.add(this),n[a.length-1]=h}r.lastTransparentBatched=!0}}else a.add(this),r.lastTransparentBatched=!1}else if(this.renderSubShader._owner._enableInstancing&&t.LayaGL.layaGPUInstance.supportInstance()&&this.render.lightmapIndex<0){var f=this._geometry,m=o.MeshRenderDynamicBatchManager.instance,E=r.lastTransparentRenderElement;if(E){var T=E.render;if(E._geometry._getType()!==this._geometry._getType()||E._geometry!==f||E.material!==this.material||T.receiveShadow!==this.render.receiveShadow)a.add(this),r.lastTransparentBatched=!1;else if(r.lastTransparentBatched){var p=n[a.length-1].instanceBatchElementList;p.length===me.instance.maxInstanceCount?(a.add(this),r.lastTransparentBatched=!1):(p.add(this),r.lastTransparentBatched=!0)}else{var g=m._getBatchRenderElementFromPool();g.renderType=Ge.RENDERTYPE_INSTANCEBATCH,g.setGeometry(me.instance),g.material=E.material,g.setTransform(null),g.render=this.render,g.instanceSubMesh=f,g.renderSubShader=E.renderSubShader;var S=g.instanceBatchElementList;S.length=0,S.add(E),S.add(this),n[a.length-1]=g,r.lastTransparentBatched=!0}}else a.add(this),r.lastTransparentBatched=!1}else if(this._dynamicVertexBatch){var v=this._geometry._vertexBuffer.vertexDeclaration,R=o.MeshRenderDynamicBatchManager.instance,I=r.lastTransparentRenderElement;if(I){var x=I.render;if(I._geometry._getType()!==this._geometry._getType()||I._geometry._vertexBuffer._vertexDeclaration!==v||I.material!==this.material||x.receiveShadow!==this.render.receiveShadow||x.lightmapIndex!==this.render.lightmapIndex)a.add(this),r.lastTransparentBatched=!1;else{if(r.lastTransparentBatched)n[a.length-1].vertexBatchElementList.add(this);else{var A=R._getBatchRenderElementFromPool();A.renderType=Ge.RENDERTYPE_VERTEXBATCH,A.setGeometry(o.SubMeshDynamicBatch.instance),A.material=I.material,A.setTransform(null),A.render=this.render,A.vertexBatchVertexDeclaration=v,A.renderSubShader=I.renderSubShader;var D=A.vertexBatchElementList;D.length=0,D.add(I),D.add(this),n[a.length-1]=A}r.lastTransparentBatched=!0}}else a.add(this),r.lastTransparentBatched=!1}else a.add(this);r.lastTransparentRenderElement=this}getInvertFront(){switch(this.renderType){case Ge.RENDERTYPE_NORMAL:return this._transform._isFrontFaceInvert;case Ge.RENDERTYPE_STATICBATCH:case Ge.RENDERTYPE_VERTEXBATCH:return!1;case Ge.RENDERTYPE_INSTANCEBATCH:return this.instanceBatchElementList.elements[0]._transform._isFrontFaceInvert;default:throw"SubMeshRenderElement: unknown renderType"}}destroy(){super.destroy(),this._dynamicWorldPositions=null,this._dynamicWorldNormals=null,this.staticBatch=null,this.staticBatchElementList=null,this.vertexBatchElementList=null,this.vertexBatchVertexDeclaration=null}}class He extends _e{constructor(e,t){super(),this._bufferState=new De,this._batchID=He._batchIDCounter++,this._batchElements=[],this._currentBatchVertexCount=0,this._currentBatchIndexCount=0,this._vertexDeclaration=t,this.batchOwner=e}_getStaticBatchBakedVertexs(e,t,r,i,a,n){var s,o=n._vertexBuffer,l=o.vertexDeclaration,_=l.getVertexElementByUsage(fe.MESH_POSITION0)._offset/4,h=l.getVertexElementByUsage(fe.MESH_NORMAL0),c=h?h._offset/4:-1,d=l.getVertexElementByUsage(fe.MESH_COLOR0),u=d?d._offset/4:-1,f=l.getVertexElementByUsage(fe.MESH_TEXTURECOORDINATE0),m=f?f._offset/4:-1,E=l.getVertexElementByUsage(fe.MESH_TEXTURECOORDINATE1),T=E?E._offset/4:-1,g=l.getVertexElementByUsage(fe.MESH_TANGENT0),S=g?g._offset/4:-1,v=l.vertexStride/4,R=o.getFloat32Data();r?(r.worldMatrix.invert(He._tempMatrix4x40),s=He._tempMatrix4x41,p.multiply(He._tempMatrix4x40,i.worldMatrix,s)):s=i.worldMatrix;var I=He._tempQuaternion0;s.decomposeTransRotScale(He._tempVector30,I,He._tempVector31);for(var x=a.lightmapScaleOffset,D=n.vertexCount,M=0;MHe.maxBatchVertexCount)}add(e){var t=e.meshFilter.sharedMesh,r=t.vertexCount;this._batchElements.push(e);var i=e._render;i._isPartOfStaticBatch=!0,i._staticBatch=this;for(var a=i._renderElements,n=0,s=a.length;n=i.length){var s=i;(i=oe._cullingBuffer=new Float32Array(i.length+4096)).set(s,0)}i[r]=2,oe._cullingBufferLength=a}this._renderElements=[],this._owner=e,this._enable=!0,this._materialsInstance=[],this._shaderValues=new B(null),this.lightmapIndex=-1,this._castShadow=!1,this.receiveShadow=!1,this.sortingFudge=0,e&&this._owner.transform.on(t.Event.TRANSFORM_CHANGED,this,this._onWorldMatNeedChange)}get id(){return this._id}get lightmapIndex(){return this._lightmapIndex}set lightmapIndex(e){this._lightmapIndex!==e&&(this._lightmapIndex=e,this._applyLightMapParams())}get lightmapScaleOffset(){return this._lightmapScaleOffset}set lightmapScaleOffset(e){this._lightmapScaleOffset=e,this._shaderValues.setVector(ne.LIGHTMAPSCALEOFFSET,e),this._shaderValues.addDefine(ne.SHADERDEFINE_SCALEOFFSETLIGHTINGMAPUV)}get enable(){return this._enable}set enable(e){this._enable=!!e}get material(){var e=this._sharedMaterials[0];if(e&&!this._materialsInstance[0]){var t=this._getInstanceMaterial(e,0),r=this._renderElements[0];r&&(r.material=t)}return this._sharedMaterials[0]}set material(e){this.sharedMaterial=e}get materials(){for(var e=0,t=this._sharedMaterials.length;e=0){var e=this._scene.getlightmaps();this._lightmapIndexKe.maxIndicesCount&&(this._flush(n,s),o++,t.Stat.trianglesFaces+=s/3,n=s=0);var f=c._transform;this._getBatchVertices(i,this._vertices,n,f,c,d),this._getBatchIndices(this._indices,s,n,f,d,c._dynamicMultiSubMesh),n+=c._dynamicVertexCount,s+=u}this._flush(n,s),o++,t.Stat.renderBatches+=o,t.Stat.savedRenderBatches+=l-o,t.Stat.trianglesFaces+=s/3}}Ke.maxAllowVertexCount=10,Ke.maxAllowAttribueCount=900,Ke.maxIndicesCount=32e3;class Je extends re{constructor(){super(),this._instanceBatchOpaqueMarks=[],this._vertexBatchOpaqueMarks=[],this._cacheBufferStates=[],this._updateCountMark=0}getInstanceBatchOpaquaMark(e,t,r,i){var a=this._instanceBatchOpaqueMarks[e?0:1]||(this._instanceBatchOpaqueMarks[e?0:1]=[]),n=a[t]||(a[t]=[]),s=n[r]||(n[r]=[]);return s[i?1:0]||(s[i?1:0]=new le)}getVertexBatchOpaquaMark(e,t,r,i){var a=this._vertexBatchOpaqueMarks[e]||(this._vertexBatchOpaqueMarks[e]=[]),n=a[t?0:1]||(a[t?0:1]=[]),s=n[r]||(n[r]=[]);return s[i]||(s[i]=new le)}_getBufferState(e){var t=this._cacheBufferStates[e.id];if(!t){var r=Ke.instance;(t=new De).bind();var i=r._vertexBuffer;i.vertexDeclaration=e,t.applyVertexBuffer(i),t.applyIndexBuffer(r._indexBuffer),t.unBind(),this._cacheBufferStates[e.id]=t}return t}_getBatchRenderElementFromPool(){var e=this._batchRenderElementPool[this._batchRenderElementPoolIndex++];return e||(e=new ze,this._batchRenderElementPool[this._batchRenderElementPoolIndex-1]=e,e.vertexBatchElementList=new We,e.instanceBatchElementList=new We),e}_clear(){super._clear(),this._updateCountMark++}}Je.instance=new Je;class $e extends ne{static __init__(){Xe.SHADERDEFINE_UV0=F.getDefineByName("UV"),Xe.SHADERDEFINE_COLOR=F.getDefineByName("COLOR"),Xe.SHADERDEFINE_UV1=F.getDefineByName("UV1"),Xe.SHADERDEFINE_GPU_INSTANCE=F.getDefineByName("GPU_INSTANCE"),se._registerManager(ke.instance),re._registerManager(Je.instance)}get meshFilter(){return this._meshFilter}get meshRenderer(){return this._render}constructor(e=null,t=null){super(t),this._meshFilter=new Qe(this),this._render=new qe(this),e&&(this._meshFilter.sharedMesh=e)}_parse(e,r){super._parse(e,r);var i=this.meshRenderer,n=e.lightmapIndex;null!=n&&(i.lightmapIndex=n);var s=e.lightmapScaleOffset;s&&(i.lightmapScaleOffset=new a(s[0],s[1],s[2],s[3])),null!=e.meshPath&&(this.meshFilter.sharedMesh=t.Loader.getRes(e.meshPath)),null!=e.enableRender&&(this.meshRenderer.enable=e.enableRender);var o=e.materials;if(o){var l=i.sharedMaterials,_=o.length;l.length=_;for(var h=0;h<_;h++)l[h]=t.Loader.getRes(o[h].path);i.sharedMaterials=l}}_addToInitStaticBatchManager(){this.meshFilter.sharedMesh&&ke.instance._addBatchSprite(this)}_cloneTo(e,t,r){var i=e;i._meshFilter.sharedMesh=this._meshFilter.sharedMesh;var a=this._render,n=i._render;n.enable=a.enable,n.sharedMaterials=a.sharedMaterials,n.castShadow=a.castShadow;var s=a.lightmapScaleOffset;s&&(n.lightmapScaleOffset=s.clone()),n.lightmapIndex=a.lightmapIndex,n.receiveShadow=a.receiveShadow,n.sortingFudge=a.sortingFudge,super._cloneTo(e,t,r)}destroy(e=!0){this.destroyed||(super.destroy(e),this._meshFilter.destroy())}_create(){return new $e}}class et{}et.Blend=0,et.Fixed=1;class tt{constructor(e,t){this._mode=0,this._maxColorRGBKeysCount=0,this._maxColorAlphaKeysCount=0,this._colorRGBKeysCount=0,this._colorAlphaKeysCount=0,this._alphaElements=null,this._rgbElements=null,this._maxColorRGBKeysCount=e,this._maxColorAlphaKeysCount=t,this._rgbElements=new Float32Array(4*e),this._alphaElements=new Float32Array(2*t)}get mode(){return this._mode}set mode(e){this._mode=e}get colorRGBKeysCount(){return this._colorRGBKeysCount}get colorAlphaKeysCount(){return this._colorAlphaKeysCount}get maxColorRGBKeysCount(){return this._maxColorRGBKeysCount}get maxColorAlphaKeysCount(){return this._maxColorAlphaKeysCount}addColorRGB(e,t){if(this._colorRGBKeysCount=0;s--){var o=4*s;if(e===(u=a[o]))return t.r=a[o+1],t.g=a[o+2],t.b=a[o+3],n;switch(this._mode){case et.Blend:if(e>u){if(e>(d=a[o+4]))throw"Gradient:wrong startSearchIndex.";var l=d-u,_=d-e,h=e-u;return t.r=(_*a[o+1]+h*a[o+5])/l,t.g=(_*a[o+2]+h*a[o+6])/l,t.b=(_*a[o+3]+h*a[o+7])/l,n}n--;continue;case et.Fixed:if(e>u){if(e>a[o+4])throw"Gradient:wrong startSearchIndex.";return t.r=a[o+5],t.g=a[o+6],t.b=a[o+7],n}n--;continue;default:throw"Gradient:unknown mode."}}else{s=0;for(var c=this._rgbElements.length;s=0;s--){if(e===(u=a[c=2*s]))return t.a=a[c+1],n;switch(this._mode){case et.Blend:if(e>u){if(e>(d=a[c+2]))throw"Gradient:wrong startSearchIndex.";var o=d-u,l=d-e,_=e-u;return t.a=(l*a[c+1]+_*a[c+3])/o,n}n--;continue;case et.Fixed:if(e>u){if(e>a[c+2])throw"Gradient:wrong startSearchIndex.";return t.a=a[c+3],n}n--;continue;default:throw"Gradient:unknown mode."}}else{s=n;for(var h=this._alphaElements.length;s=e.length)throw new Error("start"+t+"Must be in the range [0, "+(e.length-1)+"]");if(r<0||t+r>e.length)throw new Error("count"+r+"Must be in the range <= "+e.length+"}");var a=t+r,s=_t._tempVector3;s.x=0,s.y=0,s.z=0;for(var o=t;o_&&(_=h)}i.radius=Math.sqrt(_)}static createfromPoints(e,t){if(null==e)throw new Error("points");_t.createFromSubPoints(e,0,e.length,t)}intersectsRayDistance(e){return ve.intersectsRayAndSphereRD(e,this)}intersectsRayPoint(e,t){return ve.intersectsRayAndSphereRP(e,this,t)}cloneTo(e){var t=e;this.center.cloneTo(t.center),t.radius=this.radius}clone(){var e=new _t(new n,0);return this.cloneTo(e),e}}_t._tempVector3=new n;class ht{constructor(e){this._temp=new Uint32Array(1),this.seeds=new Uint32Array(4),this.seeds[0]=e,this.seeds[1]=1812433253*this.seeds[0]+1,this.seeds[2]=1812433253*this.seeds[1]+1,this.seeds[3]=1812433253*this.seeds[2]+1}static getFloatFromInt(e){return 1/8388607*(8388607&e)}static getByteFromInt(e){return(8388607&e)>>>15}get seed(){return this.seeds[0]}set seed(e){this.seeds[0]=e,this.seeds[1]=1812433253*this.seeds[0]+1,this.seeds[2]=1812433253*this.seeds[1]+1,this.seeds[3]=1812433253*this.seeds[2]+1}getUint(){return this._temp[0]=this.seeds[0]^this.seeds[0]<<11,this.seeds[0]=this.seeds[1],this.seeds[1]=this.seeds[2],this.seeds[2]=this.seeds[3],this.seeds[3]=this.seeds[3]^this.seeds[3]>>>19^this._temp[0]^this._temp[0]>>>8,this.seeds[3]}getFloat(){return this.getUint(),(8388607&this.seeds[3])*(1/8388607)}getSignedFloat(){return 2*this.getFloat()-1}}class ct{set emissionRate(e){if(e<0)throw new Error("ParticleBaseShape:emissionRate value must large or equal than 0.");this._emissionRate=e}get emissionRate(){return this._emissionRate}get destroyed(){return this._destroyed}constructor(){this._destroyed=!1,this.emissionRate=10,this._bursts=[]}destroy(){this._bursts=null,this._destroyed=!0}getBurstsCount(){return this._bursts.length}getBurstByIndex(e){return this._bursts[e]}addBurst(e){var t=this._bursts.length;if(t>0)for(var r=0;re.time&&this._bursts.splice(r,0,e);this._bursts.push(e)}removeBurst(e){var t=this._bursts.indexOf(e);-1!==t&&this._bursts.splice(t,1)}removeBurstByIndex(e){this._bursts.splice(e,1)}clearBurst(){this._bursts.length=0}cloneTo(e){var t=e,r=t._bursts;r.length=this._bursts.length;for(var i=0,a=this._bursts.length;i=r){var s=e.getKeyByIndex(i-1),o=(r-s)/(n-s);return t.MathUtil.lerp(e.getValueByIndex(i-1),e.getValueByIndex(i),o)}}throw new Error("ShurikenParticleData: can't get value foam startLifeTimeGradient.")}static _randomInvertRoationArray(e,t,r,i,a){var n;i?(i.seed=a[6],n=i.getFloat(),a[6]=i.seed):n=Math.random(),n=this._firstRetiredElement?this._firstNewElement-this._firstRetiredElement:this._bufferMaxParticles-this._firstRetiredElement+this._firstNewElement}get emissionTime(){return this._emissionTime>this.duration?this.duration:this._emissionTime}get shape(){return this._shape}set shape(e){this._shape!==e&&(e&&e.enable?this._owner._render._shaderValues.addDefine(at.SHADERDEFINE_SHAPE):this._owner._render._shaderValues.removeDefine(at.SHADERDEFINE_SHAPE),this._shape=e)}get isAlive(){return!!(this._isPlaying||this.aliveParticleCount>0)}get isEmitting(){return this._isEmitting}get isPlaying(){return this._isPlaying}get isPaused(){return this._isPaused}get startLifetimeType(){return this._startLifetimeType}set startLifetimeType(e){var t,r;switch(this.startLifetimeType){case 0:this._maxStartLifetime=this.startLifetimeConstant;break;case 1:this._maxStartLifetime=-Number.MAX_VALUE;var i=i;for(t=0,r=i.gradientCount;t=this._bufferMaxParticles&&(this._firstActiveElement=0)}}_freeRetiredParticles(){for(;this._firstRetiredElement!=this._firstActiveElement;){var e=this._drawCounter-this._vertices[this._firstRetiredElement*this._floatCountPerVertex*this._vertexStride+this._timeIndex];if(this.isPerformanceMode&&e<3)break;this._firstRetiredElement++,this._firstRetiredElement>=this._bufferMaxParticles&&(this._firstRetiredElement=0)}}_burst(e,r){for(var i=0,a=this._emission._bursts,n=a.length;this._burstsIndexthis.duration){if(!this.looping){for(a=Math.min(this.maxParticles-this.aliveParticleCount,a),r=0;r0){var s=1/n;for(this._frameRateTime+=s,this._frameRateTime=this._currentTime-(this._currentTime-this._frameRateTime)%this._maxStartLifetime;this._frameRateTime<=t&&this.emit(this._frameRateTime);)this._frameRateTime+=s;this._frameRateTime=Math.floor(t/s)*s}}_initBufferDatas(){this._vertexBuffer&&(this._vertexBuffer.destroy(),this._indexBuffer.destroy());var e=t.LayaGL.instance,r=this._ownerRender,i=r.renderMode;if(-1!==i&&this.maxParticles>0){var a,n,s,o,l,_,h,c=0,d=0,u=r.mesh;if(4===i){if(u){h=lt.vertexDeclaration,this._floatCountPerVertex=h.vertexStride/4,this._startLifeTimeIndex=12,this._timeIndex=16,this._vertexStride=u._vertexCount;var f=this._bufferMaxParticles*this._vertexStride,m=f%65535;if(Math.floor(f/65535)+1>1)throw new Error("ShurikenParticleSystem:the maxParticleCount multiply mesh vertexCount is large than 65535.");c=h.vertexStride*m,this._vertexBuffer=new he(c,e.DYNAMIC_DRAW),this._vertexBuffer.vertexDeclaration=h,this._vertices=new Float32Array(this._floatCountPerVertex*m),this._indexStride=u._indexBuffer.indexCount;var E=u._indexBuffer.getData(),T=this._bufferMaxParticles*this._indexStride;for(this._indexBuffer=new Me(Me.INDEXTYPE_USHORT,T,e.STATIC_DRAW),a=new Uint16Array(T),d=c+2*T,l=0,n=0;n=this._bufferMaxParticles&&(a=0),a===this._firstRetiredElement)return!1;var s,o,l,_,h,c,d,u,f,m,E=this._owner.transform;if(ut.create(this,this._ownerRender,E),this._currentTime-i>=ut.startLifeTime)return!0;switch(0==this.simulationSpace&&(s=E.position,o=E.rotation),this.startSpeedType){case 0:l=this.startSpeedConstant;break;case 2:this.autoRandomSeed?l=t.MathUtil.lerp(this.startSpeedConstantMin,this.startSpeedConstantMax,Math.random()):(this._rand.seed=this._randomSeeds[8],l=t.MathUtil.lerp(this.startSpeedConstantMin,this.startSpeedConstantMax,this._rand.getFloat()),this._randomSeeds[8]=this._rand.seed)}var T=this._velocityOverLifetime&&this._velocityOverLifetime.enbale;if(T){var p=this._velocityOverLifetime.velocity.type;2===p||3===p?this.autoRandomSeed?(_=Math.random(),h=Math.random(),c=Math.random()):(this._rand.seed=this._randomSeeds[9],_=this._rand.getFloat(),h=this._rand.getFloat(),c=this._rand.getFloat(),this._randomSeeds[9]=this._rand.seed):T=!1}else T=!1;var g=this._colorOverLifetime&&this._colorOverLifetime.enbale;g?3===this._colorOverLifetime.color.type?this.autoRandomSeed?d=Math.random():(this._rand.seed=this._randomSeeds[10],d=this._rand.getFloat(),this._randomSeeds[10]=this._rand.seed):g=!1:g=!1;var S=this._sizeOverLifetime&&this._sizeOverLifetime.enbale;S?3===this._sizeOverLifetime.size.type?this.autoRandomSeed?u=Math.random():(this._rand.seed=this._randomSeeds[11],u=this._rand.getFloat(),this._randomSeeds[11]=this._rand.seed):S=!1:S=!1;var v=this._rotationOverLifetime&&this._rotationOverLifetime.enbale;if(v){var R=this._rotationOverLifetime.angularVelocity.type;2===R||3===R?this.autoRandomSeed?f=Math.random():(this._rand.seed=this._randomSeeds[12],f=this._rand.getFloat(),this._randomSeeds[12]=this._rand.seed):v=!1}else v=!1;var I=this._textureSheetAnimation&&this._textureSheetAnimation.enable;I?3===this._textureSheetAnimation.frame.type?this.autoRandomSeed?m=Math.random():(this._rand.seed=this._randomSeeds[15],m=this._rand.getFloat(),this._randomSeeds[15]=this._rand.seed):I=!1:I=!1;var x,A,D,M,L,C,y=this._firstFreeElement*this._floatCountPerVertex*this._vertexStride,O=ut.startUVInfo[0],N=ut.startUVInfo[1],P=ut.startUVInfo[2],w=ut.startUVInfo[3],V=this._ownerRender;if(4===V.renderMode){var b=V.mesh._vertexBuffer;x=b.getFloat32Data();var F=b.vertexDeclaration;D=F.getVertexElementByUsage(fe.MESH_POSITION0)._offset/4;var B=F.getVertexElementByUsage(fe.MESH_COLOR0);M=B?B._offset/4:-1;var U=F.getVertexElementByUsage(fe.MESH_TEXTURECOORDINATE0);L=U?U._offset/4:-1,A=F.vertexStride/4,C=0}else{this._vertices[y+2]=P,this._vertices[y+3]=w+N;var G=y+this._floatCountPerVertex;this._vertices[G+2]=P+O,this._vertices[G+3]=w+N;var z=G+this._floatCountPerVertex;this._vertices[z+2]=P+O,this._vertices[z+3]=w;var H=z+this._floatCountPerVertex;this._vertices[H+2]=P,this._vertices[H+3]=w}for(var W=y,k=y+this._floatCountPerVertex*this._vertexStride;W0&&this._vertexBuffer.setData(this._vertices.buffer,0,0,this._firstFreeElement*t)),this._firstNewElement=this._firstFreeElement}_getType(){return ft._type}_prepareRender(e){return this._updateEmission(),this._firstNewElement!=this._firstFreeElement&&this.addNewParticlesToVertexBuffer(),this._drawCounter++,this._firstActiveElement!=this._firstFreeElement}_render(e){var r;this._bufferState.bind();var i=t.LayaGL.instance;this._firstActiveElement0&&(r=this._firstFreeElement*this._indexStride,i.drawElements(i.TRIANGLES,r,i.UNSIGNED_SHORT,0),t.Stat.trianglesFaces+=r/3,t.Stat.renderBatches++))}play(){if(this._burstsIndex=0,this._isEmitting=!0,this._isPlaying=!0,this._isPaused=!1,this._emissionTime=0,this._totalDelayTime=0,!this.autoRandomSeed)for(var e=0,r=this._randomSeeds.length;e0&&t.setCollisionFlags(r^rr.COLLISIONFLAGS_CUSTOM_MATERIAL_CALLBACK)}_onAdded(){this.enabled=this._enabled,this.restitution=this._restitution,this.friction=this._friction,this.rollingFriction=this._rollingFriction,this.ccdMotionThreshold=this._ccdMotionThreshold,this.ccdSweptSphereRadius=this._ccdSweptSphereRadius,this.owner.transform.on(t.Event.TRANSFORM_CHANGED,this,this._onTransformChanged)}_onDestroy(){var e=Zt._physics3D;delete rr._physicObjectsMap[this.id],e.destroy(this._nativeColliderObject),this._colliderShape.destroy(),super._onDestroy(),this._nativeColliderObject=null,this._colliderShape=null,this._simulation=null,this.owner.transform.off(t.Event.TRANSFORM_CHANGED,this,this._onTransformChanged)}_onTransformChanged(e){rr._addUpdateList&&(e&=ie.TRANSFORM_WORLDPOSITION|ie.TRANSFORM_WORLDQUATERNION|ie.TRANSFORM_WORLDSCALE)&&(this._transformFlag|=e,this._isValid()&&-1===this._inPhysicUpdateListIndex&&this._simulation._physicsUpdateList.add(this))}_cloneTo(e){var t=e;t.restitution=this._restitution,t.friction=this._friction,t.rollingFriction=this._rollingFriction,t.ccdMotionThreshold=this._ccdMotionThreshold,t.ccdSweptSphereRadius=this._ccdSweptSphereRadius,t.collisionGroup=this._collisionGroup,t.canCollideWith=this._canCollideWith,t.canScaleShape=this.canScaleShape,this._colliderShape&&(t.colliderShape=this._colliderShape.clone())}}rr.ACTIVATIONSTATE_ACTIVE_TAG=1,rr.ACTIVATIONSTATE_ISLAND_SLEEPING=2,rr.ACTIVATIONSTATE_WANTS_DEACTIVATION=3,rr.ACTIVATIONSTATE_DISABLE_DEACTIVATION=4,rr.ACTIVATIONSTATE_DISABLE_SIMULATION=5,rr.COLLISIONFLAGS_STATIC_OBJECT=1,rr.COLLISIONFLAGS_KINEMATIC_OBJECT=2,rr.COLLISIONFLAGS_NO_CONTACT_RESPONSE=4,rr.COLLISIONFLAGS_CUSTOM_MATERIAL_CALLBACK=8,rr.COLLISIONFLAGS_CHARACTER_OBJECT=16,rr.COLLISIONFLAGS_DISABLE_VISUALIZE_OBJECT=32,rr.COLLISIONFLAGS_DISABLE_SPU_COLLISION_PROCESSING=64,rr._tempVector30=new n,rr._tempQuaternion0=new u,rr._tempQuaternion1=new u,rr._tempMatrix4x40=new p,rr._physicObjectsMap={},rr._addUpdateList=!0;class ir{constructor(e,t=0){this._gravity=new n(0,-10,0),this._nativeVector3Zero=new Zt._physics3D.btVector3(0,0,0),this._nativeDefaultQuaternion=new Zt._physics3D.btQuaternion(0,0,0,-1),this._collisionsUtils=new Yt,this._previousFrameCollisions=[],this._currentFrameCollisions=[],this._physicsUpdateList=new Wt,this._characters=[],this._updatedRigidbodies=0,this.maxSubSteps=1,this.fixedTimeStep=1/60,this.maxSubSteps=e.maxSubSteps,this.fixedTimeStep=e.fixedTimeStep;var r=Zt._physics3D;this._nativeCollisionConfiguration=new r.btDefaultCollisionConfiguration,this._nativeDispatcher=new r.btCollisionDispatcher(this._nativeCollisionConfiguration),this._nativeBroadphase=new r.btDbvtBroadphase,this._nativeBroadphase.getOverlappingPairCache().setInternalGhostPairCallback(new r.btGhostPairCallback);var i=e.flags;if(i&ir.PHYSICSENGINEFLAGS_COLLISIONSONLY)this._nativeCollisionWorld=new r.btCollisionWorld(this._nativeDispatcher,this._nativeBroadphase,this._nativeCollisionConfiguration);else{if(i&ir.PHYSICSENGINEFLAGS_SOFTBODYSUPPORT)throw"PhysicsSimulation:SoftBody processing is not yet available";var a=new r.btSequentialImpulseConstraintSolver;this._nativeDiscreteDynamicsWorld=new r.btDiscreteDynamicsWorld(this._nativeDispatcher,this._nativeBroadphase,a,this._nativeCollisionConfiguration),this._nativeCollisionWorld=this._nativeDiscreteDynamicsWorld}this._nativeDiscreteDynamicsWorld&&(this._nativeSolverInfo=this._nativeDiscreteDynamicsWorld.getSolverInfo(),this._nativeDispatchInfo=this._nativeDiscreteDynamicsWorld.getDispatchInfo()),this._nativeClosestRayResultCallback=new r.ClosestRayResultCallback(this._nativeVector3Zero,this._nativeVector3Zero),this._nativeAllHitsRayResultCallback=new r.AllHitsRayResultCallback(this._nativeVector3Zero,this._nativeVector3Zero),this._nativeClosestConvexResultCallback=new r.ClosestConvexResultCallback(this._nativeVector3Zero,this._nativeVector3Zero),this._nativeAllConvexResultCallback=new r.AllConvexResultCallback(this._nativeVector3Zero,this._nativeVector3Zero),r._btGImpactCollisionAlgorithm_RegisterAlgorithm(this._nativeDispatcher.a)}static __init__(){ir._nativeTempVector30=new Zt._physics3D.btVector3(0,0,0),ir._nativeTempVector31=new Zt._physics3D.btVector3(0,0,0),ir._nativeTempQuaternion0=new Zt._physics3D.btQuaternion(0,0,0,1),ir._nativeTempQuaternion1=new Zt._physics3D.btQuaternion(0,0,0,1),ir._nativeTempTransform0=new Zt._physics3D.btTransform,ir._nativeTempTransform1=new Zt._physics3D.btTransform}static createConstraint(){}get continuousCollisionDetection(){return this._nativeDispatchInfo.get_m_useContinuous()}set continuousCollisionDetection(e){this._nativeDispatchInfo.set_m_useContinuous(e)}get gravity(){if(!this._nativeDiscreteDynamicsWorld)throw"Simulation:Cannot perform this action when the physics engine is set to CollisionsOnly";return this._gravity}set gravity(e){if(!this._nativeDiscreteDynamicsWorld)throw"Simulation:Cannot perform this action when the physics engine is set to CollisionsOnly";this._gravity=e;var t=ir._nativeTempVector30;t.setValue(-e.x,e.y,e.z),this._nativeDiscreteDynamicsWorld.setGravity(t)}get speculativeContactRestitution(){if(!this._nativeDiscreteDynamicsWorld)throw"Simulation:Cannot Cannot perform this action when the physics engine is set to CollisionsOnly";return this._nativeDiscreteDynamicsWorld.getApplySpeculativeContactRestitution()}set speculativeContactRestitution(e){if(!this._nativeDiscreteDynamicsWorld)throw"Simulation:Cannot Cannot perform this action when the physics engine is set to CollisionsOnly";this._nativeDiscreteDynamicsWorld.setApplySpeculativeContactRestitution(e)}_simulate(e){this._updatedRigidbodies=0,this._nativeDiscreteDynamicsWorld?this._nativeDiscreteDynamicsWorld.stepSimulation(e,this.maxSubSteps,this.fixedTimeStep):this._nativeCollisionWorld.PerformDiscreteCollisionDetection()}_destroy(){var e=Zt._physics3D;this._nativeDiscreteDynamicsWorld?(e.destroy(this._nativeDiscreteDynamicsWorld),this._nativeDiscreteDynamicsWorld=null):(e.destroy(this._nativeCollisionWorld),this._nativeCollisionWorld=null),e.destroy(this._nativeBroadphase),this._nativeBroadphase=null,e.destroy(this._nativeDispatcher),this._nativeDispatcher=null,e.destroy(this._nativeCollisionConfiguration),this._nativeCollisionConfiguration=null}_addPhysicsCollider(e,t,r){this._nativeCollisionWorld.addCollisionObject(e._nativeColliderObject,t,r)}_removePhysicsCollider(e){this._nativeCollisionWorld.removeCollisionObject(e._nativeColliderObject)}_addRigidBody(e,t,r){if(!this._nativeDiscreteDynamicsWorld)throw"Simulation:Cannot perform this action when the physics engine is set to CollisionsOnly";this._nativeCollisionWorld.addRigidBody(e._nativeColliderObject,t,r)}_removeRigidBody(e){if(!this._nativeDiscreteDynamicsWorld)throw"Simulation:Cannot perform this action when the physics engine is set to CollisionsOnly";this._nativeCollisionWorld.removeRigidBody(e._nativeColliderObject)}_addCharacter(e,t,r){if(!this._nativeDiscreteDynamicsWorld)throw"Simulation:Cannot perform this action when the physics engine is set to CollisionsOnly";this._nativeCollisionWorld.addCollisionObject(e._nativeColliderObject,t,r),this._nativeCollisionWorld.addAction(e._nativeKinematicCharacter)}_removeCharacter(e){if(!this._nativeDiscreteDynamicsWorld)throw"Simulation:Cannot perform this action when the physics engine is set to CollisionsOnly";this._nativeCollisionWorld.removeCollisionObject(e._nativeColliderObject),this._nativeCollisionWorld.removeAction(e._nativeKinematicCharacter)}raycastFromTo(e,t,r=null,i=it.COLLISIONFILTERGROUP_ALLFILTER,a=it.COLLISIONFILTERGROUP_ALLFILTER){var n=this._nativeClosestRayResultCallback,s=ir._nativeTempVector30,o=ir._nativeTempVector31;if(s.setValue(-e.x,e.y,e.z),o.setValue(-t.x,t.y,t.z),n.set_m_rayFromWorld(s),n.set_m_rayToWorld(o),n.set_m_collisionFilterGroup(i),n.set_m_collisionFilterMask(a),n.set_m_collisionObject(null),n.set_m_closestHitFraction(1),this._nativeCollisionWorld.rayTest(s,o,n),n.hasHit()){if(r){r.succeeded=!0,r.collider=rr._physicObjectsMap[n.get_m_collisionObject().getUserIndex()],r.hitFraction=n.get_m_closestHitFraction();var l=n.get_m_hitPointWorld(),_=r.point;_.x=-l.x(),_.y=l.y(),_.z=l.z();var h=n.get_m_hitNormalWorld(),c=r.normal;c.x=-h.x(),c.y=h.y(),c.z=h.z()}return!0}return r&&(r.succeeded=!1),!1}raycastAllFromTo(e,t,r,i=it.COLLISIONFILTERGROUP_ALLFILTER,a=it.COLLISIONFILTERGROUP_ALLFILTER){var n=this._nativeAllHitsRayResultCallback,s=ir._nativeTempVector30,o=ir._nativeTempVector31;r.length=0,s.setValue(-e.x,e.y,e.z),o.setValue(-t.x,t.y,t.z),n.set_m_rayFromWorld(s),n.set_m_rayToWorld(o),n.set_m_collisionFilterGroup(i),n.set_m_collisionFilterMask(a);var l=n.get_m_collisionObjects(),_=n.get_m_hitPointWorld(),h=n.get_m_hitNormalWorld(),c=n.get_m_hitFractions();l.clear(),_.clear(),h.clear(),c.clear(),this._nativeCollisionWorld.rayTest(s,o,n);var d=l.size();if(d>0){this._collisionsUtils.recoverAllHitResultsPool();for(var u=0;u0){for(var g=_.get_m_hitPointWorld(),S=_.get_m_hitNormalWorld(),v=_.get_m_hitFractions(),R=0;R{e.cancelable&&e.preventDefault(),this._eventList.push(e)}).bind(this)}__init__(e,t){this._scene=t,e.oncontextmenu=function(e){return!1}}_onCanvasEvent(e){e.addEventListener("mousedown",this._pushEventList),e.addEventListener("mouseup",this._pushEventList,!0),e.addEventListener("mousemove",this._pushEventList,!0),e.addEventListener("touchstart",this._pushEventList),e.addEventListener("touchend",this._pushEventList,!0),e.addEventListener("touchmove",this._pushEventList,!0),e.addEventListener("touchcancel",this._pushEventList,!0)}_offCanvasEvent(e){e.removeEventListener("mousedown",this._pushEventList),e.removeEventListener("mouseup",this._pushEventList,!0),e.removeEventListener("mousemove",this._pushEventList,!0),e.removeEventListener("touchstart",this._pushEventList),e.removeEventListener("touchend",this._pushEventList,!0),e.removeEventListener("touchmove",this._pushEventList,!0),e.removeEventListener("touchcancel",this._pushEventList,!0),this._eventList.length=0,this._touches.length=0}touchCount(){return this._touches.length}get multiTouchEnabled(){return this._multiTouchEnabled}set multiTouchEnabled(e){this._multiTouchEnabled=e}_getTouch(e){var t=this._touchPool[e];return t||(t=new zt,this._touchPool[e]=t,t._identifier=e),t}_mouseTouchDown(){var e=this._mouseTouch,r=e.sprite;if(e._pressedSprite=r,e._pressedLoopCount=t.Stat.loopCount,r){var i=r._scripts;if(i)for(var a=0,n=i.length;a=0;s--){var o=e[s],l=o.viewport;if(r.x>=l.x&&r.y>=l.y&&r.x<=l.width&&r.y<=l.height)if(o.viewportPointToRay(r,i),this._scene._physicsSimulation.rayCast(i,t)||o.clearFlag===Oe.CLEARFLAG_SOLIDCOLOR||o.clearFlag===Oe.CLEARFLAG_SKY)break}var _=this._mouseTouch,h=_.sprite;if(t.succeeded){var c=t.collider.owner;_.sprite=c;var d=c._scripts;if(h!==c&&d)for(var u=0,f=d.length;u0){var o=!1;for(e=0;ec._pressedLoopCount){var u=d._scripts;if(u)for(i=0,a=u.length;i0){this._bufferState.bind();var r=t.LayaGL.instance;r.drawArrays(r.LINES,0,2*this._lineCount),t.Stat.renderBatches++}}destroy(){this._destroyed||(super.destroy(),this._bufferState.destroy(),this._vertexBuffer.destroy(),this._bufferState=null,this._vertexBuffer=null,this._vertices=null)}}cr._tempVector0=new n,cr._tempVector1=new n,cr._type=_e._typeCounter++;class dr extends je{constructor(e){super(e),this._projectionViewWorldMatrix=new p}_calculateBoundingBox(){var e=this._owner.transform.worldMatrix,r=this._owner._geometryFilter;if(r._reCalculateBound(),r._bounds._tranform(e,this._bounds),t.Render.supportWebGLPlusCulling){var i=this._bounds.getMin(),a=this._bounds.getMax(),n=oe._cullingBuffer;n[this._cullingBufferIndex+1]=i.x,n[this._cullingBufferIndex+2]=i.y,n[this._cullingBufferIndex+3]=i.z,n[this._cullingBufferIndex+4]=a.x,n[this._cullingBufferIndex+5]=a.y,n[this._cullingBufferIndex+6]=a.z}}_renderUpdateWithCamera(e,t){var r=e.projectionViewMatrix,i=this._shaderValues;if(t){var a=t.worldMatrix;i.setMatrix4x4(ae.WORLDMATRIX,a),p.multiply(r,a,this._projectionViewWorldMatrix),i.setMatrix4x4(ae.MVPMATRIX,this._projectionViewWorldMatrix)}else i.setMatrix4x4(ae.WORLDMATRIX,p.DEFAULT),i.setMatrix4x4(ae.MVPMATRIX,r)}}class ur extends ne{get maxLineCount(){return this._geometryFilter._maxLineCount}set maxLineCount(e){this._geometryFilter._resizeLineData(e),this._geometryFilter._lineCount=Math.min(this._geometryFilter._lineCount,e)}get lineCount(){return this._geometryFilter._lineCount}set lineCount(e){if(e>this.maxLineCount)throw"PixelLineSprite3D: lineCount can't large than maxLineCount";this._geometryFilter._lineCount=e}get pixelLineRenderer(){return this._render}constructor(e=2,t=null){super(t),this._geometryFilter=new cr(this,e),this._render=new dr(this),this._changeRenderObjects(this._render,0,bt.defaultMaterial)}_changeRenderObjects(e,t,r){var i=this._render._renderElements;r||(r=bt.defaultMaterial);var a=i[t];a||(a=i[t]=new Ge),a.setTransform(this._transform),a.setGeometry(this._geometryFilter),a.render=this._render,a.material=r}addLine(e,t,r,i){if(this._geometryFilter._lineCount===this._geometryFilter._maxLineCount)throw"PixelLineSprite3D: lineCount has equal with maxLineCount.";this._geometryFilter._updateLineData(this._geometryFilter._lineCount++,e,t,r,i)}addLines(e){var t=this._geometryFilter._lineCount,r=e.length;if(t+r>this._geometryFilter._maxLineCount)throw"PixelLineSprite3D: lineCount plus lines count must less than maxLineCount.";this._geometryFilter._updateLineDatas(t,e),this._geometryFilter._lineCount+=r}removeLine(e){if(!(e0;)t--;if(e1){var r=this._partitionRenderObject(e,t),i=r-1;e=0;i--){var a=r[i];this._objects.push(a),a._setOctreeNode(this)}}}this._children=null}_merge(){if(null===this._children){var e=this._parent;e&&e._shouldMerge()&&(e._mergeChildren(),e._merge())}}_checkAddNode(e){if(null==this._children){if(this._objects.length=0;t--){var r=this._objects[t],i=this._bestFitChild(r.bounds.getCenter());mr._encapsulates(this._getChildBound(i),r.bounds._getBoundBox())&&(this._objects.splice(this._objects.indexOf(r),1),this._getChild(i)._add(r))}}var a=this._bestFitChild(e.bounds.getCenter());return mr._encapsulates(this._getChildBound(a),e.bounds._getBoundBox())?this._getChild(a)._checkAddNode(e):this}_add(e){var t=this._checkAddNode(e);t._objects.push(e),e._setOctreeNode(t)}_remove(e){var t=this._objects.indexOf(e);this._objects.splice(t,1),e._setOctreeNode(null),this._merge()}_addUp(e){return ve.boxContainsBox(this._bounds,e.bounds._getBoundBox())===Se.Contains?(this._add(e),!0):!!this._parent&&this._parent._addUp(e)}_getCollidingWithFrustum(e,r,i,a,s,o){if(i){var l=r.containsBoundBox(this._bounds);if(t.Stat.octreeNodeCulling++,l===Se.Disjoint)return;i=l===Se.Intersects}this._isContaion=!i;for(var _=e.camera,h=e.scene,c=0,d=this._objects.length;c=this.center.y?0:4)+(e.z<=this.center.z?0:2)}_update(e){if(ve.boxContainsBox(this._bounds,e.bounds._getBoundBox())===Se.Contains){var t=this._checkAddNode(e);if(t!==e._getOctreeNode()){t._objects.push(e),e._setOctreeNode(t);var r=this._objects.indexOf(e);this._objects.splice(r,1),this._merge()}return!0}if(this._parent){var i=this._parent._addUp(e);return i&&(r=this._objects.indexOf(e),this._objects.splice(r,1),this._merge()),i}return!1}add(e){return!!mr._encapsulates(this._bounds,e.bounds._getBoundBox())&&(this._add(e),!0)}remove(e){return e._getOctreeNode()===this&&(this._remove(e),!0)}update(e){return e._getOctreeNode()===this&&this._update(e)}shrinkIfPossible(e){if(this.baseLength<2*e)return this;for(var t=-1,r=0,i=this._objects.length;r=0&&t!=r)return this;l=!0,t=r}}if(-1!=t){var h=this._children[t];return h._parent=null,h}return this}hasAnyObjects(){if(this._objects.length>0)return!0;if(null!=this._children)for(var e=0;e<8;e++){var t=this._children[e];if(t&&t.hasAnyObjects())return!0}return!1}getCollidingWithBoundBox(e,t){this._getCollidingWithBoundBox(e,!0,t)}getCollidingWithRay(e,t,r=Number.MAX_VALUE){var i=ve.intersectsRayAndBoxRD(e,this._bounds);if(!(-1==i||i>r)){for(var a=0,n=this._objects.length;at)return!1;for(var i=0,a=this._objects.length;ie&&(console.warn("Minimum node size must be at least as big as the initial world size. Was: "+r+" Adjusted to: "+e),r=e),this._initialSize=e,this._minSize=r,this._looseness=Math.min(Math.max(i,1),2),this._rootNode=new mr(this,null,e,t)}_getMaxDepth(e,t){t++;var r=e._children;if(null!=r)for(var i=t,a=0,n=r.length;a=0?1:-1,r=e.y>=0?1:-1,i=e.z>=0?1:-1,a=this._rootNode,s=this._rootNode.baseLength/2,o=2*this._rootNode.baseLength,l=this._rootNode.center,_=new n(l.x+t*s,l.y+r*s,l.z+i*s);if(this._rootNode=new mr(this,null,o,_),a.hasAnyObjects()){for(var h=this._rootNode._bestFitChild(a.center),c=[],d=0;d<8;d++)d==h&&(a._parent=this._rootNode,c[d]=a);this._rootNode._children=c}}add(e){for(var t=0;!this._rootNode.add(e);){var r=Tr._tempVector30;if(n.subtract(e.bounds.getCenter(),this._rootNode.center,r),this._grow(r),++t>20)throw"Aborted Add operation as it seemed to be going on forever ("+(t-1)+") attempts at growing the octree."}this.count++}remove(e){var t=e._getOctreeNode().remove(e);return t&&this.count--,t}update(e){var t=0,r=e._getOctreeNode();if(r){for(;!r._update(e);){var i=Tr._tempVector30;if(n.subtract(e.bounds.getCenter(),this._rootNode.center,i),this._grow(i),++t>20)throw"Aborted Add operation as it seemed to be going on forever ("+(t-1)+") attempts at growing the octree."}return!0}return!1}shrinkRootIfPossible(){this._rootNode=this._rootNode.shrinkIfPossible(this._initialSize)}addMotionObject(e){this._motionObjects.add(e)}removeMotionObject(e){this._motionObjects.remove(e)}updateMotionObjects(){for(var e=this._motionObjects.elements,t=0,r=this._motionObjects.length;te._renderingOrder?i=t-1:r=t+1}return r}onEnable(){this._input._onCanvasEvent(t.Render.canvas)}onDisable(){this._input._offCanvasEvent(t.Render.canvas)}_setCreateURL(e){this._url=t.URL.formatURL(e)}_getGroup(){return this._group}_setGroup(e){this._group=e}_clearScript(){if(this._needClearScriptPool){for(var e=this._scriptPool,t=0,r=e.length;t0){for(var l=this._directionLights.getSunLight(),_=0;_0){var f=this._pointLights._elements;for(_=0;_0){var T=this._spotLights._elements;for(_=0;_0&&t.setSubPixels(0,0,s,i,r,0),e.setTexture(pr.LIGHTBUFFER,t),e.setInt(pr.DIRECTIONLIGHTCOUNT,this._directionLights._length),e.setTexture(pr.CLUSTERBUFFER,Te.instance._clusterTexture)}else{if(this._directionLights._length>0){var g=this._directionLights._elements[0];n.scale(g.color,g._intensity,g._intensityColor),g.transform.worldMatrix.getForward(g._direction),n.normalize(g._direction,g._direction),e.setVector3(pr.LIGHTDIRCOLOR,g._intensityColor),e.setVector3(pr.LIGHTDIRECTION,g._direction),e.setVector3(pr.SUNLIGHTDIRCOLOR,g._intensityColor),e.setVector3(pr.SUNLIGHTDIRECTION,g._direction),e.addDefine(k.SHADERDEFINE_DIRECTIONLIGHT)}else e.removeDefine(k.SHADERDEFINE_DIRECTIONLIGHT);if(this._pointLights._length>0){var S=this._pointLights._elements[0];n.scale(S.color,S._intensity,S._intensityColor),e.setVector3(pr.POINTLIGHTCOLOR,S._intensityColor),e.setVector3(pr.POINTLIGHTPOS,S.transform.position),e.setNumber(pr.POINTLIGHTRANGE,S.range),e.addDefine(k.SHADERDEFINE_POINTLIGHT)}else e.removeDefine(k.SHADERDEFINE_POINTLIGHT);if(this._spotLights._length>0){var v=this._spotLights._elements[0];n.scale(v.color,v._intensity,v._intensityColor),e.setVector3(pr.SPOTLIGHTCOLOR,v._intensityColor),e.setVector3(pr.SPOTLIGHTPOS,v.transform.position),v.transform.worldMatrix.getForward(v._direction),n.normalize(v._direction,v._direction),e.setVector3(pr.SPOTLIGHTDIRECTION,v._direction),e.setNumber(pr.SPOTLIGHTRANGE,v.range),e.setNumber(pr.SPOTLIGHTSPOTANGLE,v.spotAngle*Math.PI/180),e.addDefine(k.SHADERDEFINE_SPOTLIGHT)}else e.removeDefine(k.SHADERDEFINE_SPOTLIGHT)}}_addCamera(e){for(var t=this._binarySearchIndexInCameraPool(e),r=e._renderingOrder,i=this._cameraPool.length;t=i){var a=this._cullingBufferIndices,n=this._cullingBufferResult;this._cullingBufferIndices=new Int32Array(i+1024),this._cullingBufferResult=new Int32Array(i+1024),this._cullingBufferIndices.set(a,0),this._cullingBufferResult.set(n,0)}this._cullingBufferIndices[r]=e._cullingBufferIndex}}_removeRenderObject(e){var r;this._octree&&e._supportOctree?this._octree.remove(e):(t.Render.supportWebGLPlusCulling&&(r=this._renders.elements[this._renders.length-1]),this._renders.remove(e),t.Render.supportWebGLPlusCulling&&(this._cullingBufferIndices[r._getIndexInList()]=r._cullingBufferIndex))}_addShadowCastRenderObject(e){this._octree||this._castShadowRenders.add(e)}_removeShadowCastRenderObject(e){this._octree||this._castShadowRenders.remove(e)}_getRenderQueue(e){return e<=2500?this._opaqueQueue:this._transparentQueue}setlightmaps(e){for(var t=this._lightmaps,r=0,i=t.length;r0&&e.addRenderObject(this)}renderSubmit(){var e,r,i;t.LayaGL.instance;for(this._prepareSceneToRender(),e=0,i=(r=this._cameraPool.length)-1;e=r.zeroTolerance?(this._isTempEndVertex?(_=this._endIndex-1,h=c-this._subDistance[_],this._updateVerticesByPosition(i,s,c,_),this._owner._totalLength+=h):(this._endIndex===this._segementCount&&this._resetData(),this._updateVerticesByPosition(i,s,c,this._endIndex),this._owner._totalLength+=c,this._endIndex++),i.cloneTo(this._lastFixedVertexPosition),this._isTempEndVertex=!1):(this._isTempEndVertex?(_=this._endIndex-1,h=c-this._subDistance[_],this._updateVerticesByPosition(i,s,c,_),this._owner._totalLength+=h):(this._endIndex===this._segementCount&&this._resetData(),this._updateVerticesByPosition(i,s,c,this._endIndex),this._owner._totalLength+=c,this._endIndex++),this._isTempEndVertex=!0)}_updateVerticesByPositionData(e,r,i){var a=2*this._floatCountPerVertices1*i,s=this._owner._curtime;this._vertices1[a]=e.x,this._vertices1[a+1]=e.y,this._vertices1[a+2]=e.z,this._vertices1[a+3]=-r.x,this._vertices1[a+4]=-r.y,this._vertices1[a+5]=-r.z,this._vertices1[a+6]=s,this._vertices1[a+7]=1,this._vertices1[a+8]=e.x,this._vertices1[a+9]=e.y,this._vertices1[a+10]=e.z,this._vertices1[a+11]=r.x,this._vertices1[a+12]=r.y,this._vertices1[a+13]=r.z,this._vertices1[a+14]=s,this._vertices1[a+15]=0;var o=this._owner._owner.trailRenderer.bounds,l=o.getMin(),_=o.getMax(),h=Dr._tempVector35,c=Dr._tempVector36,d=Dr._tempVector32;n.add(e,r,h),n.subtract(e,r,c),n.min(c,h,d),n.min(l,d,l),o.setMin(l),n.max(h,c,d),n.max(_,d,_),o.setMax(_),t.Render.supportWebGLPlusCulling&&this._calculateBoundingBoxForNative();var u=2*this._floatCountPerVertices1;this._vertexBuffer1.setData(this._vertices1.buffer,4*a,4*a,4*u)}_updateVerticesByPosition(e,t,r,i){this._updateVerticesByPositionData(e,t,i),this._subDistance[i]=r,this._subBirthTime[i]=this._owner._curtime}_updateVertexBufferUV(){var e,r,i;this._disappearBoundsMode&&(r=(e=this._owner._owner.trailRenderer.bounds).getMin(),i=e.getMax(),r.setValue(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),i.setValue(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),t.Render.supportWebGLPlusCulling&&this._calculateBoundingBoxForNative());for(var a=this._endIndex,s=0,o=this._owner.colorGradient,l=o.colorAlphaKeysCount-1,_=o.colorRGBKeysCount-1,h=this._owner._totalLength,c=2*this._floatCountPerVertices2,d=this._activeIndex;d=this._owner.time+r.zeroTolerance;t++){var i=t+1;if(i!==e&&(this._owner._totalLength-=this._subDistance[i]),this._isTempEndVertex&&i===e-1){this._floatCountPerVertices1;var a=this._lastFixedVertexPosition;a.x=this._vertices1[0],a.y=this._vertices1[1],a.z=this._vertices1[2],this._isTempEndVertex=!1}this._activeIndex++,this._disappearBoundsMode=!0}}_getType(){return Dr._type}_prepareRender(e){return this._endIndex-this._activeIndex>1}_render(e){this._bufferState.bind();var r=t.LayaGL.instance,i=2*this._activeIndex,a=2*this._endIndex-i;r.drawArrays(r.TRIANGLE_STRIP,i,a),t.Stat.renderBatches++,t.Stat.trianglesFaces+=a-2}destroy(){super.destroy();var e=this._vertexBuffer1._byteLength+this._vertexBuffer2._byteLength;t.Resource._addMemory(-e,-e),this._bufferState.destroy(),this._vertexBuffer1.destroy(),this._vertexBuffer2.destroy(),this._bufferState=null,this._vertices1=null,this._vertexBuffer1=null,this._vertices2=null,this._vertexBuffer2=null,this._subBirthTime=null,this._subDistance=null,this._lastFixedVertexPosition=null,this._disappearBoundsMode=!1}_calculateBoundingBoxForNative(){var e=this._owner._owner.trailRenderer,t=e.bounds,r=t.getMin(),i=t.getMax(),a=oe._cullingBuffer;a[e._cullingBufferIndex+1]=r.x,a[e._cullingBufferIndex+2]=r.y,a[e._cullingBufferIndex+3]=r.z,a[e._cullingBufferIndex+4]=i.x,a[e._cullingBufferIndex+5]=i.y,a[e._cullingBufferIndex+6]=i.z}}Dr.ALIGNMENT_VIEW=0,Dr.ALIGNMENT_TRANSFORM_Z=1,Dr._tempVector30=new n,Dr._tempVector31=new n,Dr._tempVector32=new n,Dr._tempVector33=new n,Dr._tempVector34=new n,Dr._tempVector35=new n,Dr._tempVector36=new n,Dr._type=_e._typeCounter++;class Mr{constructor(e){this._totalLength=0,this._lastPosition=new n,this._curtime=0,this.alignment=Mr.ALIGNMENT_VIEW,this._owner=e,this._initDefaultData(),this.addRenderElement()}get time(){return this._time}set time(e){this._time=e,this._owner._render._shaderValues.setNumber(Mr.LIFETIME,e)}get minVertexDistance(){return this._minVertexDistance}set minVertexDistance(e){this._minVertexDistance=e}get widthMultiplier(){return this._widthMultiplier}set widthMultiplier(e){this._widthMultiplier=e}get widthCurve(){return this._widthCurve}set widthCurve(e){this._widthCurve=e;var t,r,i=new Float32Array(4*e.length),a=0;for(t=0,r=e.length;t0&&(t^=rr.COLLISIONFLAGS_KINEMATIC_OBJECT),t|=rr.COLLISIONFLAGS_STATIC_OBJECT):((t&rr.COLLISIONFLAGS_STATIC_OBJECT)>0&&(t^=rr.COLLISIONFLAGS_STATIC_OBJECT),t|=rr.COLLISIONFLAGS_KINEMATIC_OBJECT),e.setCollisionFlags(t),this._nativeColliderObject=e,super._onAdded()}}class wr extends Nr{constructor(e=it.COLLISIONFILTERGROUP_DEFAULTFILTER,t=it.COLLISIONFILTERGROUP_ALLFILTER){super(e,t),this._isKinematic=!1,this._mass=1,this._gravity=new n(0,-10,0),this._angularDamping=0,this._linearDamping=0,this._overrideGravity=!1,this._totalTorque=new n(0,0,0),this._totalForce=new n(0,0,0),this._linearVelocity=new n,this._angularVelocity=new n,this._linearFactor=new n(1,1,1),this._angularFactor=new n(1,1,1),this._detectCollisions=!0}static __init__(){wr._nativeTempVector30=new Zt._physics3D.btVector3(0,0,0),wr._nativeTempVector31=new Zt._physics3D.btVector3(0,0,0),wr._nativeVector3Zero=new Zt._physics3D.btVector3(0,0,0),wr._nativeInertia=new Zt._physics3D.btVector3(0,0,0),wr._nativeImpulse=new Zt._physics3D.btVector3(0,0,0),wr._nativeImpulseOffset=new Zt._physics3D.btVector3(0,0,0),wr._nativeGravity=new Zt._physics3D.btVector3(0,0,0)}get mass(){return this._mass}set mass(e){e=Math.max(e,1e-7),this._mass=e,this._isKinematic||this._updateMass(e)}get isKinematic(){return this._isKinematic}set isKinematic(e){this._isKinematic=e;var t=!!(this._simulation&&this._enabled&&this._colliderShape);t&&this._removeFromSimulation();var r=this._nativeColliderObject,i=r.getCollisionFlags();e?(i|=rr.COLLISIONFLAGS_KINEMATIC_OBJECT,r.setCollisionFlags(i),this._nativeColliderObject.forceActivationState(rr.ACTIVATIONSTATE_DISABLE_DEACTIVATION),this._enableProcessCollisions=!1,this._updateMass(0)):((i&rr.COLLISIONFLAGS_KINEMATIC_OBJECT)>0&&(i^=rr.COLLISIONFLAGS_KINEMATIC_OBJECT),r.setCollisionFlags(i),this._nativeColliderObject.setActivationState(rr.ACTIVATIONSTATE_ACTIVE_TAG),this._enableProcessCollisions=!0,this._updateMass(this._mass));var a=wr._nativeVector3Zero;r.setInterpolationLinearVelocity(a),r.setLinearVelocity(a),r.setInterpolationAngularVelocity(a),r.setAngularVelocity(a),t&&this._addToSimulation()}get linearDamping(){return this._linearDamping}set linearDamping(e){this._linearDamping=e,this._nativeColliderObject&&this._nativeColliderObject.setDamping(e,this._angularDamping)}get angularDamping(){return this._angularDamping}set angularDamping(e){this._angularDamping=e,this._nativeColliderObject&&this._nativeColliderObject.setDamping(this._linearDamping,e)}get overrideGravity(){return this._overrideGravity}set overrideGravity(e){if(this._overrideGravity=e,this._nativeColliderObject){var t=this._nativeColliderObject.getFlags();e?0==(t&wr._BT_DISABLE_WORLD_GRAVITY)&&this._nativeColliderObject.setFlags(t|wr._BT_DISABLE_WORLD_GRAVITY):(t&wr._BT_DISABLE_WORLD_GRAVITY)>0&&this._nativeColliderObject.setFlags(t^wr._BT_DISABLE_WORLD_GRAVITY)}}get gravity(){return this._gravity}set gravity(e){this._gravity=e,wr._nativeGravity.setValue(-e.x,e.y,e.z),this._nativeColliderObject.setGravity(wr._nativeGravity)}get totalForce(){if(this._nativeColliderObject){var e=this._nativeColliderObject.getTotalForce();return A._convertToLayaVec3(e,this._totalForce,!0),this._totalForce}return null}get linearFactor(){return this._nativeColliderObject?this._linearFactor:null}set linearFactor(e){if(this._linearFactor=e,this._nativeColliderObject){var t=wr._nativeTempVector30;A._convertToBulletVec3(e,t,!1),this._nativeColliderObject.setLinearFactor(t)}}get linearVelocity(){return this._nativeColliderObject&&A._convertToLayaVec3(this._nativeColliderObject.getLinearVelocity(),this._linearVelocity,!0),this._linearVelocity}set linearVelocity(e){if(this._linearVelocity=e,this._nativeColliderObject){var t=wr._nativeTempVector30;A._convertToBulletVec3(e,t,!0),this.isSleeping&&this.wakeUp(),this._nativeColliderObject.setLinearVelocity(t)}}get angularFactor(){return this._nativeColliderObject?this._angularFactor:null}set angularFactor(e){if(this._angularFactor=e,this._nativeColliderObject){var t=wr._nativeTempVector30;A._convertToBulletVec3(e,t,!1),this._nativeColliderObject.setAngularFactor(t)}}get angularVelocity(){return this._nativeColliderObject&&A._convertToLayaVec3(this._nativeColliderObject.getAngularVelocity(),this._angularVelocity,!0),this._angularVelocity}set angularVelocity(e){if(this._angularVelocity=e,this._nativeColliderObject){var t=wr._nativeTempVector30;A._convertToBulletVec3(e,t,!0),this.isSleeping&&this.wakeUp(),this._nativeColliderObject.setAngularVelocity(t)}}get totalTorque(){if(this._nativeColliderObject){var e=this._nativeColliderObject.getTotalTorque();return A._convertToLayaVec3(e,this._totalTorque,!0),this._totalTorque}return null}get detectCollisions(){return this._detectCollisions}set detectCollisions(e){this._detectCollisions!==e&&(this._detectCollisions=e,this._colliderShape&&this._enabled&&this._simulation&&(this._simulation._removeRigidBody(this),this._simulation._addRigidBody(this,this._collisionGroup,e?this._canCollideWith:0)))}get isSleeping(){return!!this._nativeColliderObject&&this._nativeColliderObject.getActivationState()===rr.ACTIVATIONSTATE_ISLAND_SLEEPING}get sleepLinearVelocity(){return this._nativeColliderObject.getLinearSleepingThreshold()}set sleepLinearVelocity(e){this._nativeColliderObject.setSleepingThresholds(e,this._nativeColliderObject.getAngularSleepingThreshold())}get sleepAngularVelocity(){return this._nativeColliderObject.getAngularSleepingThreshold()}set sleepAngularVelocity(e){this._nativeColliderObject.setSleepingThresholds(this._nativeColliderObject.getLinearSleepingThreshold(),e)}_updateMass(e){this._nativeColliderObject&&this._colliderShape&&(this._colliderShape._nativeShape.calculateLocalInertia(e,wr._nativeInertia),this._nativeColliderObject.setMassProps(e,wr._nativeInertia),this._nativeColliderObject.updateInertiaTensor())}_delegateMotionStateGetWorldTransform(e){}_delegateMotionStateSetWorldTransform(e){var t=this._rigidbody;t._simulation._updatedRigidbodies++;var r=Zt._physics3D,i=r.wrapPointer(e,r.btTransform);t._updateTransformComponent(i)}_delegateMotionStateGetWorldTransformNative(e,t){}_delegateMotionStateSetWorldTransformNative(e,t){var r=e;r._simulation._updatedRigidbodies++;var i=Zt._physics3D,a=i.wrapPointer(t,i.btTransform);r._updateTransformComponent(a)}_onScaleChange(e){super._onScaleChange(e),this._updateMass(this._isKinematic?0:this._mass)}_delegateMotionStateClear(){this._rigidbody=null}_onAdded(){var e=Zt._physics3D,t=new e.LayaMotionState;null!=window.conch&&e.LayaMotionState.prototype.setRigidbody?(t.setRigidbody(this),t.setNativeGetWorldTransform(this._delegateMotionStateGetWorldTransformNative),t.setNativeSetWorldTransform(this._delegateMotionStateSetWorldTransformNative)):(t.getWorldTransform=this._delegateMotionStateGetWorldTransform,t.setWorldTransform=this._delegateMotionStateSetWorldTransform),t.clear=this._delegateMotionStateClear,t._rigidbody=this,this._nativeMotionState=t;var r=new e.btRigidBodyConstructionInfo(0,t,null,wr._nativeVector3Zero),i=new e.btRigidBody(r);i.setUserIndex(this.id),this._nativeColliderObject=i,super._onAdded(),this.mass=this._mass,this.linearFactor=this._linearFactor,this.angularFactor=this._angularFactor,this.linearDamping=this._linearDamping,this.angularDamping=this._angularDamping,this.overrideGravity=this._overrideGravity,this.gravity=this._gravity,this.isKinematic=this._isKinematic,e.destroy(r)}_onShapeChange(e){super._onShapeChange(e),this._isKinematic?this._updateMass(0):(this._nativeColliderObject.setCenterOfMassTransform(this._nativeColliderObject.getWorldTransform()),this._updateMass(this._mass))}_parse(e){null!=e.friction&&(this.friction=e.friction),null!=e.rollingFriction&&(this.rollingFriction=e.rollingFriction),null!=e.restitution&&(this.restitution=e.restitution),null!=e.isTrigger&&(this.isTrigger=e.isTrigger),null!=e.mass&&(this.mass=e.mass),null!=e.isKinematic&&(this.isKinematic=e.isKinematic),null!=e.linearDamping&&(this.linearDamping=e.linearDamping),null!=e.angularDamping&&(this.angularDamping=e.angularDamping),null!=e.overrideGravity&&(this.overrideGravity=e.overrideGravity),e.gravity&&(this.gravity.fromArray(e.gravity),this.gravity=this.gravity),super._parse(e),this._parseShape(e.shapes)}_onDestroy(){var e=Zt._physics3D;this._nativeMotionState.clear(),e.destroy(this._nativeMotionState),super._onDestroy(),this._nativeMotionState=null,this._gravity=null,this._totalTorque=null,this._linearVelocity=null,this._angularVelocity=null,this._linearFactor=null,this._angularFactor=null}_addToSimulation(){this._simulation._addRigidBody(this,this._collisionGroup,this._detectCollisions?this._canCollideWith:0)}_removeFromSimulation(){this._simulation._removeRigidBody(this)}_cloneTo(e){super._cloneTo(e);var t=e;t.isKinematic=this._isKinematic,t.mass=this._mass,t.gravity=this._gravity,t.angularDamping=this._angularDamping,t.linearDamping=this._linearDamping,t.overrideGravity=this._overrideGravity,t.linearVelocity=this._linearVelocity,t.angularVelocity=this._angularVelocity,t.linearFactor=this._linearFactor,t.angularFactor=this._angularFactor,t.detectCollisions=this._detectCollisions}applyForce(e,t=null){if(null==this._nativeColliderObject)throw"Attempted to call a Physics function that is avaliable only when the Entity has been already added to the Scene.";var r=wr._nativeTempVector30;if(r.setValue(-e.x,e.y,e.z),t){var i=wr._nativeTempVector31;i.setValue(-t.x,t.y,t.z),this._nativeColliderObject.applyForce(r,i)}else this._nativeColliderObject.applyCentralForce(r)}applyTorque(e){if(null==this._nativeColliderObject)throw"Attempted to call a Physics function that is avaliable only when the Entity has been already added to the Scene.";var t=wr._nativeTempVector30;t.setValue(-e.x,e.y,e.z),this._nativeColliderObject.applyTorque(t)}applyImpulse(e,t=null){if(null==this._nativeColliderObject)throw"Attempted to call a Physics function that is avaliable only when the Entity has been already added to the Scene.";wr._nativeImpulse.setValue(-e.x,e.y,e.z),t?(wr._nativeImpulseOffset.setValue(-t.x,t.y,t.z),this._nativeColliderObject.applyImpulse(wr._nativeImpulse,wr._nativeImpulseOffset)):this._nativeColliderObject.applyCentralImpulse(wr._nativeImpulse)}applyTorqueImpulse(e){if(null==this._nativeColliderObject)throw"Attempted to call a Physics function that is avaliable only when the Entity has been already added to the Scene.";var t=wr._nativeTempVector30;t.setValue(-e.x,e.y,e.z),this._nativeColliderObject.applyTorqueImpulse(t)}wakeUp(){this._nativeColliderObject&&this._nativeColliderObject.activate(!1)}clearForces(){var e=this._nativeColliderObject;if(null==e)throw"Attempted to call a Physics function that is avaliable only when the Entity has been already added to the Scene.";e.clearForces();var t=wr._nativeVector3Zero;e.setInterpolationLinearVelocity(t),e.setLinearVelocity(t),e.setInterpolationAngularVelocity(t),e.setAngularVelocity(t)}}wr.TYPE_STATIC=0,wr.TYPE_DYNAMIC=1,wr.TYPE_KINEMATIC=2,wr._BT_DISABLE_WORLD_GRAVITY=1,wr._BT_ENABLE_GYROPSCOPIC_FORCE=2;class Vr extends jt{static __init__(){Vr._nativeNormal=new Zt._physics3D.btVector3(0,0,0)}constructor(e,t){super(),this._normal=e,this._offset=t,this._type=jt.SHAPETYPES_STATICPLANE,Vr._nativeNormal.setValue(-e.x,e.y,e.z),this._nativeShape=new Zt._physics3D.btStaticPlaneShape(Vr._nativeNormal,t)}clone(){var e=new Vr(this._normal,this._offset);return this.cloneTo(e),e}}class br extends _e{constructor(e){super(),this._id=++br._uniqueIDCounter,this._mesh=e,this._boneIndicesList=[],this._subIndexBufferStart=[],this._subIndexBufferCount=[]}get indexCount(){return this._indexCount}_setIndexRange(e,t){this._indexStart=e,this._indexCount=t,this._indices=new Uint16Array(this._indexBuffer.getData().buffer,2*e,t)}_getType(){return br._type}_prepareRender(e){return this._mesh._uploadVerticesData(),!0}_render(e){var r=t.LayaGL.instance;this._mesh._bufferState.bind();var i=e.renderElement.render._skinnedData;if(i)for(var a=i[this._indexInMesh],n=this._boneIndicesList.length,s=0;s>n,1),Math.max(e>>n,1));this._setGPUMemory(e*e*4*(1+1/3)*6)}else this._mipmapCount=1,this._setGPUMemory(e*e*4*6)}static __init__(){var e=new Uint8Array(3);e[0]=128,e[1]=128,e[2]=128,Hr.grayTexture=new Hr(1,t.TextureFormat.R8G8B8,!1),Hr.grayTexture.setSixSidePixels([e,e,e,e,e,e]),Hr.grayTexture.lock=!0}static _parse(e,t=null,r=null){var i=r?new Hr(0,r[0],r[1]):new Hr(0);return i.setSixSideImageSources(e),i}static load(e,r){t.ILaya.loader.create(e,r,null,Hr.TEXTURECUBE)}get defaulteTexture(){return Hr.grayTexture}_setPixels(e,r,i,a){var n=t.LayaGL.instance,s=this._getGLFormat();t.WebGLContext.bindTexture(n,this._glTextureType,this._glTexture),this.format===t.TextureFormat.R8G8B8?(n.pixelStorei(n.UNPACK_ALIGNMENT,1),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_Z,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[0]),n.texImage2D(n.TEXTURE_CUBE_MAP_NEGATIVE_Z,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[1]),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[2]),n.texImage2D(n.TEXTURE_CUBE_MAP_NEGATIVE_X,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[3]),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_Y,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[4]),n.texImage2D(n.TEXTURE_CUBE_MAP_NEGATIVE_Y,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[5]),n.pixelStorei(n.UNPACK_ALIGNMENT,4)):(n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_Z,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[0]),n.texImage2D(n.TEXTURE_CUBE_MAP_NEGATIVE_Z,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[1]),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[2]),n.texImage2D(n.TEXTURE_CUBE_MAP_NEGATIVE_X,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[3]),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_Y,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[4]),n.texImage2D(n.TEXTURE_CUBE_MAP_NEGATIVE_Y,r,s,i,a,0,s,n.UNSIGNED_BYTE,e[5]))}setSixSideImageSources(e,r=!1){for(var i,a,n=0;n<6;n++){var s=e[n];if(!s)return void console.log("TextureCube: image Source can't be null.");var o=s.width,l=s.height;if(n>0&&i!==o)return void console.log("TextureCube: each side image's width and height must same.");if((i=o)!==(a=l))return void console.log("TextureCube: each side image's width and height must same.")}this._width=i,this._height=a;var _=t.LayaGL.instance;t.WebGLContext.bindTexture(_,this._glTextureType,this._glTexture);var h=this._getGLFormat();if(t.Render.isConchApp){if(1==r)for(var c=0;c<6;c++)e[c].setPremultiplyAlpha(r);_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_Z,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,e[0]),_.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,e[1]),_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_X,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,e[2]),_.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_X,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,e[3]),_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_Y,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,e[4]),_.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,e[5])}else r&&_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_Z,0,h,h,_.UNSIGNED_BYTE,e[0]),_.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,h,h,_.UNSIGNED_BYTE,e[1]),_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_X,0,h,h,_.UNSIGNED_BYTE,e[2]),_.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_X,0,h,h,_.UNSIGNED_BYTE,e[3]),_.texImage2D(_.TEXTURE_CUBE_MAP_POSITIVE_Y,0,h,h,_.UNSIGNED_BYTE,e[4]),_.texImage2D(_.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,h,h,_.UNSIGNED_BYTE,e[5]),r&&_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);this._mipmap&&this._isPot(i)&&this._isPot(a)?(_.generateMipmap(this._glTextureType),this._setGPUMemory(i*a*4*(1+1/3)*6)):this._setGPUMemory(i*a*4*6),this._setWarpMode(_.TEXTURE_WRAP_S,this._wrapModeU),this._setWarpMode(_.TEXTURE_WRAP_T,this._wrapModeV),this._setFilterMode(this._filterMode),this._readyed=!0,this._activeResource()}setSixSidePixels(e,r=0){if(!e)throw new Error("TextureCube:pixels can't be null.");var i=Math.max(this._width>>r,1),a=Math.max(this._height>>r,1),n=i*a*this._getFormatByteCount();if(e[0].length= 0.0) {// Sky\r\n\t\t// Calculate the length of the \"atmosphere\"\r\n\t\tfar = sqrt(outerRadius2 + innerRadius2 * eyeRay.y * eyeRay.y - innerRadius2) - innerRadius * eyeRay.y;\r\n\r\n\t\t// Calculate the ray's starting position, then calculate its scattering offset\r\n\t\tfloat height = innerRadius + cameraHeight;\r\n\t\tfloat depth = exp(scaleOverScaleDepth * -cameraHeight);\r\n\t\tfloat startAngle = dot(eyeRay, cameraPos) / height;\r\n\t\tfloat startOffset = depth*scaleAngle(startAngle);\r\n\r\n\t\t// Initialize the scattering loop variables\r\n\t\tfloat sampleLength = far / samples;\r\n\t\tfloat scaledLength = sampleLength * scale;\r\n\t\tvec3 sampleRay = eyeRay * sampleLength;\r\n\t\tvec3 samplePoint = cameraPos + sampleRay * 0.5;\r\n\r\n\t\tvec3 frontColor = vec3(0.0);\r\n\t\t//unrolling this manually to avoid some platform for loop slow\r\n\t\t{\r\n\t\t\tfloat height = length(samplePoint);\r\n\t\t\tfloat depth = exp(scaleOverScaleDepth * (innerRadius - height));\r\n\t\t\tfloat lightAngle = dot(-u_SunLight.direction, samplePoint) / height;\r\n\t\t\tfloat cameraAngle = dot(eyeRay, samplePoint) / height;\r\n\t\t\tfloat scatter = (startOffset + depth*(scaleAngle(lightAngle) - scaleAngle(cameraAngle)));\r\n\t\t\tvec3 attenuate = exp(-clamp(scatter, 0.0, MAX_SCATTER) * (invWavelength * kr4PI + km4PI));\r\n\r\n\t\t\tfrontColor += attenuate * (depth * scaledLength);\r\n\t\t\tsamplePoint += sampleRay;\r\n\t\t}\r\n\t\t{\r\n\t\t\tfloat height = length(samplePoint);\r\n\t\t\tfloat depth = exp(scaleOverScaleDepth * (innerRadius - height));\r\n\t\t\tfloat lightAngle = dot(-u_SunLight.direction, samplePoint) / height;\r\n\t\t\tfloat cameraAngle = dot(eyeRay, samplePoint) / height;\r\n\t\t\tfloat scatter = (startOffset + depth*(scaleAngle(lightAngle) - scaleAngle(cameraAngle)));\r\n\t\t\tvec3 attenuate = exp(-clamp(scatter, 0.0, MAX_SCATTER) * (invWavelength * kr4PI + km4PI));\r\n\r\n\t\t\tfrontColor += attenuate * (depth * scaledLength);\r\n\t\t\tsamplePoint += sampleRay;\r\n\t\t}\r\n\r\n\t\t// Finally, scale the Mie and Rayleigh colors and set up the varying variables for the pixel shader\r\n\t\tcIn = frontColor * (invWavelength * krESun);\r\n\t\tcOut = frontColor * kmESun;\r\n\t} else {// Ground\r\n\t\tfar = (-cameraHeight) / (min(-0.001, eyeRay.y));\r\n\t\tvec3 pos = cameraPos + far * eyeRay;\r\n\r\n\t\t// Calculate the ray's starting position, then calculate its scattering offset\r\n\t\tfloat depth = exp((-cameraHeight) * (1.0/scaleDepth));\r\n\t\tfloat cameraAngle = dot(-eyeRay, pos);\r\n\t\tfloat lightAngle = dot(-u_SunLight.direction, pos);\r\n\t\tfloat cameraScale = scaleAngle(cameraAngle);\r\n\t\tfloat lightScale = scaleAngle(lightAngle);\r\n\t\tfloat cameraOffset = depth*cameraScale;\r\n\t\tfloat temp = lightScale + cameraScale;\r\n\r\n\t\t// Initialize the scattering loop variables\r\n\t\tfloat sampleLength = far / samples;\r\n\t\tfloat scaledLength = sampleLength * scale;\r\n\t\tvec3 sampleRay = eyeRay * sampleLength;\r\n\t\tvec3 samplePoint = cameraPos + sampleRay * 0.5;\r\n\r\n\t\t// Now loop through the sample rays\r\n\t\tvec3 frontColor = vec3(0.0, 0.0, 0.0);\r\n\t\tvec3 attenuate;\r\n\r\n\t\t// Loop removed because we kept hitting SM2.0 temp variable limits. Doesn't affect the image too much.\r\n\t\t{\r\n\t\t\tfloat height = length(samplePoint);\r\n\t\t\tfloat depth = exp(scaleOverScaleDepth * (innerRadius - height));\r\n\t\t\tfloat scatter = depth*temp - cameraOffset;\r\n\t\t\tattenuate = exp(-clamp(scatter, 0.0, MAX_SCATTER) * (invWavelength * kr4PI + km4PI));\r\n\t\t\tfrontColor += attenuate * (depth * scaledLength);\r\n\t\t\tsamplePoint += sampleRay;\r\n\t\t}\r\n\r\n\t\tcIn = frontColor * (invWavelength * krESun + kmESun);\r\n\t\tcOut = clamp(attenuate, 0.0, 1.0);\r\n\t}\r\n\r\n\t#ifdef SUN_HIGH_QUALITY\r\n\t\tv_Vertex = -a_Position.xyz;\r\n\t#elif defined(SUN_SIMPLE) \r\n\t\tv_RayDir = -eyeRay;\r\n\t#else\r\n\t\tv_SkyGroundFactor = -eyeRay.y / SKY_GROUND_THRESHOLD;\r\n\t#endif\r\n\r\n\t// if we want to calculate color in vprog:\r\n\t// in case of linear: multiply by _Exposure in here (even in case of lerp it will be common multiplier, so we can skip mul in fshader)\r\n\tv_GroundColor = u_Exposure * (cIn + u_GroundTint*u_GroundTint * cOut);//u_GroundColor*u_GroundColor is gamma space convert to linear space\r\n\tv_SkyColor = u_Exposure * (cIn * getRayleighPhase(-u_SunLight.direction, -eyeRay));\r\n\r\n\t\r\n\t// The sun should have a stable intensity in its course in the sky. Moreover it should match the highlight of a purely specular material.\r\n\t// This matching was done using the Unity3D standard shader BRDF1 on the 5/31/2017\r\n\t// Finally we want the sun to be always bright even in LDR thus the normalization of the lightColor for low intensity.\r\n\tfloat lightColorIntensity = clamp(length(u_SunLight.color), 0.25, 1.0);\r\n\r\n\t#ifdef SUN_HIGH_QUALITY \r\n\t\tv_SunColor = HDSundiskIntensityFactor * clamp(cOut,0.0,1.0) * u_SunLight.color / lightColorIntensity;\r\n\t#elif defined(SUN_SIMPLE) \r\n\t\tv_SunColor = simpleSundiskIntensityFactor * clamp(cOut * sunScale,0.0,1.0) * u_SunLight.color / lightColorIntensity;\r\n\t#endif\r\n\tgl_Position=remapGLPositionZ(gl_Position);\r\n}\r\n",Mi="#ifdef HIGHPRECISION\r\n\tprecision highp float;\r\n#else\r\n\tprecision mediump float;\r\n#endif\r\n\r\nuniform sampler2D u_MainTexture;\r\nuniform vec4 u_MainColor;\r\n\r\nvarying vec2 v_Texcoord0;\r\nvarying vec4 v_Color;\r\n\r\nvoid main()\r\n{\r\n\tvec4 color = 2.0 * u_MainColor * v_Color;\r\n\t#ifdef MAINTEXTURE\r\n\t\tvec4 mainTextureColor = texture2D(u_MainTexture, v_Texcoord0);\r\n\t\tcolor *= mainTextureColor;\r\n\t#endif\r\n\tgl_FragColor = color;\r\n}\r\n\r\n ",Li='#include "Lighting.glsl";\r\n\r\nattribute vec3 a_Position;\r\nattribute vec3 a_OffsetVector;\r\nattribute vec4 a_Color;\r\nattribute float a_Texcoord0X;\r\nattribute float a_Texcoord0Y;\r\nattribute float a_BirthTime;\r\n\r\nuniform mat4 u_View;\r\nuniform mat4 u_Projection;\r\n\r\nuniform vec4 u_TilingOffset;\r\n\r\nuniform float u_CurTime;\r\nuniform float u_LifeTime;\r\nuniform vec4 u_WidthCurve[10];\r\nuniform int u_WidthCurveKeyLength;\r\n\r\nvarying vec2 v_Texcoord0;\r\nvarying vec4 v_Color;\r\n\r\nfloat hermiteInterpolate(float t, float outTangent, float inTangent, float duration, float value1, float value2)\r\n{\r\n\tfloat t2 = t * t;\r\n\tfloat t3 = t2 * t;\r\n\tfloat a = 2.0 * t3 - 3.0 * t2 + 1.0;\r\n\tfloat b = t3 - 2.0 * t2 + t;\r\n\tfloat c = t3 - t2;\r\n\tfloat d = -2.0 * t3 + 3.0 * t2;\r\n\treturn a * value1 + b * outTangent * duration + c * inTangent * duration + d * value2;\r\n}\r\n\r\nfloat getCurWidth(in float normalizeTime)\r\n{\r\n\tfloat width;\r\n\tif(normalizeTime == 0.0){\r\n\t\twidth=u_WidthCurve[0].w;\r\n\t}\r\n\telse if(normalizeTime >= 1.0){\r\n\t\twidth=u_WidthCurve[u_WidthCurveKeyLength - 1].w;\r\n\t}\r\n\telse{\r\n\t\tfor(int i = 0; i < 10; i ++ )\r\n\t\t{\r\n\t\t\tif(normalizeTime == u_WidthCurve[i].x){\r\n\t\t\t\twidth=u_WidthCurve[i].w;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvec4 lastFrame = u_WidthCurve[i];\r\n\t\t\tvec4 nextFrame = u_WidthCurve[i + 1];\r\n\t\t\tif(normalizeTime > lastFrame.x && normalizeTime < nextFrame.x)\r\n\t\t\t{\r\n\t\t\t\tfloat duration = nextFrame.x - lastFrame.x;\r\n\t\t\t\tfloat t = (normalizeTime - lastFrame.x) / duration;\r\n\t\t\t\tfloat outTangent = lastFrame.z;\r\n\t\t\t\tfloat inTangent = nextFrame.y;\r\n\t\t\t\tfloat value1 = lastFrame.w;\r\n\t\t\t\tfloat value2 = nextFrame.w;\r\n\t\t\t\twidth=hermiteInterpolate(t, outTangent, inTangent, duration, value1, value2);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn width;\r\n}\t\r\n\r\nvoid main()\r\n{\r\n\tfloat normalizeTime = (u_CurTime - a_BirthTime) / u_LifeTime;\r\n\t\r\n\t#ifdef TILINGOFFSET\r\n\t\tv_Texcoord0 = vec2(a_Texcoord0X, 1.0 - a_Texcoord0Y) * u_TilingOffset.xy + u_TilingOffset.zw;\r\n\t#else\r\n\t\tv_Texcoord0 = vec2(a_Texcoord0X, a_Texcoord0Y);\r\n\t#endif\r\n\t\r\n\tv_Color = a_Color;\r\n\t\r\n\tgl_Position = u_Projection * u_View * vec4(a_Position + a_OffsetVector * getCurWidth(normalizeTime),1.0);\r\n\tgl_Position=remapGLPositionZ(gl_Position);\r\n}\r\n',Ci="#ifdef HIGHPRECISION\r\n\tprecision highp float;\r\n#else\r\n\tprecision mediump float;\r\n#endif\r\n\r\n#if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\r\n\tvarying vec4 v_Color;\r\n#endif\r\n\r\n#ifdef ALBEDOTEXTURE\r\n\tuniform sampler2D u_AlbedoTexture;\r\n\tvarying vec2 v_Texcoord0;\r\n#endif\r\n\r\nuniform vec4 u_AlbedoColor;\r\n\r\n#ifdef ALPHATEST\r\n\tuniform float u_AlphaTestValue;\r\n#endif\r\n\r\n#ifdef FOG\r\n\tuniform float u_FogStart;\r\n\tuniform float u_FogRange;\r\n\t#ifdef ADDTIVEFOG\r\n\t#else\r\n\t\tuniform vec3 u_FogColor;\r\n\t#endif\r\n#endif\r\n\r\nvoid main()\r\n{\r\n\tvec4 color = u_AlbedoColor;\r\n\t#ifdef ALBEDOTEXTURE\r\n\t\tcolor *= texture2D(u_AlbedoTexture, v_Texcoord0);\r\n\t#endif\r\n\t#if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\r\n\t\tcolor *= v_Color;\r\n\t#endif\r\n\t\r\n\t#ifdef ALPHATEST\r\n\t\tif(color.a < u_AlphaTestValue)\r\n\t\t\tdiscard;\r\n\t#endif\r\n\t\r\n\tgl_FragColor = color;\r\n\t\r\n\t#ifdef FOG\r\n\t\tfloat lerpFact = clamp((1.0 / gl_FragCoord.w - u_FogStart) / u_FogRange, 0.0, 1.0);\r\n\t\t#ifdef ADDTIVEFOG\r\n\t\t\tgl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.0), lerpFact);\r\n\t\t#else\r\n\t\t\tgl_FragColor.rgb = mix(gl_FragColor.rgb, u_FogColor, lerpFact);\r\n\t\t#endif\r\n\t#endif\r\n\t\r\n}\r\n\r\n",yi='#include "Lighting.glsl";\r\n\r\nattribute vec4 a_Position;\r\n\r\nattribute vec2 a_Texcoord0;\r\n\r\n#ifdef GPU_INSTANCE\r\n\tattribute mat4 a_MvpMatrix;\r\n#else\r\n\tuniform mat4 u_MvpMatrix;\r\n#endif\r\n\r\nattribute vec4 a_Color;\r\nvarying vec4 v_Color;\r\nvarying vec2 v_Texcoord0;\r\n\r\n#ifdef TILINGOFFSET\r\n\tuniform vec4 u_TilingOffset;\r\n#endif\r\n\r\n#ifdef BONE\r\n\tconst int c_MaxBoneCount = 24;\r\n\tattribute vec4 a_BoneIndices;\r\n\tattribute vec4 a_BoneWeights;\r\n\tuniform mat4 u_Bones[c_MaxBoneCount];\r\n#endif\r\n\r\nvoid main() {\r\n\tvec4 position;\r\n\t#ifdef BONE\r\n\t\tmat4 skinTransform = u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\r\n\t\tskinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\r\n\t\tskinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\r\n\t\tskinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\r\n\t\tposition=skinTransform*a_Position;\r\n\t#else\r\n\t\tposition=a_Position;\r\n\t#endif\r\n\t#ifdef GPU_INSTANCE\r\n\t\tgl_Position = a_MvpMatrix * position;\r\n\t#else\r\n\t\tgl_Position = u_MvpMatrix * position;\r\n\t#endif\r\n\r\n\t#ifdef TILINGOFFSET\r\n\t\tv_Texcoord0=TransformUV(a_Texcoord0,u_TilingOffset);\r\n\t#else\r\n\t\tv_Texcoord0=a_Texcoord0;\r\n\t#endif\r\n\r\n\t#if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\r\n\t\tv_Color = a_Color;\r\n\t#endif\r\n\tgl_Position=remapGLPositionZ(gl_Position);\r\n}',Oi='#ifdef HIGHPRECISION\r\n\tprecision highp float;\r\n#else\r\n\tprecision mediump float;\r\n#endif\r\n\r\n#ifdef MAINTEXTURE\r\n\tuniform sampler2D u_MainTexture;\r\n#endif\r\n\r\n#ifdef NORMALTEXTURE\r\n\tuniform sampler2D u_NormalTexture;\r\n#endif\r\n\r\nuniform vec4 u_HorizonColor;\r\n\r\nvarying vec3 v_Normal;\r\nvarying vec3 v_Tangent;\r\nvarying vec3 v_Binormal;\r\nvarying vec3 v_ViewDir;\r\nvarying vec2 v_Texcoord0;\r\nvarying vec2 v_Texcoord1;\r\n\r\n#include "Lighting.glsl"\r\n\r\nvoid main()\r\n{\r\n\tvec4 bumpColor1 = texture2D(u_NormalTexture, v_Texcoord0);\r\n\tvec4 bumpColor2 = texture2D(u_NormalTexture, v_Texcoord1);\r\n\t\r\n\tvec3 normal1 = NormalSampleToWorldSpace1(bumpColor1, v_Tangent, v_Binormal, v_Normal);\r\n\tvec3 normal2 = NormalSampleToWorldSpace1(bumpColor2, v_Tangent, v_Binormal, v_Normal);\r\n\t\r\n\tvec3 normal = normalize((normal1 + normal2) * 0.5);\r\n\tvec3 viewDir = normalize(v_ViewDir);\r\n\tfloat fresnel = dot(viewDir, normal);\r\n\t\r\n\tvec4 waterColor = texture2D(u_MainTexture, vec2(fresnel, fresnel));\r\n\t\r\n\tvec4 color;\r\n\tcolor.rgb = mix(waterColor.rgb, u_HorizonColor.rgb, vec3(waterColor.a));\r\n\tcolor.a = u_HorizonColor.a;\r\n\t\r\n\tgl_FragColor = color;\r\n}\r\n\r\n',Ni='#include "Lighting.glsl";\r\n\r\nattribute vec4 a_Position;\r\nattribute vec3 a_Normal;\r\nattribute vec4 a_Tangent0;\r\n\r\nuniform mat4 u_MvpMatrix;\r\nuniform mat4 u_WorldMat;\r\nuniform vec3 u_CameraPos;\r\nuniform float u_WaveScale;\r\nuniform vec4 u_WaveSpeed;\r\nuniform float u_Time;\r\n\r\nvarying vec3 v_Normal;\r\nvarying vec3 v_Tangent;\r\nvarying vec3 v_Binormal;\r\nvarying vec3 v_ViewDir;\r\nvarying vec2 v_Texcoord0;\r\nvarying vec2 v_Texcoord1;\r\n\r\nvoid main()\r\n{\r\n\tvec4 positionWorld = u_WorldMat * a_Position;\r\n\tvec4 position = u_MvpMatrix * a_Position;\r\n\t\r\n\tvec4 temp = vec4(positionWorld.x, positionWorld.z, positionWorld.x, positionWorld.z) * u_WaveScale + u_WaveSpeed * u_WaveScale * u_Time;\r\n\t\r\n\tv_Texcoord0 = temp.xy * vec2(0.4, 0.45);\r\n\tv_Texcoord1 = temp.wz;\r\n\t\r\n\tmat3 worldMat = mat3(u_WorldMat);\r\n\tv_Normal = worldMat * a_Normal;\r\n\tv_Tangent = worldMat * a_Tangent0.xyz;\r\n\tv_Binormal = cross(v_Normal, v_Tangent) * a_Tangent0.w;\r\n\t\r\n\tv_ViewDir = u_CameraPos - positionWorld.xyz;\r\n\tgl_Position = position;\r\n\tgl_Position=remapGLPositionZ(gl_Position);\r\n}';class Pi{constructor(){this.textureID=-1}}class wi extends t.Resource{constructor(e,t,r,i,a){super(),this._stateParamsMap=[],this._uploadMark=-1,this._uploadRenderType=-1,this._vs=e,this._ps=t,this._attributeMap=r,this._uniformMap=i,this._shaderPass=a,this._create(),this.lock=!0}_create(){var e=t.LayaGL.instance;for(var r in this._program=e.createProgram(),this._vshader=this._createShader(e,this._vs,e.VERTEX_SHADER),this._pshader=this._createShader(e,this._ps,e.FRAGMENT_SHADER),e.attachShader(this._program,this._vshader),e.attachShader(this._program,this._pshader),this._attributeMap)e.bindAttribLocation(this._program,this._attributeMap[r],r);if(e.linkProgram(this._program),!t.Render.isConchApp&&F.debugMode&&!e.getProgramParameter(this._program,e.LINK_STATUS))throw e.getProgramInfoLog(this._program);var i=[],a=[],n=[],s=[],o=[];this._customUniformParamsMap=[];var l,_,h,c=e.getProgramParameter(this._program,e.ACTIVE_UNIFORMS);for(t.WebGLContext.useProgram(e,this._program),this._curActTexIndex=0,_=0;_0?(l.name=u=u.substr(0,u.length-3),l.isArray=!0):(l.name=u,l.isArray=!1),l.type=d.type,this._addShaderUnifiormFun(l);var f=this._uniformMap[u];if(null!=f)switch(l.dataOffset=F.propertyNameToID(u),f){case F.PERIOD_CUSTOM:o.push(l);break;case F.PERIOD_MATERIAL:s.push(l);break;case F.PERIOD_SPRITE:n.push(l);break;case F.PERIOD_CAMERA:a.push(l);break;case F.PERIOD_SCENE:i.push(l);break;default:throw new Error("Shader3D: period is unkonw.")}}for(this._sceneUniformParamsMap=t.LayaGL.instance.createCommandEncoder(4*i.length*5+4,64,!0),_=0,h=i.length;_=0&&(l=l.substr(0,c)),s=u||new t.ShaderNode(a),u=null,s.text=l,(c=l.indexOf("#"))>=0){for(_="#",E=c+1,m=l.length;E0&&t.ShaderCompile.splitToWords(l,o),u=s,o.text+="\n"+l;continue}a.length>0&&t.ShaderCompile.splitToWords(l,s)}s.setParent(e)}}_resizeCacheShaderMap(e,t,r){var i=this._cacheShaderHierarchy-1;if(t==i){for(var a in e)for(var n=e[a],s=0,o=r-i;sthis._cacheShaderHierarchy&&(this._resizeCacheShaderMap(r,0,i),this._cacheShaderHierarchy=i);for(var a=e._mask,n=e._length-1,o=this._cacheShaderHierarchy-1,l=0;lBi.MAX_PSSM_COUNT&&(this._shadowMapCount=Bi.MAX_PSSM_COUNT),this._scene=e,this._maxDistance=t,this.shadowMapCount=a,this._globalParallelLightDir=r,this._ratioOfDistance=1/this._shadowMapCount;for(var s=0;s0?e:1)<=Bi.MAX_PSSM_COUNT?e:Bi.MAX_PSSM_COUNT,this._shadowMapCount!=e){this._shadowMapCount=e,this._ratioOfDistance=1/this._shadowMapCount,this._statesDirty=!0,this._shaderValueLightVP=new Float32Array(16*e),this._shaderValueVPs.length=e;for(var t=0;tthis._shadowMapCount)throw new Error("ParallelSplitShadowMap: beginSample invalid index");this._currentPSSM=e,this._update(t)}endSampler(e){this._currentPSSM=-1}_calcAllLightCameraInfo(e){if(1===this._shadowMapCount)this._beginSampler(0,e),this.endSampler(e);else for(var t=0,r=this._shadowMapCount+1;t0?p.createPerspective(3.1416*e.fieldOfView/180,e.aspectRatio,this._spiltDistance[this._currentPSSM-1],this._spiltDistance[this._currentPSSM],this._tempMatrix44):p.createPerspective(3.1416*e.fieldOfView/180,e.aspectRatio,this._spiltDistance[0],this._spiltDistance[this._shadowMapCount],this._tempMatrix44),p.multiply(this._tempMatrix44,e.viewMatrix,this._tempMatrix44),this._splitFrustumCulling.matrix=this._tempMatrix44}_rebuildRenderInfo(){var e,r=this._shadowMapCount+1;for(this.cameras.length=r,e=0;ec.x?u.x:c.x,c.y=u.y>c.y?u.y:c.y,c.z=u.z>c.z?u.z:c.z}a.add(this._tempMax,this._tempMin,this._tempValue),u.x*=.5,u.y*=.5,u.z*=.5,u.w=1,a.transformByM4x4(this._tempValue,h.transform.worldMatrix,this._tempValue);var T=Math.abs(-this._tempMax.z),g=T>this._maxDistance?T:this._maxDistance;n.scale(this._globalParallelLightDir,g,this._tempPos);var S=this._tempPos;S.x=u.x-S.x,S.y=u.y-S.y,S.z=u.z-S.z,h.transform.position=this._tempPos,h.transform.lookAt(this._tempLookAt3,this._tempLightUp,!1),p.createOrthoOffCenter(d.x,c.x,d.y,c.y,1,g+.5*(c.z-d.z),h.projectionMatrix);var v=h.projectionViewMatrix;Bi.multiplyMatrixOutFloat32Array(this._tempScaleMatrix44,v,this._shaderValueVPs[this._currentPSSM]),this._scene._shaderValues.setBuffer(o.Scene3D.SHADOWLIGHTVIEWPROJECT,this._shaderValueLightVP)}static multiplyMatrixOutFloat32Array(e,t,r){var i,a,n,s,o,l,_;for(a=e.elements,n=t.elements,i=0;i<4;i++)s=a[i],o=a[i+4],l=a[i+8],_=a[i+12],r[i]=s*n[0]+o*n[1]+l*n[2]+_*n[3],r[i+4]=s*n[4]+o*n[5]+l*n[6]+_*n[7],r[i+8]=s*n[8]+o*n[9]+l*n[10]+_*n[11],r[i+12]=s*n[12]+o*n[13]+l*n[14]+_*n[15]}setShadowMapTextureSize(e){e!==this._shadowMapTextureSize&&(this._shadowMapTextureSize=e,this._shadowPCFOffset.x=1/this._shadowMapTextureSize,this._shadowPCFOffset.y=1/this._shadowMapTextureSize,this._statesDirty=!0)}disposeAllRenderTarget(){for(var e=0,t=this._shadowMapCount+1;e0){var t=e._alternateLights.shift();t._addToLightQueue(),t._isAlternate=!1,e._lightCount++}}_addToLightQueue(){}_removeFromLightQueue(){}_onActive(){super._onActive(),this.lightmapBakedType!==Ui.LIGHTMAPBAKEDTYPE_BAKED&&this._addToScene()}_onInActive(){super._onInActive(),this.lightmapBakedType!==Ui.LIGHTMAPBAKEDTYPE_BAKED&&this._removeFromScene()}_create(){return new Ui}get diffuseColor(){return console.log("LightSprite: discard property,please use color property instead."),this.color}set diffuseColor(e){console.log("LightSprite: discard property,please use color property instead."),this.color=e}}Ui.LIGHTMAPBAKEDTYPE_REALTIME=0,Ui.LIGHTMAPBAKEDTYPE_MIXED=1,Ui.LIGHTMAPBAKEDTYPE_BAKED=2;class Gi extends Ui{set shadow(e){this._shadow!==e&&(this._shadow=e,this.scene&&this._initShadow())}constructor(){super(),this._direction=new n}_initShadow(){if(this._shadow)this._parallelSplitShadowMap=new Bi,this.scene.parallelSplitShadowMaps.push(this._parallelSplitShadowMap),this.transform.worldMatrix.getForward(this._direction),n.normalize(this._direction,this._direction),this._parallelSplitShadowMap.setInfo(this.scene,this._shadowFarPlane,this._direction,this._shadowMapSize,this._shadowMapCount,this._shadowMapPCFType);else{var e=this._scene._shaderValues,t=this.scene.parallelSplitShadowMaps;t.splice(t.indexOf(this._parallelSplitShadowMap),1),this._parallelSplitShadowMap.disposeAllRenderTarget(),this._parallelSplitShadowMap=null,e.removeDefine(k.SHADERDEFINE_SHADOW_PSSM1),e.removeDefine(k.SHADERDEFINE_SHADOW_PSSM2),e.removeDefine(k.SHADERDEFINE_SHADOW_PSSM3)}}_addToLightQueue(){this._scene._directionLights.add(this)}_removeFromLightQueue(){this._scene._directionLights.remove(this)}}class zi extends Ui{get range(){return this._range}set range(e){this._range=e}constructor(){super(),this._range=6}_addToLightQueue(){this._scene._pointLights.add(this)}_removeFromLightQueue(){this._scene._pointLights.remove(this)}_parse(e,t){super._parse(e,t),this.range=e.range}}class Hi extends Ui{get spotAngle(){return this._spotAngle}set spotAngle(e){this._spotAngle=Math.max(Math.min(e,179),0)}get range(){return this._range}set range(e){this._range=e}constructor(){super(),this._spotAngle=30,this._range=10,this._direction=new n}_addToLightQueue(){this._scene._spotLights.add(this)}_removeFromLightQueue(){this._scene._spotLights.remove(this)}_parse(e,t){super._parse(e,t),this.range=e.range,this.spotAngle=e.spotAngle}}class Wi{static _createSprite3DInstance(e,t,r){var i;switch(e.type){case"Scene3D":i=new pr;break;case"Sprite3D":i=new ae;break;case"MeshSprite3D":i=new $e,r&&e.props.isStatic&&r.push(i);break;case"SkinnedMeshSprite3D":i=new vr;break;case"ShuriKenParticle3D":i=new Vt;break;case"Camera":i=new Ue;break;case"DirectionLight":i=new Gi;break;case"PointLight":i=new zi;break;case"SpotLight":i=new Hi;break;case"TrailSprite3D":i=new Cr;break;default:throw new Error("Utils3D:unidentified class type in (.lh) file.")}var a=e.child;if(a)for(var n=0,s=a.length;n0&&".."!==i[s]&&(i.splice(s,2),a-=2)}r=i.join("/")}return r}static _endLoad(e,r=null,i=null){if(i)for(var a=0,n=i.length;a0){var f=c/d,m=t.Handler.create(null,ki._onProcessChange,[e,u,f],!1);ki._innerFourthLevelLoaderManager._create(_,!1,t.Handler.create(null,ki._onHierarchyInnerForthLevResouLoaded,[e,m,r,h,s,o,l,u+f*_.length,f]),m,null,null,null,1,!0)}else ki._onHierarchyInnerForthLevResouLoaded(e,null,r,h,s,o,l,u,f)}static _onHierarchyInnerForthLevResouLoaded(e,r,i,a,n,s,o,l,_){if(r&&r.recover(),o.length>0){var h=t.Handler.create(null,ki._onProcessChange,[e,l,_],!1);ki._innerThirdLevelLoaderManager._create(o,!1,t.Handler.create(null,ki._onHierarchyInnerThirdLevResouLoaded,[e,h,i,a,n,s,l+_*s.length,_]),r,null,null,null,1,!0)}else ki._onHierarchyInnerThirdLevResouLoaded(e,null,i,a,n,s,l,_)}static _onHierarchyInnerThirdLevResouLoaded(e,r,i,a,n,s,o,l){if(r&&r.recover(),s.length>0){var _=t.Handler.create(null,ki._onProcessChange,[e,o,l],!1);ki._innerSecondLevelLoaderManager._create(s,!1,t.Handler.create(null,ki._onHierarchyInnerSecondLevResouLoaded,[e,_,i,a,n,o+l*s.length,l]),r,null,null,null,1,!0)}else ki._onHierarchyInnerSecondLevResouLoaded(e,null,i,a,n,o,l)}static _onHierarchyInnerSecondLevResouLoaded(e,r,i,a,n,s,o){if(r&&r.recover(),n.length>0){var l=t.Handler.create(null,ki._onProcessChange,[e,s,o],!1);ki._innerFirstLevelLoaderManager._create(n,!1,t.Handler.create(null,ki._onHierarchyInnerFirstLevResouLoaded,[e,l,i,a]),r,null,null,null,1,!0)}else ki._onHierarchyInnerFirstLevResouLoaded(e,null,i,a)}static _onHierarchyInnerFirstLevResouLoaded(e,t,r,i){t&&t.recover(),e._cache=e._createCache;var a="Scene3D"===r.data.type?Wi._parseScene(r,e._propertyParams,e._constructParams):Wi._parse(r,e._propertyParams,e._constructParams);ki._endLoad(e,a,i)}static _loadMesh(e){e.on(t.Event.LOADED,null,ki._onMeshLmLoaded,[e]),e.load(e.url,t.Loader.BUFFER,!1,null,!0)}static _onMeshLmLoaded(e,t){e._cache=e._createCache;var r=Gr._parse(t,e._propertyParams,e._constructParams);ki._endLoad(e,r)}static _loadMaterial(e){e.on(t.Event.LOADED,null,ki._onMaterilLmatLoaded,[e]),e.load(e.url,t.Loader.JSON,!1,null,!0)}static _onMaterilLmatLoaded(e,r){var i,a=e.url,n=A.getURLVerion(a),s=t.URL.getPath(a),o=[],l=[];r.customProps;switch(r.version){case"LAYAMATERIAL:01":case"LAYAMATERIAL:02":var _,h,c=r.props.textures;if(c)for(_=0,h=c.length;_0){var T=t.Handler.create(null,ki._onProcessChange,[e,E,f/m],!1);ki._innerFourthLevelLoaderManager._create(o,!1,t.Handler.create(null,ki._onMateialTexturesLoaded,[e,T,r,l]),T,null,null,null,1,!0)}else ki._onMateialTexturesLoaded(e,null,r,null)}static _onMateialTexturesLoaded(e,t,r,i){e._cache=e._createCache;var a=W._parse(r,e._propertyParams,e._constructParams);ki._endLoad(e,a,i),t&&t.recover()}static _loadAvatar(e){e.on(t.Event.LOADED,null,function(t){e._cache=e._createCache;var r=H._parse(t,e._propertyParams,e._constructParams);ki._endLoad(e,r)}),e.load(e.url,t.Loader.JSON,!1,null,!0)}static _loadAnimationClip(e){e.on(t.Event.LOADED,null,function(t){e._cache=e._createCache;var r=D._parse(t,e._propertyParams,e._constructParams);ki._endLoad(e,r)}),e.load(e.url,t.Loader.BUFFER,!1,null,!0)}static _loadTexture2D(e){var r,i=e.url,a=i.lastIndexOf(".")+1,n=i.indexOf("?"),s=-1==n?i.length:n;switch(i.substr(a,s-a)){case"jpg":case"jpeg":case"bmp":case"gif":case"png":r="nativeimage";break;case"dds":case"ktx":case"pvr":r=t.Loader.BUFFER}e.on(t.Event.LOADED,null,function(r){e._cache=e._createCache;var i=t.Texture2D._parse(r,e._propertyParams,e._constructParams);ki._endLoad(e,i)}),e.load(e.url,r,!1,null,!0)}static _loadTextureCube(e){e.on(t.Event.LOADED,null,ki._onTextureCubeLtcLoaded,[e]),e.load(e.url,t.Loader.JSON,!1,null,!0)}static _onTextureCubeLtcLoaded(e,r){var i=t.URL.getPath(e.url),a=[ki.formatRelativePath(i,r.front),ki.formatRelativePath(i,r.back),ki.formatRelativePath(i,r.left),ki.formatRelativePath(i,r.right),ki.formatRelativePath(i,r.up),ki.formatRelativePath(i,r.down)];ki._onProcessChange(e,0,1/7,1);var n=t.Handler.create(null,ki._onProcessChange,[e,1/7,6/7],!1);ki._innerFourthLevelLoaderManager.load(a,t.Handler.create(null,ki._onTextureCubeImagesLoaded,[e,a,n]),n,"nativeimage")}static _onTextureCubeImagesLoaded(e,r,i){for(var a=new Array(6),n=0;n<6;n++)a[n]=t.Loader.getRes(r[n]);e._cache=e._createCache;var s=Hr._parse(a,e._propertyParams,e._constructParams);for(i.recover(),n=0;n<6;n++)t.Loader.clearRes(r[n]);ki._endLoad(e,s)}static _onProcessChange(e,r,i,a){(a=r+a*i)<1&&e.event(t.Event.PROGRESS,a)}static init(e,t,r=null,i=null){if(!ki._isInit){ki._isInit=!0,r&&r.cloneTo(s._config),r=s._config,oe.debugFrustumCulling=r.debugFrustumCulling,ki._editerEnvironment=r._editerEnvironment,pr.octreeCulling=r.octreeCulling,pr.octreeInitialSize=r.octreeInitialSize,pr.octreeInitialCenter=r.octreeInitialCenter,pr.octreeMinNodeSize=r.octreeMinNodeSize,pr.octreeLooseness=r.octreeLooseness;var a=window.Physics3D;null==a?(Zt._enbalePhysics=!1,ki.__init__(e,t,r),i&&i.run()):(Zt._enbalePhysics=!0,a(1024*r.defaultPhysicsMemory*1024).then(function(){ki.__init__(e,t,r),i&&i.run()}))}}}ki.HIERARCHY="HIERARCHY",ki.MESH="MESH",ki.MATERIAL="MATERIAL",ki.TEXTURE2D="TEXTURE2D",ki.TEXTURECUBE="TEXTURECUBE",ki.ANIMATIONCLIP="ANIMATIONCLIP",ki.AVATAR="AVATAR",ki.TERRAINHEIGHTDATA="TERRAINHEIGHTDATA",ki.TERRAINRES="TERRAIN",ki._innerFirstLevelLoaderManager=new t.LoaderManager,ki._innerSecondLevelLoaderManager=new t.LoaderManager,ki._innerThirdLevelLoaderManager=new t.LoaderManager,ki._innerFourthLevelLoaderManager=new t.LoaderManager,ki._isInit=!1,ki._editerEnvironment=!1,ki.physicsSettings=new nr,window.Laya3D=ki;class Xi extends t.Component{constructor(){super(...arguments),this._indexInPool=-1}get isSingleton(){return!1}_checkProcessTriggers(){var e=Xi.prototype;return this.onTriggerEnter!==e.onTriggerEnter||(this.onTriggerStay!==e.onTriggerStay||this.onTriggerExit!==e.onTriggerExit)}_checkProcessCollisions(){var e=Xi.prototype;return this.onCollisionEnter!==e.onCollisionEnter||(this.onCollisionStay!==e.onCollisionStay||this.onCollisionExit!==e.onCollisionExit)}_onAwake(){this.onAwake(),this.onStart!==Xi.prototype.onStart&&t.Laya.startTimer.callLater(this,this.onStart)}_onEnable(){this.owner._scene._addScript(this);var e=Xi.prototype;this.onKeyDown!==e.onKeyDown&&t.Laya.stage.on(t.Event.KEY_DOWN,this,this.onKeyDown),this.onKeyPress!==e.onKeyPress&&t.Laya.stage.on(t.Event.KEY_PRESS,this,this.onKeyUp),this.onKeyUp!==e.onKeyUp&&t.Laya.stage.on(t.Event.KEY_UP,this,this.onKeyUp)}_onDisable(){this.owner._scene._removeScript(this),this.owner.offAllCaller(this),t.Laya.stage.offAllCaller(this)}_isScript(){return!0}_onAdded(){var e=this.owner,t=e._scripts;t||(e._scripts=t=[]),t.push(this),e._needProcessCollisions||(e._needProcessCollisions=this._checkProcessCollisions()),e._needProcessTriggers||(e._needProcessTriggers=this._checkProcessTriggers())}_onDestroy(){var e=this.owner._scripts;e.splice(e.indexOf(this),1);var t=this.owner;t._needProcessTriggers=!1;for(var r=0,i=e.length;r=0&&e=0&&t0?s:0,_=Math.floor(i.width/(2-o)),h=Math.floor(i.height/(2-l)),c=Math.max(_,h);n=Math.log2(c)+this._diffusion-10;var d=Math.floor(n),u=Math.min(Math.max(d,1),Qi.MAXPYRAMIDSIZE),f=.5+n-d;this._shaderData.setNumber(Qi.SHADERVALUE_SAMPLESCALE,f);var m=te.gammaToLinearSpace(this.threshold),E=m*this._softKnee+1e-5;this._shaderThreshold.setValue(m,m-E,2*E,.25/E),this._shaderData.setVector(Qi.SHADERVALUE_THRESHOLD,this._shaderThreshold);var T=te.gammaToLinearSpace(this.clamp);this._shaderParams.setValue(T,0,0,0),this._shaderData.setVector(Qi.SHADERVALUE_PARAMS,this._shaderParams);for(var p=this.fastMode?1:0,g=e.source,S=0;S=0;S--)R=(v=2*S)+1,x=this._pyramid[v],A=this._pyramid[R],r.setShaderDataTexture(this._shaderData,Qi.SHADERVALUE_BLOOMTEX,x),r.blitScreenTriangle(D,A,this._shader,this._shaderData,Qi.SUBSHADER_UPSAMPLETENT+p),D=A;var M=this._linearColor;this.color.toLinear(M);var L=Math.pow(2,this._intensity/10)-1,C=this._shaderSetting;this._shaderSetting.setValue(f,L,this._dirtIntensity,u);var y=this.dirtTexture?this.dirtTexture:t.Texture2D.blackTexture,O=y.width/y.height,N=i.width/i.height,P=this._dirtTileOffset;O>N?P.setValue(N/O,1,.5*(1-P.x),0):O>>0)+(t>>>0),n=r+e+(a/2>>>31)>>>0,s=a>>>0;this._state0U=r,this._state0L=i;var o=0,l=0;o=(e^=o=e<<23|(-512&t)>>>9)^r,l=(t^=l=t<<23)^i;o^=e>>>18,l^=t>>>18|(262143&e)<<14;return o^=r>>>5,l^=i>>>5|(31&r)<<27,this._state1U=o,this._state1L=l,[n,s]}random(){var e=this.randomint(),t=e[0],r=1023<<20|t>>>12,i=0|(e[1]>>>12|(4095&t)<<20);return Ki._CONVERTION_BUFFER.setUint32(0,r,!1),Ki._CONVERTION_BUFFER.setUint32(4,i,!1),Ki._CONVERTION_BUFFER.getFloat64(0,!1)-1}}Ki._CONVERTION_BUFFER=new DataView(new ArrayBuffer(8)),Ki.defaultRand=new Ki([0,Date.now()/65536,0,Date.now()%65536]);class Ji{constructor(e,t){this._width=0,this._height=0,this._width=e,this._height=t}static get fullScreen(){return new Ji(-1,-1)}get width(){return-1===this._width?P.clientWidth:this._width}get height(){return-1===this._height?P.clientHeight:this._height}}e.AlternateLightQueue=hr,e.AnimationClip=D,e.AnimationClipParser03=S,e.AnimationClipParser04=R,e.AnimationEvent=_,e.AnimationNode=z,e.AnimationTransform3D=G,e.Animator=O,e.AnimatorControllerLayer=L,e.AnimatorPlayState=M,e.AnimatorState=C,e.AnimatorStateScript=class{constructor(){}onStateEnter(){}onStateUpdate(){}onStateExit(){}},e.Avatar=H,e.BaseCamera=Oe,e.BaseMaterial=W,e.BaseRender=je,e.BaseShape=xt,e.BatchMark=le,e.BlinnPhongMaterial=Y,e.BlitScreenQuadCMD=Ve,e.BloomEffect=Qi,e.BoundBox=Ye,e.BoundFrustum=Re,e.BoundSphere=_t,e.Bounds=Ze,e.BoundsOctree=Tr,e.BoundsOctreeNode=mr,e.BoxColliderShape=qt,e.BoxShape=Dt,e.BufferState=De,e.Burst=mt,e.Camera=Ue,e.CapsuleColliderShape=Qt,e.CastShadowList=Bt,e.CharacterController=Or,e.CircleShape=Mt,e.Cluster=Te,e.ColliderShape=jt,e.Collision=Xt,e.CollisionTool=Yt,e.CollisionUtils=ve,e.Color=te,e.ColorOverLifetime=Tt,e.Command=we,e.CommandBuffer=Be,e.CompoundColliderShape=Kt,e.ConchQuaternion=g,e.ConchVector3=T,e.ConchVector4=E,e.ConeColliderShape=Jt,e.ConeShape=Lt,e.Config3D=s,e.Constraint3D=class{constructor(){}},e.ConstraintComponent=class extends t.Component{constructor(){super(),this._feedbackEnabled=!1}get enabled(){return super.enabled}set enabled(e){this._nativeConstraint.IsEnabled=e,super.enabled=e}get breakingImpulseThreshold(){return this._breakingImpulseThreshold}set breakingImpulseThreshold(e){this._nativeConstraint.BreakingImpulseThreshold=e,this._breakingImpulseThreshold=e}get appliedImpulse(){return this._feedbackEnabled||(this._nativeConstraint.EnableFeedback(!0),this._feedbackEnabled=!0),this._nativeConstraint.AppliedImpulse}get connectedBody(){return this._connectedBody}set connectedBody(e){this._connectedBody=e}_onDestroy(){Zt._physics3D.destroy(this._nativeConstraint),this._nativeConstraint=null}},e.ContactPoint=kt,e.ContainmentType=Se,e.CylinderColliderShape=$t,e.DefineDatas=V,e.DirectionLight=Gi,e.DirectionLightQueue=_r,e.DynamicBatchManager=re,e.EffectMaterial=Z,e.Emission=ct,e.ExtendTerrainMaterial=j,e.FloatKeyframe=c,e.FrameOverTime=pt,e.FrustumCulling=oe,e.GeometryElement=_e,e.Gradient=tt,e.GradientAngularVelocity=gt,e.GradientColor=Et,e.GradientDataInt=St,e.GradientDataNumber=dt,e.GradientDataVector2=ji,e.GradientMode=et,e.GradientSize=vt,e.GradientVelocity=Rt,e.HalfFloatUtils=v,e.HeightMap=Yi,e.HeightfieldColliderShape=class{constructor(){}},e.HemisphereShape=Ct,e.HitResult=Ht,e.ILaya3D=o,e.IndexBuffer3D=Me,e.Input3D=ar,e.Keyframe=h,e.KeyframeNode=l,e.KeyframeNodeList=I,e.KeyframeNodeOwner=y,e.Laya3D=ki,e.LightQueue=lr,e.LightSprite=Ui,e.LoadModelV04=Fr,e.LoadModelV05=Br,e.MathUtils3D=r,e.Matrix3x3=d,e.Matrix4x4=p,e.Mesh=Gr,e.MeshColliderShape=er,e.MeshFilter=Qe,e.MeshReader=Ur,e.MeshRenderDynamicBatchManager=Je,e.MeshRenderStaticBatchManager=ke,e.MeshRenderer=qe,e.MeshSprite3D=$e,e.MeshSprite3DShaderDeclaration=Xe,e.MeshTerrainSprite3D=Zi,e.MouseTouch=Gt,e.OctreeMotionList=Er,e.PBRSpecularMaterial=q,e.PBRStandardMaterial=Q,e.ParallelSplitShadowMap=Bi,e.Physics3D=Zt,e.Physics3DUtils=it,e.PhysicsCollider=Pr,e.PhysicsComponent=rr,e.PhysicsSettings=nr,e.PhysicsSimulation=ir,e.PhysicsTriggerComponent=Nr,e.PhysicsUpdateList=Wt,e.Picker=xe,e.PixelLineData=class{constructor(){this.startPosition=new n,this.endPosition=new n,this.startColor=new te,this.endColor=new te}cloneTo(e){this.startPosition.cloneTo(e.startPosition),this.endPosition.cloneTo(e.endPosition),this.startColor.cloneTo(e.startColor),this.endColor.cloneTo(e.endColor)}},e.PixelLineFilter=cr,e.PixelLineMaterial=bt,e.PixelLineRenderer=dr,e.PixelLineSprite3D=ur,e.PixelLineVertex=Ft,e.Plane=pe,e.Point2PointConstraint=class{constructor(){this._pivotInA=new n,this._pivotInB=new n}get pivotInA(){return this._pivotInA}set pivotInA(e){this._pivotInA=e}get pivotInB(){return this._pivotInB}set pivotInB(e){this._pivotInB=e}get damping(){return this._damping}set damping(e){this._damping=e}get impulseClamp(){return this._impulseClamp}set impulseClamp(e){this._impulseClamp=e}get tau(){return this._tau}set tau(e){this._tau=e}},e.PointLight=zi,e.PostProcess=U,e.PostProcessEffect=qi,e.PostProcessRenderContext=N,e.PrimitiveMesh=zr,e.Quaternion=u,e.QuaternionKeyframe=f,e.Rand=ht,e.RandX=Ki,e.Ray=ge,e.RenderContext3D=P,e.RenderElement=Ge,e.RenderQueue=fr,e.RenderState=X,e.RenderTexture=w,e.RenderableSprite3D=ne,e.Rigidbody3D=wr,e.RotationOverLifetime=It,e.Scene3D=pr,e.Scene3DShaderDeclaration=k,e.Scene3DUtils=Wi,e.SceneManager=class{constructor(){}},e.ScreenQuad=Ne,e.ScreenTriangle=Pe,e.Script3D=Xi,e.SetRenderTargetCMD=be,e.SetShaderDataTextureCMD=Fe,e.Shader3D=F,e.ShaderData=B,e.ShaderDefine=b,e.ShaderInit3D=Fi,e.ShaderInstance=wi,e.ShaderPass=Vi,e.ShaderVariable=Pi,e.ShapeUtils=At,e.ShuriKenParticle3D=Vt,e.ShuriKenParticle3DShaderDeclaration=at,e.ShurikenParticleData=ut,e.ShurikenParticleMaterial=rt,e.ShurikenParticleRenderer=nt,e.ShurikenParticleSystem=ft,e.SimpleSingletonList=Ut,e.SingletonList=We,e.Size=Ji,e.SizeOverLifetime=Ot,e.SkinnedMeshRenderer=Sr,e.SkinnedMeshSprite3D=vr,e.SkinnedMeshSprite3DShaderDeclaration=gr,e.SkyBox=Ce,e.SkyBoxMaterial=K,e.SkyDome=or,e.SkyMesh=Le,e.SkyProceduralMaterial=J,e.SkyRenderer=ye,e.SphereColliderShape=tr,e.SphereShape=yt,e.SpotLight=Hi,e.Sprite3D=ae,e.StartFrame=Nt,e.StaticBatchManager=se,e.StaticPlaneColliderShape=Vr,e.SubMesh=br,e.SubMeshDynamicBatch=Ke,e.SubMeshInstanceBatch=me,e.SubMeshRenderElement=ze,e.SubMeshStaticBatch=He,e.SubShader=bi,e.SystemUtils=Ae,e.TextMesh=class{get text(){return this._text}set text(e){this._text=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize=e}get color(){return this._color}set color(e){this._color=e}constructor(){}_createVertexBuffer(e){}_resizeVertexBuffer(e){}_addChar(){}},e.TextureCube=Hr,e.TextureGenerator=x,e.TextureMode=Ir,e.TextureSheetAnimation=Pt,e.Touch=zt,e.TrailFilter=Mr,e.TrailGeometry=Dr,e.TrailMaterial=Rr,e.TrailRenderer=Lr,e.TrailSprite3D=Cr,e.Transform3D=ie,e.UnlitMaterial=$,e.Utils3D=A,e.Vector2=i,e.Vector3=n,e.Vector3Keyframe=m,e.Vector4=a,e.VelocityOverLifetime=wt,e.VertexBuffer3D=he,e.VertexDeclaration=de,e.VertexElement=ue,e.VertexElementFormat=ce,e.VertexMesh=fe,e.VertexPositionTerrain=yr,e.VertexPositionTexture0=sr,e.VertexShuriKenParticle=st,e.VertexShurikenParticleBillboard=ot,e.VertexShurikenParticleMesh=lt,e.VertexTrail=Ar,e.Viewport=Ie,e.WaterPrimaryMaterial=ee}(window.Laya=window.Laya||{},Laya);